Commit 3dd7ac5
authored
解决使用模型glm4-9b-chat报错“An error occurred during streaming”
在 `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 作为默认值,此处不应设None1 parent 40994eb commit 3dd7ac5
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
322 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
| |||
0 commit comments