diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 5ac1e97..e8b0a86 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -1,6 +1,6 @@ import { useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' -import { Table, Switch, Button, Typography, App, Modal, Input, Tabs, Space, Tooltip, Alert } from 'antd' +import { Table, Switch, Button, Typography, App, Modal, Input, Select, Tabs, Space, Tooltip, Alert } from 'antd' import { ReloadOutlined, PlusOutlined, DeleteOutlined, EditOutlined, QuestionCircleOutlined } from '@ant-design/icons' import { getConfig, setConfig, updateConfig, deleteConfig, toggleFlag, getChangeLog } from '@/services/config-api' import dayjs from 'dayjs' @@ -8,6 +8,12 @@ import dayjs from 'dayjs' const { Title, Text, Paragraph } = Typography // Config documentation +const PRESET_CONFIGS = [ + { key: 'ai.temperature', value: '0.7', desc: 'AI 回复随机性 (0=确定, 1=最随机)' }, + { key: 'ai.max_tokens', value: '4096', desc: 'AI 单次回复最大长度 (1 token ≈ 0.7 中文)' }, + { key: 'hermes.api_url', value: 'http://10.2.0.7:8642', desc: 'Hermes Agent 服务地址' }, +] + const CONFIG_DOCS: Record = { 'ai.temperature': { desc: 'AI 回复的随机性/创造力', example: '0.7', note: '0=确定, 1=最随机, 推荐 0.5~0.7' }, 'ai.max_tokens': { desc: 'AI 单次回复最大长度', example: '4096', note: '1 token ≈ 0.7 个中文字, 4096≈2800字' }, @@ -133,7 +139,27 @@ function ConfigPage() { setAddOpen(false)} okText="保存"> - setNewKey(e.target.value)} disabled={!!editKey} style={{ marginBottom: 12 }} /> + {editKey ? ( + + ) : ( +