chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM, Qwen 与 Llama 等)基于 Langchain 与 ChatGLM 等语言模型的 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
29.69k stars 5.2k forks source link

星火API接入错误 #4013

Closed zhangcheng0111 closed 2 weeks ago

zhangcheng0111 commented 1 month ago

问题描述 / Problem Description 用简洁明了的语言描述这个问题 / Describe the problem in a clear and concise manner. 使用docker拉取镜像,进入后配置星火API后重启,使用星火api显示错误 原因是server/model_workers/xinghuo.py的domain写错了,应该是generalv3.5而不是3

复现问题的步骤 / Steps to Reproduce

  1. 执行 '...' / Run '...'
  2. 点击 '...' / Click '...'
  3. 滚动到 '...' / Scroll to '...'
  4. 问题出现 / Problem occurs

预期的结果 / Expected Result 描述应该出现的结果 / Describe the expected result.

实际结果 / Actual Result 描述实际发生的结果 / Describe the actual result.

环境信息 / Environment Information

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

zhangcheng0111 commented 1 month ago

此问题在源代码中也存在,并且在镜像中无法使用vi\vim\nano通过apt updates后apt install vim才可以使用,但是编辑python代码时候,还是会乱码,应该是需要配置下vim的编码才可以

dosubot[bot] commented 1 month ago

To address the encoding issues when editing Python files with Vim in the Docker environment, ensure Vim is configured to use UTF-8 encoding. Add these lines to your .vimrc:

set encoding=utf-8
set fileencoding=utf-8

This setup will help avoid syntax or encoding errors when working with Python files that include non-ASCII characters.

For the issue with the Xinghuo API integration in server/model_workers/xinghuo.py, specifically the incorrect domain version, you should update the version_mapping dictionary within the XingHuoWorker class. If the correct domain for version "v3.5" is "generalv3.5", modify it like so:

"v3.5": {"domain": "generalv3.5", "url": "ws://spark-api.xf-yun.com/v3.5/chat", "max_tokens": 16000},

This ensures the class uses the correct domain for API requests.

Regarding the Docker environment and the absence of text editors like vi, vim, or nano, it's common for Docker images, especially those optimized for production, to exclude such tools to minimize the image size and reduce potential security vulnerabilities. If you need to edit files within the Docker container, installing a text editor is necessary, but remember to configure it properly for handling Python files to avoid encoding issues.

#### Details **Sources** - [server/model_workers/xinghuo.py](https://github.com/chatchat-space/Langchain-Chatchat/blob/master/server/model_workers/xinghuo.py) - [Dockerfile](https://github.com/chatchat-space/Langchain-Chatchat/blob/master/Dockerfile) - [README_en.md](https://github.com/chatchat-space/Langchain-Chatchat/blob/master/README_en.md)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

github-actions[bot] commented 3 weeks ago

这个问题已经被标记为 stale ,因为它已经超过 30 天没有任何活动。