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.