8000 fix minor glitch related to llamaindex and finish reason · ag-python-qt/pyqt-openai@d39de57 · GitHub
[go: up one dir, main page]

Skip to content

Commit d39de57

Browse files
committed
fix minor glitch related to llamaindex and finish reason
1 parent ba549aa commit d39de57

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pyqt_openai/chat_widget/chatBrowser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def showText(self, text, stream_f, user_f):
7373
self.widget().setCurrentIndex(1)
7474
return self.__setLabel(text, stream_f, user_f)
7575

76-
7776
def __setLabel(self, text, stream_f, user_f):
7877
chatUnit = QLabel()
7978
if user_f:

pyqt_openai/openAiThread.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class OpenAIThread(QThread):
1515
First: response
1616
Second: user or AI
1717
Third: streaming or not streaming
18+
Forth: Finish reason
1819
"""
1920
replyGenerated = Signal(str, bool, bool, str)
2021
streamFinished = Signal(str)
@@ -64,7 +65,6 @@ def run(self):
6465
try:
6566
self.__llama_idx_instance.set_openai_arg(**self.__openai_arg)
6667
resp = self.__llama_idx_instance.get_response(self.__query_text)
67-
print(resp)
6868
f = isinstance(resp, StreamingResponse)
6969
if f:
7070
for response_text in resp.response_gen:
@@ -74,6 +74,6 @@ def run(self):
7474
self.replyGenerated.emit(resp.response, False, f, '')
7575
except openai.error.InvalidRequestError as e:
7676
self.replyGenerated.emit('<p style="color:red">Your request was rejected as a result of our safety system.<br/>'
77-
'Your prompt may contain text that is not allowed by our safety system.</p>', False)
77+
'Your prompt may contain text that is not allowed by our safety system.</p>', False, False, 'Error')
7878
except openai.error.RateLimitError as e:
79-
self.replyGenerated.emit(f'<p style="color:red">{e}<br/>Check the usage: https://platform.openai.com/account/usage<br/>Update to paid account: https://platform.openai.com/account/billing/overview', False)
79+
self.replyGenerated.emit(f'<p style="color:red">{e}<br/>Check the usage: https://platform.openai.com/account/usage<br/>Update to paid account: https://platform.openai.com/account/billing/overview', False, False, 'Error')

0 commit comments

Comments
 (0)
0