Skip to content

支持通过 Action 参数配置 reasoning effort 和 thinking 模式 #38

Description

@Svtter

背景

OpenCode 的 opencode.json 配置文件支持为 agent 配置 reasoningEffortthinking 参数,例如:

{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "build": {
      "mode": "primary",
      "model": "deepseek/deepseek-v4-flash",
      "options": {
        "reasoningEffort": "max",
        "thinking": {
          "type": "enabled"
        }
      }
    }
  }
}

但对于 CI 场景(github-run-opencodereviewfeature-missing),用户只能通过 modelprompt 等 action input 控制基本参数,没有办法配置模型的思考强度。

期望用法

- name: Run OpenCode review (high reasoning effort)
  uses: Svtter/opencode-actions/review@v2
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    zhipu-api-key: ${{ secrets.ZHIPU_API_KEY }}
    model: deepseek/deepseek-v4-flash
    reasoning-effort: max        # 新增:控制思考强度
    enable-thinking: true        # 新增:启用 thinking 模式

实现思路

  1. github-run-opencode/action.ymlreview/action.ymlfeature-missing/action.yml 中新增 inputs:

    • reasoning-effort:可选值 lowmediumhighmax,默认空(不设置)
    • enable-thinking:布尔值,默认 false,设为 true 时在 opencode.json 中启用 thinking
  2. run-github-opencode.sh 中,根据这两个参数动态生成或修改 opencode.json

    • 如果 runner 上已有 opencode.json,合并新配置而非覆盖
    • 如果不存在,生成一个只包含必要配置的 opencode.json
  3. run-opencode 也应支持类似参数,以便用户在自定义场景下也能配置思考强度

影响范围

  • github-run-opencode/action.yml + run-github-opencode.sh
  • review/action.yml
  • feature-missing/action.yml
  • run-opencode/action.yml + run-opencode.sh
  • README.md 文档更新
  • examples/ 示例更新

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions