cesarhuret / docgpt Goto Github PK
View Code? Open in Web Editor NEWChatGPT directly within Google Docs as an Editor Add-on ๐
Home Page: https://docs.google.com/document/d/1N7qvw5mZdVe2u2IQ5pnVDmUjHsLEfq9_Z0Tf8PHloZA/edit
ChatGPT directly within Google Docs as an Editor Add-on ๐
Home Page: https://docs.google.com/document/d/1N7qvw5mZdVe2u2IQ5pnVDmUjHsLEfq9_Z0Tf8PHloZA/edit
Hi cesarhuret,
Thank you for making this interesting tool for Microsoft Word! I just tested it on my machine, and as you said in README, Word became temporarily unresponsive while waiting for the result from ChatGPT. This could be extremely long when I asked some hard questions. I was wondering is it possible to create a subprocess such that I can use Word when I am waiting for the result? I believe this will give the user a much better experience.
First: Great stuff! Thanks a bunch!
In Word, when the selection includes a footnote marker, the script gives out an error. Perhaps the script can just send plain text to fix it?
Regardless, thanks again!
Hi!
I got this error trying to run docGPT in Docs:
Exception: Request failed for https://chatgpt-api.kesarx.repl.co returned code 502. Truncated server response: <!DOCTYPE html> <html lang="en"> <head> <title>Unable To Wake Up</title> <link rel="stylesheet" href="https://fonts.googleapis.... (use muteHttpExceptions option to examine full response)
Looks like a bad gateway, but Iโm by no means an expert.
Thanks for any help and please let me know if you need more information.
Currently docGPT get a JSON string as response from ChatGPT which contains many useless information. For example, when asking "Can you write a PySide6 example?", the response message looks as follows:
{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"\n\nAs an AI language model, writing code is not my strong suit, but I can give you an example of how you can create a PySide6 program that creates a simple user interface. Here is the code snippet for creating a simple PySide6 window:\n\n```\nfrom PySide6.QtWidgets import QApplication, QMainWindow, QLabel\n\napp = QApplication([])\nwindow = QMainWindow()\nwindow.setWindowTitle(\"My App\")\nlabel = QLabel(\"Hello, World!\")\nwindow.setCentralWidget(label)\nwindow.show()\napp.exec()\n```\n\nIn this example, we import the necessary PySide6 elements and create an instance of the QApplication. Then, we create a QMainWindow instance and set its title to \"My App\". We also create a QLabel and set its text to \"Hello, World!\". We set the label as the central widget of the window and show the window. Finally, we call the `exec()` method of the QApplication instance to start the event loop that handles user input and updates the window.","role":"assistant"}}],"created":1677848730,"id":"chatcmpl-6pzOEBYo5OsArqc1WqfyX1zY6Feke","model":"gpt-3.5-turbo-0301","object":"chat.completion","usage":{"completion_tokens":199,"prompt_tokens":16,"total_tokens":215}}
I believe that for the users, only the "content" field is required to extract and output in human-friendly formats:
As an AI language model, writing code is not my strong suit, but I can give you an example of how you can create a PySide6 program that creates a simple user interface. Here is the code snippet for creating a simple PySide6 window:
'''
from PySide6.QtWidgets import QApplication, QMainWindow, QLabel
app = QApplication([])
window = QMainWindow()
window.setWindowTitle("My App")
label = QLabel("Hello, World!")
window.setCentralWidget(label)
window.show()
app.exec()
'''
In this example, we import the necessary PySide6 elements and create an instance of the QApplication. Then, we create a QMainWindow instance and set its title to "My App". We also create a QLabel and set its text to "Hello, World!". We set the label as the central widget of the window and show the window. Finally, we call the `exec()` method of the QApplication instance to start the event loop that handles user input and updates the window.
I understand the script isn't supposed to be complicated. However, it would be interesting if you were to add the ability for the user to choose additions to the prompt such as "Check this text for grammatical mistakes", "Explain this like I'm a 3-year-old", "Rewrite this with a formal/casual/etc. tone", or "Translate this into fluent English"...
I've already made some simple inelegant changes to add a few more context menu items for my own purposes, but it would be cool to have by default.
Great script by the way!
Hi since this project is discontinued you could mention EndType.com/addon as an alternative which can be installed directly from the extension menu (Search for EndType). Works also on Google Sheets.
It seems that using chat-gpt in word can't relate the questions in the context. For example, if I ask chat-gpt to answer more concretely about the last question I aksed. It seems that chat can't remember the question. Have you guys come across such a problem. Is there anyway that I can solve this problem?
Hi @cesarhuret, I noticed that you're using req.Open "POST", "https://chatgpt-api.kesarx.repl.co/chat", False
which sets sync mode and thus makes Word temporarily unresponsive for a while. I tried to change False
to True
, i.e. async mode and it worked since I could use mouse as usual. However, Keyboard input is disabled before ChatGPT responds. Do you have any idea on this?
Is there any way I can ask ChatGPT to translate the text into English in Word?
Thanks
How do I delete the Ask Chatgpt button thingy? The macro was deleted already and the developers tab is now hidden too
Getting HTTP error 502 response when trying to run script
"Exception: Request failed for https://chatgpt-api.kesarx.repl.co returned code 502. Truncated server response: <title>Unable To Wake Up</title> <link rel="stylesheet" href="https://fonts.googleapis.... (use muteHttpExceptions option to examine full response)"
Update just saw it was discontinued lol my bad
Hello there,
I would like to use my openAI account instead of this one:
function getGPTResponse(question) {
var options = {
'method' : 'post',
'contentType': 'application/json',
// Convert the JavaScript object to a JSON string.
'payload' : JSON.stringify({
'message': question
})
};
const response = UrlFetchApp.fetch('https://chatgpt-api.kesarx.repl.co/chat', options);
const json = JSON.parse(response.getContentText());
return json.choices[0].message.content;
}
Does anyone know how to change it for the openAI chat API? (https://platform.openai.com/docs/api-reference/chat)
Thanks!
Exception: Request failed for https://chatgpt-api.kesarx.repl.co returned code 404. Truncated server response: <title>Run this Repl to see the results here.</title> <link rel="stylesheet" href="http... (use muteHttpExceptions option to examine full response).
I add three new buttons of Ask ChatGPT and how to delete someone on the right-click menu in MS Word.
could you make a chat box inside the google doc itself I know its possible i just dont know how to make it. using the google doc and open ai api you could check for updates in a doc and then send the text inside the document to chatgpt as a prompt. then when gpt replys it pastes it in the document after deleting the prompt so they dont get mixed up. i kinda need it for something so if you make it or know where i can find this reply to me pls
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.