From f5882c8ee6ec043e3a63ea96f587eb17c441f46f Mon Sep 17 00:00:00 2001 From: WangDL Date: Fri, 22 May 2026 22:44:19 +0800 Subject: [PATCH] feat: config page with tooltips, help tab, and parameter docs --- src/pages/Config.tsx | 82 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 14 deletions(-) diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 2e5f0ec..5ac1e97 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -1,11 +1,18 @@ import { useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' -import { Table, Switch, Button, Typography, App, Modal, Input, Tabs, Space } from 'antd' -import { ReloadOutlined, PlusOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons' +import { Table, Switch, Button, Typography, App, Modal, Input, 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' -const { Title, Text } = Typography +const { Title, Text, Paragraph } = Typography + +// Config documentation +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字' }, + 'hermes.api_url': { desc: 'Hermes Agent 服务地址', example: 'http://10.2.0.7:8642', note: '修改后 AI 对话会走新地址' }, +} function ConfigPage() { const { modal, message } = App.useApp() @@ -31,10 +38,18 @@ function ConfigPage() { }) const configColumns = [ - { title: 'Key', dataIndex: 'key', width: 180, ellipsis: true }, - { title: 'Value', dataIndex: 'value', width: 300, ellipsis: true, render: (v: string) => {v} }, - { title: '环境', dataIndex: 'environment', width: 80 }, - { title: '更新', dataIndex: 'updatedAt', width: 140, render: (d: string) => dayjs(d).format('MM-DD HH:mm') }, + { title: 'Key', dataIndex: 'key', width: 160, ellipsis: true, + render: (k: string) => CONFIG_DOCS[k] ? ( + {k} + ) : {k} + }, + { title: 'Value', dataIndex: 'value', width: 240, ellipsis: true, render: (v: string, r: any) => ( + + {v} + + )}, + { title: '说明', dataIndex: 'key', width: 160, render: (k: string) => CONFIG_DOCS[k]?.desc || '-' }, + { title: '更新', dataIndex: 'updatedAt', width: 130, render: (d: string) => dayjs(d).format('MM-DD HH:mm') }, { title: '操作', width: 100, render: (_: any, r: any) => (