Skip to content

feat: 支持在 config.json 中配置 ai_max_tokens #116

@xqliu

Description

@xqliu

背景

当前 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,
  ...
}

实现要点

  1. config.json.example 添加示例
  2. 在配置加载逻辑中读取该字段
  3. 优先级:config.json > 环境变量 > 默认值(2000)
  4. 更新 mcp/client.go 使用配置值

相关 Issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions