freestylefly / freestylefly/wesight

[Bug] Team/非默认 Agent 运行时,Kimi Code 模型选择器显示“未知模型”且无法切换模型

Open Beginner friendly
#61 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
TypeScript
Stars
923
Forks
206
Avg merge
24m
Merged PRs (30d)
2

Description

### Bug Description
当运行目标(Run Target)选择为 **Team** 或 **非默认 Agent** 时,Kimi Code(以及其他外部 CLI 引擎)的模型选择器会显示 **“未知模型”**,并且用户无法切换模型。

这不是 Kimi CLI 配置没有被读取的问题——`~/.kimi-code/config.toml` 里的模型已经正确同步到了 `external_agent_providers` 表中。根本原因是前端在只读状态下没有回显当前真实模型名。

### Steps to Reproduce
1. 在 Kimi CLI 里配置多个 provider/model(例如 `~/.kimi-code/config.toml` 里有 `deepseek`、`minimax`、`agnes-ai` 等)。
2. 打开 WeSight,确认 Cowork 设置里 Agent Engine 选的是 **Kimi Code**,Config Source 是 **Local CLI**。
3. 在左上角运行目标里选择 **Team**(或任意非默认 Agent)。
4. 观察输入框右侧的模型选择器,显示 **“未知模型”**。
5. 点击模型选择器,无法切换 Kimi 模型。

### Expected Behavior
即使运行目标锁定为 Team/非默认 Agent,模型选择器也应显示当前实际使用的 Kimi 模型名称(例如 `K2.7 Code` 或 `DeepSeek V4 Flash`),而不是“未知模型”。

### Actual Behavior
模型选择器显示 **“未知模型”**(对应 i18n 键 `coworkAgentLocalModelUnknown`)。

### Environment
- OS: macOS (Apple Silicon)
- WeSight Version: 2026.6.28
- Kimi Code Version: 0.22.3

### Screenshots

Image

### Code References
- `src/renderer/components/cowork/CoworkView.tsx:196`:只有在 `currentTargetType === AgentRunTargetType.Agent && currentAgentId === DefaultAgent.Id` 时才允许选择运行时引擎/模型。
```ts
const canSelectRuntimeEngine =
currentTargetType === AgentRunTargetType.Agent
&& currentAgentId === DefaultAgent.Id;
```
- `src/renderer/components/cowork/CoworkPromptInput.tsx:859-864`:把 `readOnly={!canSelectRuntimeEngine}` 传给 `CoworkModelSelector`。
- `src/renderer/components/cowork/CoworkModelSelector.tsx:181-189`:`readOnly` 分支直接回退到 `coworkAgentLocalModelUnknown`,没有显示当前 provider/model。
```tsx
if (readOnly) {
return (


{labelOverride || i18nService.t('coworkAgentLocalModelUnknown')}

);
}
```

### Suggested Fix
在 `CoworkModelSelector` 的 `readOnly` 分支中,如果 `labelOverride` 未提供,则回显当前 provider 的模型名:

```tsx
if (readOnly) {
const label = labelOverride
|| getProviderModelButtonLabel(currentProvider)
|| i18nService.t('coworkAgentLocalModelUnknown');
return

{label}
;
}
```

或者在上层 `CoworkPromptInput` 传入 `labelOverride={lockedRuntimeSnapshot?.modelLabel || currentProvider?.summary.model}`。

### Related
- 可能与 OpenCode 配置读取问题相关:#60

### Checklist
- [x] I have searched for existing issues
- [x] I have provided all the requested information

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/renderer/components/cowork/CoworkModelSelector.tsx and inspect the readOnly branch, then trace how CoworkPromptInput.tsx passes the selector props and how CoworkView.tsx determines read-only state. Reproduce the Team or non-default Agent case with a configured Kimi provider. Done means the current provider/model name is shown instead of “unknown model” and model switching remains unavailable in the locked state.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, react, typescript
Domain
desktop, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.