Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] 请教下使用pip部署后对话不能使用,知识库无法创建新的 #5217

Closed
AlienBB12138 opened this issue Feb 10, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@AlienBB12138
Copy link

AlienBB12138 commented Feb 10, 2025

问题描述 / Problem Description
部署后无法使用,我是在虚拟机Ubuntu 22.04上部署的
使用多功能对话报错
使用RAG对话页面打开报错
Image

环境信息 / Environment Information

  • Langchain-Chatchat 版本 / commit 号:0.3.1.3
  • 部署方式(pypi 安装 / 源码部署 / docker 部署):pypi 安装
  • 使用的模型推理框架(Xinference / Ollama / OpenAI API 等):Ollama
  • 使用的 LLM 模型(GLM-4-9B / Qwen2-7B-Instruct 等):qwen2
  • 使用的 Embedding 模型(bge-large-zh-v1.5 / m3e-base 等):nomic-embed-text (bge-large-zh-v1.5尝试过使用这个一样报错)
  • 使用的向量库类型 (faiss / milvus / pg_vector 等): faiss
  • 操作系统及版本 / Operating system and version: Ubuntu 22.04
  • Python 版本 / Python version: 3.10.12
  • 推理使用的硬件(GPU / CPU / MPS / NPU 等) / Inference hardware (GPU / CPU / MPS / NPU, etc.): CPU
    -httpx 版本为 0.27.2

启动日志
`(myenv) root@alien:~/Langchain-Chatchat# chatchat start -a
cwd:/root/Langchain-Chatchat

==============================Langchain-Chatchat Configuration==============================
操作系统:Linux-5.15.0-131-generic-x86_64-with-glibc2.35.
python版本:3.10.12 (main, Jan 17 2025, 14:35:34) [GCC 11.4.0]
项目版本:0.3.1.3
langchain版本:0.1.17
数据目录:/root/Langchain-Chatchat

当前使用的分词器:ChineseRecursiveTextSplitter
默认选用的 Embedding 名称: nomic-embed-text
==============================Langchain-Chatchat Configuration==============================

2025-02-10 06:09:10.750 | INFO | chatchat.startup:start_main_server:257 - 正在启动服务:
2025-02-10 06:09:10.752 | INFO | chatchat.startup:start_main_server:258 - 如需查看 llm_api 日志,请前往 /root/Langchain-Chatchat/data/logs
/root/Langchain-Chatchat/myenv/lib/python3.10/site-packages/langchain/_api/module_import.py:87: LangChainDeprecationWarning: Importing GuardrailsOutputParser from langchain.output_parsers is deprecated. Please replace the import with the following:
from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser
warnings.warn(
/root/Langchain-Chatchat/myenv/lib/python3.10/site-packages/pydantic/_internal/fields.py:160: UserWarning: Field "model_name" has conflict with protected namespace "model".

You may be able to resolve this warning by setting model_config['protected_namespaces'] = ().
warnings.warn(
2025-02-10 06:09:12.841 | INFO | chatchat.startup:run_api_server:55 - Api MODEL_PLATFORMS: [PlatformConfig(platform_name='xinference', platform_type='xinference', api_base_url='http://127.0.0.1:9997/v1', api_key='EMPTY', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=[], embed_models=[], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[]), PlatformConfig(platform_name='ollama', platform_type='ollama', api_base_url='http://127.0.0.1:11434/v1', api_key='EMPTY', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=['qwen2'], embed_models=['nomic-embed-text'], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[]), PlatformConfig(platform_name='oneapi', platform_type='oneapi', api_base_url='http://127.0.0.1:3000/v1', api_key='sk-', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=['chatglm_pro', 'chatglm_turbo', 'chatglm_std', 'chatglm_lite', 'qwen-turbo', 'qwen-plus', 'qwen-max', 'qwen-max-longcontext', 'ERNIE-Bot', 'ERNIE-Bot-turbo', 'ERNIE-Bot-4', 'SparkDesk'], embed_models=['text-embedding-v1', 'Embedding-V1'], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[]), PlatformConfig(platform_name='openai', platform_type='openai', api_base_url='https://api.openai.com/v1', api_key='sk-proj-', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=['gpt-4o', 'gpt-3.5-turbo'], embed_models=['text-embedding-3-small', 'text-embedding-3-large'], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[])]
INFO: Started server process [14756]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://192.168.1.144:7861 (Press CTRL+C to quit)
2025-02-10 06:09:14.211 | INFO | chatchat.startup:run_webui:80 - Webui MODEL_PLATFORMS: [PlatformConfig(platform_name='xinference', platform_type='xinference', api_base_url='http://127.0.0.1:9997/v1', api_key='EMPTY', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=[], embed_models=[], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[]), PlatformConfig(platform_name='ollama', platform_type='ollama', api_base_url='http://127.0.0.1:11434/v1', api_key='EMPTY', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=['qwen2'], embed_models=['nomic-embed-text'], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[]), PlatformConfig(platform_name='oneapi', platform_type='oneapi', api_base_url='http://127.0.0.1:3000/v1', api_key='sk-', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=['chatglm_pro', 'chatglm_turbo', 'chatglm_std', 'chatglm_lite', 'qwen-turbo', 'qwen-plus', 'qwen-max', 'qwen-max-longcontext', 'ERNIE-Bot', 'ERNIE-Bot-turbo', 'ERNIE-Bot-4', 'SparkDesk'], embed_models=['text-embedding-v1', 'Embedding-V1'], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[]), PlatformConfig(platform_name='openai', platform_type='openai', api_base_url='https://api.openai.com/v1', api_key='sk-proj-', api_proxy='', api_concurrencies=5, auto_detect_model=False, llm_models=['gpt-4o', 'gpt-3.5-turbo'], embed_models=['text-embedding-3-small', 'text-embedding-3-large'], text2image_models=[], image2text_models=[], rerank_models=[], speech2text_models=[], text2speech_models=[])]

You can now view your Streamlit app in your browser.

URL: http://192.168.1.144:8501

2025-02-10 06:09:15,451 httpx 14766 INFO HTTP Request: GET http://192.168.1.144:7861/tools "HTTP/1.1 502 Bad Gateway"
2025-02-10 06:09:15.452 | ERROR | chatchat.webui_pages.utils:to_json:233 - JSONDecodeError: API未能返回正确的JSON。Expecting value: line 1 column 1 (char 0)
2025-02-10 06:09:15,542 httpx 14766 INFO HTTP Request: GET http://192.168.1.144:7861/tools "HTTP/1.1 502 Bad Gateway"
2025-02-10 06:09:15.546 | ERROR | chatchat.webui_pages.utils:to_json:233 - JSONDecodeError: API未能返回正确的JSON。Expecting value: line 1 column 1 (char 0)
2025-02-10 06:09:19,552 httpx 14766 INFO HTTP Request: GET http://192.168.1.144:7861/knowledge_base/list_knowledge_bases "HTTP/1.1 502 Bad Gateway"
2025-02-10 06:09:19.552 | ERROR | chatchat.webui_pages.utils:to_json:233 - JSONDecodeError: API未能返回正确的JSON。Expecting value: line 1 column 1 (char 0)
2025-02-10 06:09:19.554 Uncaught app exception
Traceback (most recent call last):
File "/root/Langchain-Chatchat/myenv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/root/Langchain-Chatchat/myenv/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/root/Langchain-Chatchat/myenv/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-02-10 06:09:21,131 httpx 14766 INFO HTTP Request: GET http://192.168.1.144:7861/knowledge_base/list_knowledge_bases "HTTP/1.1 502 Bad Gateway"
2025-02-10 06:09:21.132 | ERROR | chatchat.webui_pages.utils:to_json:233 - JSONDecodeError: API未能返回正确的JSON。Expecting value: line 1 column 1 (char 0)
2025-02-10 06:09:21.132 Uncaught app exception
Traceback (most recent call last):
File "/root/Langchain-Chatchat/myenv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/root/Langchain-Chatchat/myenv/lib/python3.10/site-packages/chatchat/webui.py", line 71, in
kb_chat(api=api)
File "/root/Langchain-Chatchat/myenv/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`

model_settings.yaml配置如下

DEFAULT_LLM_MODEL: qwen2
DEFAULT_EMBEDDING_MODEL: nomic-embed-text
Agent_MODEL: ''
HISTORY_LEN: 3
MAX_TOKENS:
TEMPERATURE: 0.7
SUPPORT_AGENT_MODELS:

  • chatglm3-6b
  • glm-4
  • openai-api
  • Qwen-2
  • qwen2-instruct
  • gpt-3.5-turbo
  • gpt-4o
    LLM_MODEL_CONFIG:
    preprocess_model:
    model: ''
    temperature: 0.05
    max_tokens: 4096
    history_len: 10
    prompt_name: default
    callbacks: false
    llm_model:
    model: ''
    temperature: 0.9
    max_tokens: 4096
    history_len: 10
    prompt_name: default
    callbacks: true
    action_model:
    model: ''
    temperature: 0.01
    max_tokens: 4096
    history_len: 10
    prompt_name: ChatGLM3
    callbacks: true
    postprocess_model:
    model: ''
    temperature: 0.01
    max_tokens: 4096
    history_len: 10
    prompt_name: default
    callbacks: true
    image_model:
    model: sd-turbo
    size: 256*256
    platform_type: ollama
    MODEL_PLATFORMS:
  • platform_name: xinference
    platform_type: xinference
    api_base_url: http://127.0.0.1:9997/v1
    api_key: EMPTY
    api_proxy: ''
    api_concurrencies: 5
    auto_detect_model: false
    llm_models: []
    embed_models: []
    text2image_models: []
    image2text_models: []
    rerank_models: []
    speech2text_models: []
    text2speech_models: []
  • platform_name: ollama
    platform_type: ollama
    api_base_url: http://127.0.0.1:11434/v1
    api_key: EMPTY
    api_proxy: ''
    api_concurrencies: 5
    auto_detect_model: false
    llm_models:
    • qwen2
      embed_models:
    • nomic-embed-text
      text2image_models: []
      image2text_models: []
      rerank_models: []
      speech2text_models: []
      text2speech_models: []
  • platform_name: oneapi
    platform_type: oneapi
    api_base_url: http://127.0.0.1:3000/v1
    api_key: sk-
    api_proxy: ''
    api_concurrencies: 5
    auto_detect_model: false
    llm_models:
    • chatglm_pro
    • chatglm_turbo
    • chatglm_std
    • chatglm_lite
    • qwen-turbo
    • qwen-plus
    • qwen-max
    • qwen-max-longcontext
    • ERNIE-Bot
    • ERNIE-Bot-turbo
    • ERNIE-Bot-4
    • SparkDesk
      embed_models:
    • text-embedding-v1
    • Embedding-V1
      text2image_models: []
      image2text_models: []
      rerank_models: []
      speech2text_models: []
      text2speech_models: []
  • platform_name: openai
    platform_type: openai
    api_base_url: https://api.openai.com/v1
    api_key: sk-proj-
    api_proxy: ''
    api_concurrencies: 5
    auto_detect_model: false
    llm_models:
    • gpt-4o
    • gpt-3.5-turbo
      embed_models:
    • text-embedding-3-small
    • text-embedding-3-large
      text2image_models: []
      image2text_models: []
      rerank_models: []
      speech2text_models: []
      text2speech_models: []

basic_settings.yaml配置如下

version: 0.3.1.3
log_verbose: true
HTTPX_DEFAULT_TIMEOUT: 300.0
KB_ROOT_PATH: /root/Langchain-Chatchat/data/knowledge_base
SQLALCHEMY_DATABASE_URI。
DB_ROOT_PATH: /root/Langchain-Chatchat/data/knowledge_base/info.db
SQLALCHEMY_DATABASE_URI: sqlite:////root/Langchain-Chatchat/data/knowledge_base/info.db
OPEN_CROSS_DOMAIN: false
DEFAULT_BIND_HOST: 192.168.1.144
API_SERVER:
host: 192.168.1.144
port: 7861
public_host: 192.168.1.144
public_port: 7861
WEBUI_SERVER:
host: 192.168.1.144
port: 8501

@AlienBB12138 AlienBB12138 added the bug Something isn't working label Feb 10, 2025
Copy link

dosubot bot commented Feb 10, 2025

@AlienBB12138 你好!我是Dosu,我是一个可以帮助您解决 bug、回答问题并成为贡献者的机器人。我会在等待人类维护者的期间帮助您。

I found a similar issue related to the 'NoneType' object is not iterable error in the list_knowledge_bases() function. The suggested solution is to upgrade the httpx package to version 0.27.2, which you have already done [1].

Additionally, ensure that the list_knowledge_bases() function is correctly handling the API response. The function should default to returning an empty list if the response is None or cannot be parsed as JSON. You can modify the code to handle a None return value by defaulting to an empty list:

kb_list = [x["kb_name"] for x in (api.list_knowledge_bases() or [])]

This change ensures that kb_list is always an iterable object, resolving the TypeError. Also, verify that the API endpoint /knowledge_base/list_knowledge_bases is correctly configured and accessible, as the error logs indicate a "502 Bad Gateway" response, which suggests a server-side issue.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@AlienBB12138
Copy link
Author

/knowledge_base/list_knowledge_bases

@AlienBB12138 你好!我是Dosu,我是一个可以帮助您解决 bug、回答问题并成为贡献者的机器人。我会在等待人类维护者的期间帮助您。

I found a similar issue related to the 'NoneType' object is not iterable error in the list_knowledge_bases() function. The suggested solution is to upgrade the httpx package to version 0.27.2, which you have already done [1].

Additionally, ensure that the list_knowledge_bases() function is correctly handling the API response. The function should default to returning an empty list if the response is None or cannot be parsed as JSON. You can modify the code to handle a None return value by defaulting to an empty list:

kb_list = [x["kb_name"] for x in (api.list_knowledge_bases() or [])]
This change ensures that kb_list is always an iterable object, resolving the TypeError. Also, verify that the API endpoint /knowledge_base/list_knowledge_bases is correctly configured and accessible, as the error logs indicate a "502 Bad Gateway" response, which suggests a server-side issue.

To continue talking to Dosu, mention @dosu.

Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

/knowledge_base/list_knowledge_bases是可以通过浏览器访问到的返回内容为
{"code":200,"msg":"success","data":[{"id":1,"kb_name":"samples","kb_info":"关于本项目issue的解答","vs_type":"faiss","embed_model":"nomic-embed-text","file_count":12,"create_time":"2025-02-10T05:49:38"}]}

@sunshinecf
Copy link

我的也是这样:{
"code": 200,
"msg": "success",
"data": [
{
"id": 1,
"kb_name": "samples",
"kb_info": "关于本项目issue的解答",
"vs_type": "milvus",
"embed_model": "quentinz/bge-large-zh-v1.5:latest",
"file_count": 12,
"create_time": "2025-02-10T09:47:31"
}
]
}

@yangshan-home
Copy link

你们查看数据库中的file_doc表会发现里面的数据是空的。我排查了一下,应该是api没有全部启动,再调用/knowledge_base/upload_docs相关API是断开的,如下:

Image
我也不知道怎么解决,来个大佬解决下吧。

@sunshinecf
Copy link

Image 救命啊,如何解决啊

@AlienBB12138
Copy link
Author

我的也是这样:{ "code": 200, "msg": "success", "data": [ { "id": 1, "kb_name": "samples", "kb_info": "关于本项目issue的解答", "vs_type": "milvus", "embed_model": "quentinz/bge-large-zh-v1.5:latest", "file_count": 12, "create_time": "2025-02-10T09:47:31" } ] }

我解决了,是虚拟机挂了代理,把代理删了就好了

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants