diff --git a/web/src/App.js b/web/src/App.js index 05fd597f..9e9407c0 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -30,6 +30,7 @@ import { useTranslation } from 'react-i18next'; import { StatusContext } from './context/Status'; import { setStatusData } from './helpers/data.js'; import { API, showError } from './helpers'; +import PersonalSetting from './components/PersonalSetting.js'; const Home = lazy(() => import('./pages/Home')); const Detail = lazy(() => import('./pages/Detail')); @@ -177,6 +178,16 @@ function App() { } /> + + }> + + + + } + /> { -
+
{ pricing: '/pricing', task: '/task', playground: '/playground', + personal: '/personal', }; - const headerButtons = useMemo( + const workspaceItems = useMemo( () => [ - { - text: 'Playground', - itemKey: 'playground', - to: '/playground', - icon: , - }, - { - text: t('渠道'), - itemKey: 'channel', - to: '/channel', - icon: , - className: isAdmin() ? '' : 'tableHiddle', - }, - { - text: t('聊天'), - itemKey: 'chat', - items: chatItems, - icon: , - }, - { - text: t('令牌'), - itemKey: 'token', - to: '/token', - icon: , - }, { text: t('数据看板'), itemKey: 'detail', @@ -105,33 +81,19 @@ const SiderBar = () => { : 'tableHiddle', }, { - text: t('兑换码'), - itemKey: 'redemption', - to: '/redemption', - icon: , - className: isAdmin() ? '' : 'tableHiddle', + text: t('API令牌'), + itemKey: 'token', + to: '/token', + icon: , }, { - text: t('钱包'), - itemKey: 'topup', - to: '/topup', - icon: , - }, - { - text: t('用户管理'), - itemKey: 'user', - to: '/user', - icon: , - className: isAdmin() ? '' : 'tableHiddle', - }, - { - text: t('日志'), + text: t('使用日志'), itemKey: 'log', to: '/log', icon: , }, { - text: t('绘图'), + text: t('绘图日志'), itemKey: 'midjourney', to: '/midjourney', icon: , @@ -141,75 +103,148 @@ const SiderBar = () => { : 'tableHiddle', }, { - text: t('异步任务'), + text: t('任务日志'), itemKey: 'task', to: '/task', icon: , className: - localStorage.getItem('enable_task') === 'true' - ? '' - : 'tableHiddle', - }, - { - text: t('设置'), - itemKey: 'setting', - to: '/setting', - icon: , - }, + localStorage.getItem('enable_task') === 'true' + ? '' + : 'tableHiddle', + } ], [ localStorage.getItem('enable_data_export'), localStorage.getItem('enable_drawing'), localStorage.getItem('enable_task'), - localStorage.getItem('chat_link'), - chatItems, - isAdmin(), t, ], ); + const financeItems = useMemo( + () => [ + { + text: t('钱包'), + itemKey: 'topup', + to: '/topup', + icon: , + }, + { + text: t('个人设置'), + itemKey: 'personal', + to: '/personal', + icon: , + }, + ], + [t], + ); + + const adminItems = useMemo( + () => [ + { + text: t('渠道'), + itemKey: 'channel', + to: '/channel', + icon: , + className: isAdmin() ? '' : 'tableHiddle', + }, + { + text: t('兑换码'), + itemKey: 'redemption', + to: '/redemption', + icon: , + className: isAdmin() ? '' : 'tableHiddle', + }, + { + text: t('用户管理'), + itemKey: 'user', + to: '/user', + icon: , + }, + { + text: t('系统设置'), + itemKey: 'setting', + to: '/setting', + icon: , + }, + ], + [isAdmin(), t], + ); + + const chatMenuItems = useMemo( + () => [ + { + text: 'Playground', + itemKey: 'playground', + to: '/playground', + icon: , + }, + { + text: t('聊天'), + itemKey: 'chat', + items: chatItems, + icon: , + }, + ], + [chatItems, t], + ); + useEffect(() => { let localKey = window.location.pathname.split('/')[1]; if (localKey === '') { localKey = 'home'; } setSelectedKeys([localKey]); - + let chatLink = localStorage.getItem('chat_link'); if (!chatLink) { - let chats = localStorage.getItem('chats'); - if (chats) { - // console.log(chats); - try { - chats = JSON.parse(chats); - if (Array.isArray(chats)) { - let chatItems = []; - for (let i = 0; i < chats.length; i++) { - let chat = {}; - for (let key in chats[i]) { - chat.text = key; - chat.itemKey = 'chat' + i; - chat.to = '/chat/' + i; - } - // setRouterMap({ ...routerMap, chat: '/chat/' + i }) - chatItems.push(chat); - } - setChatItems(chatItems); - } - } catch (e) { - console.error(e); - showError('聊天数据解析失败') + let chats = localStorage.getItem('chats'); + if (chats) { + // console.log(chats); + try { + chats = JSON.parse(chats); + if (Array.isArray(chats)) { + let chatItems = []; + for (let i = 0; i < chats.length; i++) { + let chat = {}; + for (let key in chats[i]) { + chat.text = key; + chat.itemKey = 'chat' + i; + chat.to = '/chat/' + i; + } + // setRouterMap({ ...routerMap, chat: '/chat/' + i }) + chatItems.push(chat); } + setChatItems(chatItems); + } + } catch (e) { + console.error(e); + showError('聊天数据解析失败') } + } } - + setIsCollapsed(localStorage.getItem('default_collapse_sidebar') === 'true'); }, []); + // Custom divider style + const dividerStyle = { + margin: '8px 0', + opacity: 0.6, + }; + + // Custom group label style + const groupLabelStyle = { + padding: '8px 16px', + color: 'var(--semi-color-text-2)', + fontSize: '12px', + fontWeight: 'normal', + }; + return ( <> ); diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 3c7d368c..89b2bcbb 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -621,6 +621,7 @@ "窗口等待": "window wait", "失败": "Failed", "绘图": "Drawing", + "绘图日志": "Drawing log", "放大": "Upscalers", "微妙放大": "Upscale (Subtle)", "创造放大": "Upscale (Creative)", @@ -1120,7 +1121,7 @@ "知识库 ID": "Knowledge Base ID", "请输入知识库 ID,例如:123456": "Please enter knowledge base ID, e.g.: 123456", "可选值": "Optional value", - "异步任务": "Async task", + "任务日志": "Task log", "你好": "Hello", "你好,请问有什么可以帮助您的吗?": "Hello, how may I help you?", "用户分组": "Your default group", @@ -1335,5 +1336,7 @@ "Claude思考适配 BudgetTokens = MaxTokens * BudgetTokens 百分比": "Claude thinking adaptation BudgetTokens = MaxTokens * BudgetTokens percentage", "思考适配 BudgetTokens 百分比": "Thinking adaptation BudgetTokens percentage", "0.1-1之间的小数": "Decimal between 0.1 and 1", - "模型相关设置": "Model related settings" + "模型相关设置": "Model related settings", + "收起侧边栏": "Collapse sidebar", + "展开侧边栏": "Expand sidebar" } diff --git a/web/src/pages/Setting/Model/SettingClaudeModel.js b/web/src/pages/Setting/Model/SettingClaudeModel.js index 76ee8cfa..1cddd839 100644 --- a/web/src/pages/Setting/Model/SettingClaudeModel.js +++ b/web/src/pages/Setting/Model/SettingClaudeModel.js @@ -18,6 +18,8 @@ const CLAUDE_HEADER = { const CLAUDE_DEFAULT_MAX_TOKENS = { 'default': 8192, + "claude-3-haiku-20240307": 4096, + "claude-3-opus-20240229": 4096, 'claude-3-7-sonnet-20250219-thinking': 8192, } diff --git a/web/src/pages/Setting/index.js b/web/src/pages/Setting/index.js index 17a85088..de03acf4 100644 --- a/web/src/pages/Setting/index.js +++ b/web/src/pages/Setting/index.js @@ -18,9 +18,6 @@ const Setting = () => { const [tabActiveKey, setTabActiveKey] = useState('1'); let panes = [ { - tab: t('个人设置'), - content: , - itemKey: 'personal', }, ]; @@ -61,7 +58,7 @@ const Setting = () => { if (tab) { setTabActiveKey(tab); } else { - onChangeTab('personal'); + onChangeTab('operation'); } }, [location.search]); return (