背景
当前 max_tokens 只能通过环境变量 AI_MAX_TOKENS 配置,默认值为 2000。
用户在使用 Gemini 时遇到问题(#103),返回空响应:
{
"finish_reason": "length",
"completion_tokens": 0,
"prompt_tokens": 11012
}
需要增大 max_tokens,但当前只能通过环境变量设置,不够方便。
当前状态
ai_temperature ✅ 已支持在 config.json 配置
ai_max_tokens ❌ 只能通过环境变量 AI_MAX_TOKENS 配置
需求
在 config.json 中添加 ai_max_tokens 配置项,与 ai_temperature 保持一致:
{
"ai_temperature": 0.1,
"ai_max_tokens": 4000,
...
}
实现要点
- 在
config.json.example 添加示例
- 在配置加载逻辑中读取该字段
- 优先级:config.json > 环境变量 > 默认值(2000)
- 更新
mcp/client.go 使用配置值
相关 Issue
背景
当前
max_tokens只能通过环境变量AI_MAX_TOKENS配置,默认值为 2000。用户在使用 Gemini 时遇到问题(#103),返回空响应:
{ "finish_reason": "length", "completion_tokens": 0, "prompt_tokens": 11012 }需要增大 max_tokens,但当前只能通过环境变量设置,不够方便。
当前状态
ai_temperature✅ 已支持在 config.json 配置ai_max_tokens❌ 只能通过环境变量AI_MAX_TOKENS配置需求
在 config.json 中添加
ai_max_tokens配置项,与ai_temperature保持一致:{ "ai_temperature": 0.1, "ai_max_tokens": 4000, ... }实现要点
config.json.example添加示例mcp/client.go使用配置值相关 Issue