From e97daaa0ebeae3360159caf5a46a9c97f94fa44d Mon Sep 17 00:00:00 2001 From: kurihada Date: Sun, 14 Dec 2025 21:37:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(settings):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E6=95=88=E7=9A=84=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 maxTokens/temperature 滑块(后端从不使用) - 移除 allowedPaths/deniedPaths 显示(权限通过 handler 处理) - Settings 面板只保留 workdir 和 Summary Model 配置 --- packages/server/src/routes/config.ts | 12 +- packages/ui/src/api/types.ts | 5 - packages/ui/src/components/ConfigPanel.tsx | 130 --------------------- 3 files changed, 1 insertion(+), 146 deletions(-) diff --git a/packages/server/src/routes/config.ts b/packages/server/src/routes/config.ts index cae9324..b7a7c32 100644 --- a/packages/server/src/routes/config.ts +++ b/packages/server/src/routes/config.ts @@ -13,23 +13,13 @@ import { export const configRouter = new Hono(); -// 服务器配置 (后续会从配置文件加载) +// 服务器配置 interface ServerConfig { - model: string; - maxTokens: number; - temperature: number; workdir: string; - allowedPaths: string[]; - deniedPaths: string[]; } let serverConfig: ServerConfig = { - model: 'claude-sonnet-4-20250514', - maxTokens: 8192, - temperature: 0.7, workdir: process.cwd(), - allowedPaths: [], - deniedPaths: [], }; /** diff --git a/packages/ui/src/api/types.ts b/packages/ui/src/api/types.ts index 2a57788..d163e13 100644 --- a/packages/ui/src/api/types.ts +++ b/packages/ui/src/api/types.ts @@ -83,12 +83,7 @@ export interface FileTreeResponse { } export interface ServerConfig { - model: string; - maxTokens: number; - temperature: number; workdir: string; - allowedPaths: string[]; - deniedPaths: string[]; } // ============ Command 相关 ============ diff --git a/packages/ui/src/components/ConfigPanel.tsx b/packages/ui/src/components/ConfigPanel.tsx index c8135e5..93f6e68 100644 --- a/packages/ui/src/components/ConfigPanel.tsx +++ b/packages/ui/src/components/ConfigPanel.tsx @@ -13,7 +13,6 @@ import { modalOverlay, modalContent, smoothTransition } from '../utils/animation import { Button } from '../primitives/Button'; import { Input } from '../primitives/Input'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../primitives/Select'; -import { Slider } from '../primitives/Slider'; import { Skeleton } from './Skeleton'; import { getConfig, @@ -30,14 +29,6 @@ interface ConfigPanelProps { responsive?: boolean; } -// 可用的模型列表 -const AVAILABLE_MODELS = [ - { id: 'claude-sonnet-4-20250514', name: 'Claude Sonnet 4' }, - { id: 'claude-3-5-sonnet-20241022', name: 'Claude 3.5 Sonnet' }, - { id: 'claude-3-opus-20240229', name: 'Claude 3 Opus' }, - { id: 'claude-3-haiku-20240307', name: 'Claude 3 Haiku' }, -]; - // 摘要模型提供商列表 const SUMMARY_PROVIDERS = [ { id: 'openai', name: 'OpenAI' }, @@ -46,13 +37,6 @@ const SUMMARY_PROVIDERS = [ { id: 'openai-compatible', name: 'OpenAI Compatible' }, ]; -// Temperature 语义标签 -function getTemperatureLabel(value: number): string { - if (value <= 0.3) return 'Precise'; - if (value <= 0.7) return 'Balanced'; - return 'Creative'; -} - export function ConfigPanel({ onClose, responsive = false }: ConfigPanelProps) { const [config, setConfig] = useState(null); const [summaryConfig, setSummaryConfig] = useState(null); @@ -62,9 +46,6 @@ export function ConfigPanel({ onClose, responsive = false }: ConfigPanelProps) { // 表单状态 const [formData, setFormData] = useState({ - model: '', - maxTokens: 8192, - temperature: 0.7, workdir: '', }); @@ -88,9 +69,6 @@ export function ConfigPanel({ onClose, responsive = false }: ConfigPanelProps) { setConfig(configResponse.data); setFormData({ - model: configResponse.data.model, - maxTokens: configResponse.data.maxTokens, - temperature: configResponse.data.temperature, workdir: configResponse.data.workdir, }); @@ -158,9 +136,6 @@ export function ConfigPanel({ onClose, responsive = false }: ConfigPanelProps) { const handleReset = () => { if (config) { setFormData({ - model: config.model, - maxTokens: config.maxTokens, - temperature: config.temperature, workdir: config.workdir, }); toast.info('Settings reset'); @@ -242,81 +217,6 @@ export function ConfigPanel({ onClose, responsive = false }: ConfigPanelProps) { transition={{ delay: 0.1 }} className={cn('space-y-6', responsive ? 'p-4 md:p-6' : 'p-6')} > - {/* Model */} -
- - -

- Select the AI model to use for conversations -

-
- - {/* Max Tokens */} -
-
- - - {formData.maxTokens.toLocaleString()} - -
- setFormData({ ...formData, maxTokens: value[0] })} - /> -
- 1K - 8K - 16K - 32K -
-

- Maximum number of tokens in the response -

-
- - {/* Temperature */} -
-
- -
- {getTemperatureLabel(formData.temperature)} - - {formData.temperature.toFixed(2)} - -
-
- setFormData({ ...formData, temperature: value[0] })} - /> -
- Precise - Balanced - Creative -
-

Controls randomness in responses

-
- {/* Working Directory */}
@@ -418,36 +318,6 @@ export function ConfigPanel({ onClose, responsive = false }: ConfigPanelProps) {
- {/* Server Info */} - {config && ( - -

Server Information

-
-
- Allowed Paths: - - {config.allowedPaths.length || 'All'} - -
-
- Denied Paths: - - {config.deniedPaths.length || 'None'} - -
-
-
- )} )}