@EarnestAl : can you post the suggestion of ChatGPT ?
@karolus here it is:
Question
Can you write an extension for Libreoffice Writer to send a query to ChatGPT and put the answer in the current document.Answer
As an AI language model, I can provide guidance on how to create an extension for Libreoffice Writer that interacts with ChatGPT.The first step is to decide which programming language you want to use for the extension. Libreoffice supports several languages, including Python, Java, and C++, among others. For this example, let’s assume you are using Python.
Next, you’ll need to install the necessary packages to interact with ChatGPT. The most common way to interact with ChatGPT is via an API. There are several options for ChatGPT APIs, including OpenAI’s API, Hugging Face’s API, and more.
Once you’ve chosen your API and installed the necessary packages, you can begin coding your extension. Here is an example Python script that sends a query to ChatGPT and puts the answer in the current document:
import uno
import requests
def get_answer(query):
# Send the query to ChatGPT API
api_key = "<YOUR API KEY>"
headers = {"Authorization": f"Bearer {api_key}"}
url = "<YOUR API URL>"
data = {"query": query}
response = requests.post(url, headers=headers, json=data)
# Get the answer from the response
answer = response.json()["answer"]
return answer
def insert_answer():
# Get the current document
context = uno.getComponentContext()
desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context)
model = desktop.getCurrentComponent()
# Get the query from the user
query = uno.getRunningContext().getServiceManager().createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", context)
query.setTitle("Enter your query")
if query.execute() == uno.getConstantByName("com.sun.star.ui.dialogs.ExecutableDialogResults.OK"):
query_string = query.getFiles()[0]
# Get the answer from ChatGPT
answer = get_answer(query_string)
# Insert the answer into the document
cursor = model.getCurrentController().getViewCursor()
cursor.setString(answer)
To use this script as an extension in Libreoffice Writer, you’ll need to package it as an add-on. You can do this by creating a manifest file that specifies the script as an AddOn and then packaging the manifest and script into an OXT file. Once you have the OXT file, you can install it in Libreoffice Writer using the Extension Manager
I hope this helps you get started on creating an extension for Libreoffice Writer that interacts with ChatGPT!
@EarnestAl Ok the »get_answer« -function looks somewhat reasonable, but after that it’s just wild guessing!
Ha ha. It does very well at stringing plausible nonsense together. It could make a poem of how to it but I won’t ask
Mankind has enough of its own (not artificial) graphomaniacs.
Seems LibreOffice might need to do something a little more sophisticated if it is to maintain compatibility with Microsoft Office. Please see Microsoft to demo its new ChatGPT-like AI in Word, PowerPoint, and Outlook soon - The Verge
Are you able to build something similar to this (but for LibreOffice):
https://github.com/analyticsinmotion/add-chatgpt-to-microsoft-word
Thanks.
Why? If you can’t use 2 different applications you are the perfect MS Word victim.
Here’s a link that explains how you can get ChatGPT to write formulae in Excel. I haven’t tried it but I don’t see any reason why a similar technique shouldn’t work in LibreOffice Calc.
Actually at the shown level of simple formulas you can use excel-solutions directly.
I guess you could ask at the prompt to convert syntax to LO for references to other sheets.
.
On the other hand there is now no integration, neither to MS-office not to any other tool. Bing calls Edge at the moment…
OK, so they try to sell us copy&paste as “integration”
- Open ChatGPT and your spreadsheet
which is LibreOffice Calc configured to use Excel’s formula syntax
- Be very clear with ChatGPT
which is where many users fail anyway regardless of the tools they try to use
- Copy and paste the formula to
ExcelLibreOffice
for perfect 90ies style integration
Sorry forgot to add the link. Something like this in LO would be helpful
This is exactly the sort of thing I was thinking of. Does anyone know if the LO folk are working on something like this for Writer? Timescale?
Did you read this topic? No.
Did you read doubleinfinity’s post about what is available for MS Word from GitHub? No.
Does anyone here have much experience/knowledge of Github? Can we request someone to build it from @EarnestAl 's python script?
So much code without any coders.
if you would read the post carefully, you will see that the code was generated by ChatGpt, and it is “hallucinated” in essential parts!
Definitely not my script. ChatGPT proposed that script and given the quality of other answers I would not bet money on it working.