Skip to content

[BUG] 简洁阐述问题 / Langchain 部署本地微调后的模型,但知识库对话报错 #5424

@jackrous

Description

@jackrous

TypeError: string indices must be integers
2025-12-22 10:57:14.598 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:14.629 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:14.657 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:14.659 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:14.910 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:14.940 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:14.968 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:14.968 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:20.011 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:20.041 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:20.078 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:20.080 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:21.203 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:21.234 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:21.262 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:21.263 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:24.080 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:24.111 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:24.139 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:24.140 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:24.140 Uncaught app exception
Traceback (most recent call last):
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui_pages/kb_chat.py", line 118, in kb_chat
kb_list = [x["kb_name"] for x in api.list_knowledge_bases()]
TypeError: 'NoneType' object is not iterable
2025-12-22 10:57:24.335 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:24.366 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:24.394 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:24.394 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:24.395 Uncaught app exception
Traceback (most recent call last):
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui_pages/kb_chat.py", line 118, in kb_chat
kb_list = [x["kb_name"] for x in api.list_knowledge_bases()]
TypeError: 'NoneType' object is not iterable
2025-12-22 10:57:28.117 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:28.146 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:28.175 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:28.175 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:28.176 Uncaught app exception
Traceback (most recent call last):
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui_pages/kb_chat.py", line 118, in kb_chat
kb_list = [x["kb_name"] for x in api.list_knowledge_bases()]
TypeError: 'NoneType' object is not iterable
2025-12-22 10:57:30.091 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:30.121 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:30.148 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:30.149 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:30.150 Uncaught app exception
Traceback (most recent call last):
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui_pages/kb_chat.py", line 118, in kb_chat
kb_list = [x["kb_name"] for x in api.list_knowledge_bases()]
TypeError: 'NoneType' object is not iterable
2025-12-22 10:57:30.427 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:30.457 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:30.500 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:30.512 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:30.513 Uncaught app exception
Traceback (most recent call last):
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui_pages/kb_chat.py", line 118, in kb_chat
kb_list = [x["kb_name"] for x in api.list_knowledge_bases()]
TypeError: 'NoneType' object is not iterable
2025-12-22 10:57:30.707 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:30.759 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:30.813 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:30.836 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:30.838 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:30.991 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:31.038 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /tools: Invalid port: ':1'
2025-12-22 10:57:31.039 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:31.666 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:31.697 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:31.725 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:31.726 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:31.727 Uncaught app exception
Traceback (most recent call last):
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui_pages/kb_chat.py", line 118, in kb_chat
kb_list = [x["kb_name"] for x in api.list_knowledge_bases()]
TypeError: 'NoneType' object is not iterable
2025-12-22 10:57:32.023 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:32.055 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:32.085 | ERROR | chatchat.webui_pages.utils:get:64 - InvalidURL: error when get /knowledge_base/list_knowledge_bases: Invalid port: ':1'
2025-12-22 10:57:32.086 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正确的JSON。'NoneType' object has no attribute 'json'
2025-12-22 10:57:32.086 Uncaught app exception
Traceback (most recent call last):
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/home/boss/Llama-factory/conda/envs/chatchat/lib/python3.10/site-packages/chatchat/webui_pages/kb_chat.py", line 118, in kb_chat
kb_list = [x["kb_name"] for x in api.list_knowledge_bases()]
TypeError: 'NoneType' object is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions