diff --git a/openless-all/app/src/pages/settings/CodingAgentSection.tsx b/openless-all/app/src/pages/settings/CodingAgentSection.tsx index 0414a04e..90d8c474 100644 --- a/openless-all/app/src/pages/settings/CodingAgentSection.tsx +++ b/openless-all/app/src/pages/settings/CodingAgentSection.tsx @@ -8,6 +8,7 @@ import { detectOS } from '../../components/WindowChrome' import { codingAgentDetectOpencode, type OpenCodeDetection } from '../../lib/ipc' import type { CodingAgentPermissionMode, CodingAgentProviderId } from '../../lib/types' import { useHotkeySettings } from '../../state/HotkeySettingsContext' +import { SelectLite } from '../../components/ui/SelectLite' import { Card } from '../_atoms' import { SectionDesc, SectionTitle, SettingRow, Toggle, inputStyle } from './shared' @@ -69,19 +70,16 @@ export function CodingAgentSection() { <> {/* 「按住说话键」配置已挪到 通用 → 快捷键,避免和这里重复。本区只留后端/模型等高级项。 */} - + onChange={v => void savePrefs({ ...prefs, codingAgentProvider: v as CodingAgentProviderId })} + options={[ + { value: 'claude-code-cli', label: 'Claude Code' }, + { value: 'opencode-cli', label: 'OpenCode' }, + ]} + ariaLabel={t('settings.codingAgent.provider')} + style={{ ...inputStyle, maxWidth: 240 }} + /> {/* OpenCode 后端:提示安装/登录状态。issue #579。 */} @@ -101,38 +99,32 @@ export function CodingAgentSection() { )} - + onChange={v => void savePrefs({ ...prefs, codingAgentPermissionMode: v as CodingAgentPermissionMode })} + options={PERMISSION_MODES.map(m => ({ + value: m, + label: t(`settings.codingConsole.mode.${m}`), + }))} + ariaLabel={t('settings.codingConsole.permissionMode')} + style={{ ...inputStyle, maxWidth: 240 }} + /> - + onChange={v => void savePrefs({ ...prefs, codingAgentModel: v === '' ? null : v })} + options={[ + // 空值 = 使用 CLI 默认模型;放回选项里,避免选了具体模型后回不去默认。 + { value: '', label: t('settings.codingAgent.modelDefault') }, + { value: 'haiku', label: 'Haiku' }, + { value: 'sonnet', label: 'Sonnet' }, + { value: 'opus', label: 'Opus' }, + ]} + ariaLabel={t('settings.codingAgent.model')} + style={{ ...inputStyle, maxWidth: 240 }} + />