chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
31.57k stars 5.51k forks source link

TypeError: object of type 'generator' has no len() #1533

Closed jianzhengming closed 1 year ago

jianzhengming commented 1 year ago

**问题描述 /在webui界面进行对话时,无法输出回答,统一报出上述错误。

复现问题的步骤 / Steps to Reproduce

  1. 执行 python startup.py --all-webui --model-name Qwen-7B-Chat
  2. 点击 '...' / Click '...'
  3. 滚动到 http://127.0.0.1:8501
  4. 问题出现 TypeError: object of type 'generator' has no len()

预期的结果 / Expected Result 描述应该出现的结果:输出正确回答

实际结果 / Actual Result Traceback: File "/home/zheng/anaconda3/envs/Langchainchat/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.dict) File "/home/zheng/Langchain-Chatchat/webui.py", line 66, in pages[selected_page]"func" File "/home/zheng/Langchain-Chatchat/webui_pages/dialogue/dialogue.py", line 149, in dialogue_page history = get_messages_history(history_len) File "/home/zheng/Langchain-Chatchat/webui_pages/dialogue/dialogue.py", line 32, in get_messages_history history = chat_box.filter_history(100000, filter) # workaround before upgrading streamlit-chatbox. File "/home/zheng/anaconda3/envs/Langchainchat/lib/python3.8/site-packages/streamlit_chatbox/messages.py", line 142, in filter_history if stop(history): File "/home/zheng/anaconda3/envs/Langchainchat/lib/python3.8/site-packages/streamlit_chatbox/messages.py", line 120, in default_stop user_count = len(x for x in history if x["role"] == "user")

环境信息 / Environment Information

附加信息 / Additional Information 添加与问题相关的任何其他信息 / Add any other information related to the issue.

jamai commented 1 year ago

同问,chat_box过滤之后的值history 异常

jamai commented 1 year ago

解决了 是版本的问题 streamlit-chatbox版本问题 才能正常运行 1.1.6 和 1.1.7 image pip intsall streamlit-chatbox==1.1.7

jianzhengming commented 1 year ago

解决了 是版本的问题 streamlit-chatbox版本问题 才能正常运行 1.1.6 和 1.1.7 image pip intsall streamlit-chatbox==1.1.7

现在可以了,但是LLM问答没有任何结果的输出。

zRzRzRzRzRzRzR commented 1 year ago

新版本中改了chatbox的版本,可以关注一下