GaiZhenbiao / ChuanhuChatGPT

GUI for ChatGPT API and many LLMs. Supports agents, file-based QA, GPT finetuning and query with web search. All with a neat UI.
https://huggingface.co/spaces/JohnSmith9982/ChuanhuChatGPT
GNU General Public License v3.0
15.12k stars 2.28k forks source link

[Bug]: 本地部署第三方API显示KeyError: 'finish_reason' #912

Closed xiekangmin closed 10 months ago

xiekangmin commented 10 months ago

这个bug是否已存在现有issue了?

错误表现

在载入GUI界面时有警告: fatal: not a git repository (or any of the parent directories): .git 'TZ' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\overwrites.py:89: GradioUnusedKwargWarning: You have unused kwarg parameters in JSON, please remove them: {'readonly': True} res = original_IOComponent_init(self, *args, **kwargs) Running on local URL: http://127.0.0.1:7860

在GUI界面输入任何文字都显示以下错误,第三方API的openai api base已经更改 To create a public link, set share=True in launch(). Traceback (most recent call last): File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\base_model.py", line 466, in predict for chatbot, status_text in iter: File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\base_model.py", line 278, in stream_next_chatbot for partial_text in stream_iter: File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\OpenAI.py", line 44, in get_answer_stream_iter for i in iter: File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\OpenAI.py", line 205, in _decode_chat_response if chunk["choices"][0]["finish_reason"] == "stop": KeyError: 'finish_reason'

复现操作

部署未成功过

错误日志

To create a public link, set `share=True` in `launch()`.
Traceback (most recent call last):
  File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\base_model.py", line 466, in predict
    for chatbot, status_text in iter:
  File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\base_model.py", line 278, in stream_next_chatbot
    for partial_text in stream_iter:
  File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\OpenAI.py", line 44, in get_answer_stream_iter
    for i in iter:
  File "C:\Users\1\Desktop\ChengXu\ChuanhuChatGPT-main\ChuanhuChatGPT-main\modules\models\OpenAI.py", line 205, in _decode_chat_response
    if chunk["choices"][0]["finish_reason"] == "stop":
KeyError: 'finish_reason'

运行环境

帮助解决

补充说明

No response

GaiZhenbiao commented 10 months ago

我测试一下

xiekangmin commented 10 months ago

我的pythoh版本是3.8.5

GaiZhenbiao commented 10 months ago

我测试是没问题的,检查下第三方API URL是否正确?应该是 https://openai.something.com这样的,不应该多或少东西

xiekangmin commented 10 months ago

可是我在另一个GUI上面填写就能使用,我感到很困惑

image
xiekangmin commented 10 months ago

请问大佬可以将我的API key和API url发你帮我测试一下么?

GaiZhenbiao commented 10 months ago

可以的,你可以发到我的邮箱:chefs-vernier.0q@icloud.com