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.
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!
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.