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.18k stars 2.29k forks source link

[Bug]: The chat stuck with error when i talk with uploaded image file #1170

Closed noxonsu closed 1 week ago

noxonsu commented 1 week ago

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

错误表现

when i talk with uploaded image

image


Running on local URL:  http://127.0.0.1:7862

To create a public link, set `share=True` in `launch()`.
2024-09-25 09:00:47,696 [INFO] [models.py:38] 正在加载 OpenAI 模型: GPT-4o
2024-09-25 09:00:47,697 [INFO] [models.py:149] Model is set to:  GPT-4o
2024-09-25 09:01:02,046 [INFO] [base_model.py:615] 用户的输入为:translete this
2024-09-25 09:01:03,949 [INFO] [base_model.py:703] 回答为:The text translates to "Version issue brought by api (#1167)" in English.
2024-09-25 09:01:03,949 [INFO] [base_model.py:709] Tokens per second:20.525676002261644
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/gradio/queueing.py", line 566, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.8/dist-packages/gradio/route_utils.py", line 270, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.8/dist-packages/gradio/blocks.py", line 1847, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.8/dist-packages/gradio/blocks.py", line 1445, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/usr/local/lib/python3.8/dist-packages/gradio/utils.py", line 629, in async_iteration
    return await iterator.__anext__()
  File "/usr/local/lib/python3.8/dist-packages/gradio/utils.py", line 622, in __anext__
    return await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.8/dist-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 851, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.8/dist-packages/gradio/utils.py", line 605, in run_sync_iterator_async
    return next(iterator)
  File "/usr/local/lib/python3.8/dist-packages/gradio/utils.py", line 788, in gen_wrapper
    response = next(iterator)
  File "/root/chuanchu2/ChuanhuChatGPT/modules/utils.py", line 43, in predict
    for i in iter:
  File "/root/chuanchu2/ChuanhuChatGPT/modules/models/base_model.py", line 734, in predict
    self.auto_save(chatbot)
  File "/root/chuanchu2/ChuanhuChatGPT/modules/models/base_model.py", line 983, in auto_save
    save_file(self.history_file_path, self)
  File "/root/chuanchu2/ChuanhuChatGPT/modules/utils.py", line 415, in save_file
    chatbot = [(history[i]["content"], history[i + 1]["content"]) for i in range(0, len(history), 2)]
  File "/root/chuanchu2/ChuanhuChatGPT/modules/utils.py", line 415, in <listcomp>
    chatbot = [(history[i]["content"], history[i + 1]["content"]) for i in range(0, len(history), 2)]
IndexError: list index out of range

复现操作

  1. upload image to chat window
  2. ask something
  3. you got error

错误日志

No response

运行环境

https://github.com/GaiZhenbiao/ChuanhuChatGPT/commit/3856d4f559f7ec5570ace6a92f0cc4017b5595cb

帮助解决

补充说明

No response

GaiZhenbiao commented 1 week ago

it should be fixed now.