Skip to content

解决使用模型glm4-9b-chat报错“An error occurred during streaming” #5270

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yechaoying
Copy link

@yechaoying yechaoying commented Mar 20, 2025

Langchain-Chatchat/libs/chatchat-server/chatchat/server/api_server/chat_routes.py 中,max_tokens 的定义为:

# 当调用本接口且请求体中没有传入 "max_tokens" 参数时,默认使用配置中定义的值
if body.max_tokens in [None, 0]:
    body.max_tokens = Settings.model_settings.MAX_TOKENS
然而Settings 中对 MAX_TOKENS 的解释为MAX_TOKENS: t.Optional[int] = None  # 大模型支持的最大长度,如果未设置,则使用模型的默认最大长度;如果设置了,则为用户指定的最大长度
这意味着如果 max_tokens 未在请求体中提供系统将使用配置中的 MAX_TOKENS 作为默认值此处不应设None

在 `Langchain-Chatchat/libs/chatchat-server/chatchat/server/api_server/chat_routes.py` 中,`max_tokens` 的定义为:

```python
# 当调用本接口且请求体中没有传入 "max_tokens" 参数时,默认使用配置中定义的值
if body.max_tokens in [None, 0]:
    body.max_tokens = Settings.model_settings.MAX_TOKENS
然而,Settings 中对 MAX_TOKENS 的解释为:

python
复制
MAX_TOKENS: t.Optional[int] = None  # 大模型支持的最大长度,如果未设置,则使用模型的默认最大长度;如果设置了,则为用户指定的最大长度
这意味着,如果 max_tokens 未在请求体中提供,系统将使用配置中的 MAX_TOKENS 作为默认值,此处不应设None
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant