Effort selector dropdown hidden for GLM models — blocks access to GLM-5.2 High/Max effort tiers

未關閉 適合新手
#640 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
68/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript
領域
frontend

研究方向

先閱讀 src/components/chat/MessageInput.tsx 中的 effort-selector 閘門,以及 src/lib/provider-catalog.ts 中的模型能力項目;接著找出 env-provider 模型的定義位置。在選擇要公開哪些模型和層級之前,檢查下拉式選單如何處理 supportedEffortLevels。完成條件是 GLM 使用者可以選擇受支援的 effort 層級,且現有的 effort 值會繼續隨聊天請求傳遞。

由索引模型根據 Issue 內容生成。

描述

Summary

When using a GLM model (e.g. GLM-5.2 via Z.ai's Anthropic-compatible endpoint at https://api.z.ai/api/anthropic), the effort selector dropdown does not render in the chat composer. This prevents users from selecting GLM-5.2's High and Max reasoning effort tiers, even though the downstream plumbing already carries the effort field end-to-end and Z.ai's endpoint accepts it.

Environment

  • CodePilot: v0.56.0 (source HEAD b4e96a1)
  • OS: Windows 11
  • Provider: env (Claude Code SDK runtime)
  • Endpoint: https://api.z.ai/api/anthropic
  • Model: glm-5.2[1m]

Root cause

The dropdown visibility is gated by a model capability flag that GLM does not have.

src/components/chat/MessageInput.tsx:991-992:
```tsx
const currentModelMeta = currentModelOption as (typeof currentModelOption & { supportsEffort?: boolean; supportedEffortLevels?: string[] }) | undefined;
const showEffortSelector = currentModelMeta?.supportsEffort === true;
```

supportsEffort: true is set on Claude variants in src/lib/provider-catalog.ts (Sonnet / Opus / Haiku roles, plus Fable 5 at lines 240, 250, 260, 290, 301, 314, 325, 344, 355, 370, 385, 396, 428, 437) but not on GLM models configured via the env provider. When a user selects GLM, currentModelMeta.supportsEffort is undefined, so showEffortSelector is false and the dropdown never renders. There is no way inside the UI to set selectedEffort to anything other than the 'auto' default.

The downstream plumbing already works

Once selectedEffort is anything other than 'auto', the value flows through cleanly:

src/app/chat/page.tsx:890:
```tsx
...(selectedEffort && selectedEffort !== 'auto' ? { effort: selectedEffort } : {}),
```

src/lib/claude-model-options.ts:102-144 (sanitizeClaudeModelOptions) passes effort through unchanged for any model that isn't Opus 4.7/4.8/Fable 5. GLM matches neither the OPUS_ADAPTIVE_THINKING_PATTERN nor the FABLE_PATTERN, so effort: 'max' would reach Z.ai's endpoint as-is.

The EffortSelectorDropdown itself also already falls back to the full 5-level set when supportedEffortLevels is undefined:

src/components/chat/EffortSelectorDropdown.tsx:36:
```tsx
const baseLevels = supportedEffortLevels || ['low', 'medium', 'high', 'xhigh', 'max'];
```

So the only thing missing is the capability flag on GLM model entries.

GLM-5.2 does support effort tiers

Per Z.ai's "How to Switch Models" doc:

"In a Claude Code session, type the /effort command to switch thinking intensity. After switching, Claude Code maps the selected effort to GLM-5.2's actual effort levels..."

GLM-5.2 exposes at least High and Max effort tiers. Users running the Claude Code CLI directly against Z.ai can reach them via /effort max. CodePilot users cannot, because the UI gate is closed. (CodePilot also does not forward /effort as a slash command to the underlying SDK, so there's no escape hatch.)

Suggested fixes

In order of preference:

  1. Mark env-provider models with supportsEffort: true by default so the dropdown renders for any Anthropic-compatible endpoint (GLM, DeepSeek, Kimi, etc.). Downstream code handles unknown effort values gracefully, and the endpoint will either accept the level or ignore it.

  2. Add explicit GLM entries to ENV_CLAUDE_CODE_MODELS with supportedEffortLevels: ['high', 'max'] matching what Z.ai's endpoint actually documents, so the dropdown surfaces only the levels GLM-5.2 truly supports.

Workaround

None inside CodePilot today. Switching to Opus surfaces the dropdown (Opus has supportsEffort: true), but that's not a real fix for users who chose GLM for cost or quota reasons.

主要語言
TypeScript
星號
6.5k
分支
697
PR 合併指標
30 天內沒有已合併 PR

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

op7418/CodePilot 的其他 Issue

查看 op7418/CodePilot 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。