- {
- navigate('/console/personal');
- }}
- className='!px-3 !py-1.5 !text-sm !text-semi-color-text-0 hover:!bg-semi-color-fill-1 dark:!text-gray-200 dark:hover:!bg-blue-500 dark:hover:!text-white'
- >
-
-
- {t('个人设置')}
-
-
- {
- navigate('/console/token');
- }}
- className='!px-3 !py-1.5 !text-sm !text-semi-color-text-0 hover:!bg-semi-color-fill-1 dark:!text-gray-200 dark:hover:!bg-blue-500 dark:hover:!text-white'
- >
-
-
- {t('令牌管理')}
-
-
- {
- navigate('/console/topup');
- }}
- className='!px-3 !py-1.5 !text-sm !text-semi-color-text-0 hover:!bg-semi-color-fill-1 dark:!text-gray-200 dark:hover:!bg-blue-500 dark:hover:!text-white'
- >
-
-
- {t('钱包管理')}
-
-
-
-
-
- {t('退出')}
-
-
-
- }
- >
-
-
+
+ {userState.user.username[0].toUpperCase()}
+
+
+
+ {userState.user.username}
+
+
+
+
+
+
);
} else {
const showRegisterButton = !isSelfUseMode;
diff --git a/web/src/components/settings/personal/cards/NotificationSettings.jsx b/web/src/components/settings/personal/cards/NotificationSettings.jsx
index 0b097eaf..aad612d2 100644
--- a/web/src/components/settings/personal/cards/NotificationSettings.jsx
+++ b/web/src/components/settings/personal/cards/NotificationSettings.jsx
@@ -44,6 +44,7 @@ import CodeViewer from '../../../playground/CodeViewer';
import { StatusContext } from '../../../../context/Status';
import { UserContext } from '../../../../context/User';
import { useUserPermissions } from '../../../../hooks/common/useUserPermissions';
+import { useSidebar } from '../../../../hooks/common/useSidebar';
const NotificationSettings = ({
t,
@@ -97,6 +98,9 @@ const NotificationSettings = ({
isSidebarModuleAllowed,
} = useUserPermissions();
+ // 使用useSidebar钩子获取刷新方法
+ const { refreshUserConfig } = useSidebar();
+
// 左侧边栏设置处理函数
const handleSectionChange = (sectionKey) => {
return (checked) => {
@@ -132,6 +136,9 @@ const NotificationSettings = ({
});
if (res.data.success) {
showSuccess(t('侧边栏设置保存成功'));
+
+ // 刷新useSidebar钩子中的用户配置,实现实时更新
+ await refreshUserConfig();
} else {
showError(res.data.message);
}
@@ -334,7 +341,7 @@ const NotificationSettings = ({
loading={sidebarLoading}
className='!rounded-lg'
>
- {t('保存边栏设置')}
+ {t('保存设置')}
>
) : (
diff --git a/web/src/components/table/channels/modals/EditChannelModal.jsx b/web/src/components/table/channels/modals/EditChannelModal.jsx
index 07d4f392..aa2382dc 100644
--- a/web/src/components/table/channels/modals/EditChannelModal.jsx
+++ b/web/src/components/table/channels/modals/EditChannelModal.jsx
@@ -87,6 +87,26 @@ const REGION_EXAMPLE = {
'claude-3-5-sonnet-20240620': 'europe-west1',
};
+// 支持并且已适配通过接口获取模型列表的渠道类型
+const MODEL_FETCHABLE_TYPES = new Set([
+ 1,
+ 4,
+ 14,
+ 34,
+ 17,
+ 26,
+ 24,
+ 47,
+ 25,
+ 20,
+ 23,
+ 31,
+ 35,
+ 40,
+ 42,
+ 48,
+]);
+
function type2secretPrompt(type) {
// inputs.type === 15 ? '按照如下格式输入:APIKey|SecretKey' : (inputs.type === 18 ? '按照如下格式输入:APPID|APISecret|APIKey' : '请输入渠道对应的鉴权密钥')
switch (type) {
@@ -260,7 +280,7 @@ const EditChannelModal = (props) => {
pass_through_body_enabled: false,
system_prompt: '',
});
- const showApiConfigCard = inputs.type !== 45; // 控制是否显示 API 配置卡片(仅当渠道类型不是 豆包 时显示)
+ const showApiConfigCard = true; // 控制是否显示 API 配置卡片
const getInitValues = () => ({ ...originInputs });
// 处理渠道额外设置的更新
@@ -367,6 +387,10 @@ const EditChannelModal = (props) => {
case 36:
localModels = ['suno_music', 'suno_lyrics'];
break;
+ case 45:
+ localModels = getChannelModels(value);
+ setInputs((prevInputs) => ({ ...prevInputs, base_url: 'https://ark.cn-beijing.volces.com' }));
+ break;
default:
localModels = getChannelModels(value);
break;
@@ -869,6 +893,10 @@ const EditChannelModal = (props) => {
showInfo(t('请至少选择一个模型!'));
return;
}
+ if (localInputs.type === 45 && (!localInputs.base_url || localInputs.base_url.trim() === '')) {
+ showInfo(t('请输入API地址!'));
+ return;
+ }
if (
localInputs.model_mapping &&
localInputs.model_mapping !== '' &&
@@ -1876,6 +1904,30 @@ const EditChannelModal = (props) => {
/>
)}
+
+ {inputs.type === 45 && (
+
+
+ handleInputChange('base_url', value)
+ }
+ optionList={[
+ {
+ value: 'https://ark.cn-beijing.volces.com',
+ label: 'https://ark.cn-beijing.volces.com'
+ },
+ {
+ value: 'https://ark.ap-southeast.bytepluses.com',
+ label: 'https://ark.ap-southeast.bytepluses.com'
+ }
+ ]}
+ defaultValue='https://ark.cn-beijing.volces.com'
+ />
+
+ )}
)}
@@ -1961,13 +2013,15 @@ const EditChannelModal = (props) => {
>
{t('填入所有模型')}
-
+ {MODEL_FETCHABLE_TYPES.has(inputs.type) && (
+
+ )}
)}
+ handleDeleteKey(record.index)}
+ okType={'danger'}
+ position={'topRight'}
+ >
+
+
),
},
diff --git a/web/src/components/table/mj-logs/MjLogsFilters.jsx b/web/src/components/table/mj-logs/MjLogsFilters.jsx
index 44c6bcfc..6db96e79 100644
--- a/web/src/components/table/mj-logs/MjLogsFilters.jsx
+++ b/web/src/components/table/mj-logs/MjLogsFilters.jsx
@@ -21,6 +21,8 @@ import React from 'react';
import { Button, Form } from '@douyinfe/semi-ui';
import { IconSearch } from '@douyinfe/semi-icons';
+import { DATE_RANGE_PRESETS } from '../../../constants/console.constants';
+
const MjLogsFilters = ({
formInitValues,
setFormApi,
@@ -54,6 +56,11 @@ const MjLogsFilters = ({
showClear
pure
size='small'
+ presets={DATE_RANGE_PRESETS.map(preset => ({
+ text: t(preset.text),
+ start: preset.start(),
+ end: preset.end()
+ }))}
/>
diff --git a/web/src/components/table/task-logs/TaskLogsColumnDefs.jsx b/web/src/components/table/task-logs/TaskLogsColumnDefs.jsx
index 766c1715..b63c7dd4 100644
--- a/web/src/components/table/task-logs/TaskLogsColumnDefs.jsx
+++ b/web/src/components/table/task-logs/TaskLogsColumnDefs.jsx
@@ -35,8 +35,9 @@ import {
Sparkles,
} from 'lucide-react';
import {
- TASK_ACTION_GENERATE,
- TASK_ACTION_TEXT_GENERATE,
+ TASK_ACTION_FIRST_TAIL_GENERATE,
+ TASK_ACTION_GENERATE, TASK_ACTION_REFERENCE_GENERATE,
+ TASK_ACTION_TEXT_GENERATE
} from '../../../constants/common.constant';
import { CHANNEL_OPTIONS } from '../../../constants/channel.constants';
@@ -111,6 +112,18 @@ const renderType = (type, t) => {
{t('文生视频')}
);
+ case TASK_ACTION_FIRST_TAIL_GENERATE:
+ return (
+ }>
+ {t('首尾生视频')}
+
+ );
+ case TASK_ACTION_REFERENCE_GENERATE:
+ return (
+ }>
+ {t('参照生视频')}
+
+ );
default:
return (
}>
@@ -343,7 +356,9 @@ export const getTaskLogsColumns = ({
// 仅当为视频生成任务且成功,且 fail_reason 是 URL 时显示可点击链接
const isVideoTask =
record.action === TASK_ACTION_GENERATE ||
- record.action === TASK_ACTION_TEXT_GENERATE;
+ record.action === TASK_ACTION_TEXT_GENERATE ||
+ record.action === TASK_ACTION_FIRST_TAIL_GENERATE ||
+ record.action === TASK_ACTION_REFERENCE_GENERATE;
const isSuccess = record.status === 'SUCCESS';
const isUrl = typeof text === 'string' && /^https?:\/\//.test(text);
if (isSuccess && isVideoTask && isUrl) {
diff --git a/web/src/components/table/task-logs/TaskLogsFilters.jsx b/web/src/components/table/task-logs/TaskLogsFilters.jsx
index d5e081ab..e27cea86 100644
--- a/web/src/components/table/task-logs/TaskLogsFilters.jsx
+++ b/web/src/components/table/task-logs/TaskLogsFilters.jsx
@@ -21,6 +21,8 @@ import React from 'react';
import { Button, Form } from '@douyinfe/semi-ui';
import { IconSearch } from '@douyinfe/semi-icons';
+import { DATE_RANGE_PRESETS } from '../../../constants/console.constants';
+
const TaskLogsFilters = ({
formInitValues,
setFormApi,
@@ -54,6 +56,11 @@ const TaskLogsFilters = ({
showClear
pure
size='small'
+ presets={DATE_RANGE_PRESETS.map(preset => ({
+ text: t(preset.text),
+ start: preset.start(),
+ end: preset.end()
+ }))}
/>
diff --git a/web/src/components/table/usage-logs/UsageLogsFilters.jsx b/web/src/components/table/usage-logs/UsageLogsFilters.jsx
index f76ec823..58e5a469 100644
--- a/web/src/components/table/usage-logs/UsageLogsFilters.jsx
+++ b/web/src/components/table/usage-logs/UsageLogsFilters.jsx
@@ -21,6 +21,8 @@ import React from 'react';
import { Button, Form } from '@douyinfe/semi-ui';
import { IconSearch } from '@douyinfe/semi-icons';
+import { DATE_RANGE_PRESETS } from '../../../constants/console.constants';
+
const LogsFilters = ({
formInitValues,
setFormApi,
@@ -55,6 +57,11 @@ const LogsFilters = ({
showClear
pure
size='small'
+ presets={DATE_RANGE_PRESETS.map(preset => ({
+ text: t(preset.text),
+ start: preset.start(),
+ end: preset.end()
+ }))}
/>
diff --git a/web/src/constants/common.constant.js b/web/src/constants/common.constant.js
index 277bb9a5..57fbbbde 100644
--- a/web/src/constants/common.constant.js
+++ b/web/src/constants/common.constant.js
@@ -40,3 +40,5 @@ export const API_ENDPOINTS = [
export const TASK_ACTION_GENERATE = 'generate';
export const TASK_ACTION_TEXT_GENERATE = 'textGenerate';
+export const TASK_ACTION_FIRST_TAIL_GENERATE = 'firstTailGenerate';
+export const TASK_ACTION_REFERENCE_GENERATE = 'referenceGenerate';
diff --git a/web/src/constants/console.constants.js b/web/src/constants/console.constants.js
new file mode 100644
index 00000000..23ee1e17
--- /dev/null
+++ b/web/src/constants/console.constants.js
@@ -0,0 +1,49 @@
+/*
+Copyright (C) 2025 QuantumNous
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
+
+For commercial licensing, please contact support@quantumnous.com
+*/
+
+import dayjs from 'dayjs';
+
+// ========== 日期预设常量 ==========
+export const DATE_RANGE_PRESETS = [
+ {
+ text: '今天',
+ start: () => dayjs().startOf('day').toDate(),
+ end: () => dayjs().endOf('day').toDate()
+ },
+ {
+ text: '近 7 天',
+ start: () => dayjs().subtract(6, 'day').startOf('day').toDate(),
+ end: () => dayjs().endOf('day').toDate()
+ },
+ {
+ text: '本周',
+ start: () => dayjs().startOf('week').toDate(),
+ end: () => dayjs().endOf('week').toDate()
+ },
+ {
+ text: '近 30 天',
+ start: () => dayjs().subtract(29, 'day').startOf('day').toDate(),
+ end: () => dayjs().endOf('day').toDate()
+ },
+ {
+ text: '本月',
+ start: () => dayjs().startOf('month').toDate(),
+ end: () => dayjs().endOf('month').toDate()
+ },
+];
diff --git a/web/src/helpers/api.js b/web/src/helpers/api.js
index b7092fe7..bc389b2e 100644
--- a/web/src/helpers/api.js
+++ b/web/src/helpers/api.js
@@ -118,7 +118,6 @@ export const buildApiPayload = (
model: inputs.model,
group: inputs.group,
messages: processedMessages,
- group: inputs.group,
stream: inputs.stream,
};
@@ -132,13 +131,15 @@ export const buildApiPayload = (
seed: 'seed',
};
+
Object.entries(parameterMappings).forEach(([key, param]) => {
- if (
- parameterEnabled[key] &&
- inputs[param] !== undefined &&
- inputs[param] !== null
- ) {
- payload[param] = inputs[param];
+ const enabled = parameterEnabled[key];
+ const value = inputs[param];
+ const hasValue = value !== undefined && value !== null;
+
+
+ if (enabled && hasValue) {
+ payload[param] = value;
}
});
diff --git a/web/src/helpers/utils.jsx b/web/src/helpers/utils.jsx
index e446ea69..bcd13230 100644
--- a/web/src/helpers/utils.jsx
+++ b/web/src/helpers/utils.jsx
@@ -75,13 +75,17 @@ export async function copy(text) {
await navigator.clipboard.writeText(text);
} catch (e) {
try {
- // 构建input 执行 复制命令
- var _input = window.document.createElement('input');
- _input.value = text;
- window.document.body.appendChild(_input);
- _input.select();
- window.document.execCommand('Copy');
- window.document.body.removeChild(_input);
+ // 构建 textarea 执行复制命令,保留多行文本格式
+ const textarea = window.document.createElement('textarea');
+ textarea.value = text;
+ textarea.setAttribute('readonly', '');
+ textarea.style.position = 'fixed';
+ textarea.style.left = '-9999px';
+ textarea.style.top = '-9999px';
+ window.document.body.appendChild(textarea);
+ textarea.select();
+ window.document.execCommand('copy');
+ window.document.body.removeChild(textarea);
} catch (e) {
okay = false;
console.error(e);
diff --git a/web/src/hooks/common/useSidebar.js b/web/src/hooks/common/useSidebar.js
index 5dce44f9..13d76fd8 100644
--- a/web/src/hooks/common/useSidebar.js
+++ b/web/src/hooks/common/useSidebar.js
@@ -21,6 +21,10 @@ import { useState, useEffect, useMemo, useContext } from 'react';
import { StatusContext } from '../../context/Status';
import { API } from '../../helpers';
+// 创建一个全局事件系统来同步所有useSidebar实例
+const sidebarEventTarget = new EventTarget();
+const SIDEBAR_REFRESH_EVENT = 'sidebar-refresh';
+
export const useSidebar = () => {
const [statusState] = useContext(StatusContext);
const [userConfig, setUserConfig] = useState(null);
@@ -124,9 +128,12 @@ export const useSidebar = () => {
// 刷新用户配置的方法(供外部调用)
const refreshUserConfig = async () => {
- if (Object.keys(adminConfig).length > 0) {
+ if (Object.keys(adminConfig).length > 0) {
await loadUserConfig();
}
+
+ // 触发全局刷新事件,通知所有useSidebar实例更新
+ sidebarEventTarget.dispatchEvent(new CustomEvent(SIDEBAR_REFRESH_EVENT));
};
// 加载用户配置
@@ -137,6 +144,21 @@ export const useSidebar = () => {
}
}, [adminConfig]);
+ // 监听全局刷新事件
+ useEffect(() => {
+ const handleRefresh = () => {
+ if (Object.keys(adminConfig).length > 0) {
+ loadUserConfig();
+ }
+ };
+
+ sidebarEventTarget.addEventListener(SIDEBAR_REFRESH_EVENT, handleRefresh);
+
+ return () => {
+ sidebarEventTarget.removeEventListener(SIDEBAR_REFRESH_EVENT, handleRefresh);
+ };
+ }, [adminConfig]);
+
// 计算最终的显示配置
const finalConfig = useMemo(() => {
const result = {};
diff --git a/web/src/hooks/dashboard/useDashboardStats.jsx b/web/src/hooks/dashboard/useDashboardStats.jsx
index aa9677a5..dbf3b67e 100644
--- a/web/src/hooks/dashboard/useDashboardStats.jsx
+++ b/web/src/hooks/dashboard/useDashboardStats.jsx
@@ -102,7 +102,7 @@ export const useDashboardStats = (
},
{
title: t('统计Tokens'),
- value: isNaN(consumeTokens) ? 0 : consumeTokens,
+ value: isNaN(consumeTokens) ? 0 : consumeTokens.toLocaleString(),
icon: ,
avatarColor: 'pink',
trendData: trendData.tokens,
diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json
index bceb5f08..ceb0f2d3 100644
--- a/web/src/i18n/locales/en.json
+++ b/web/src/i18n/locales/en.json
@@ -1889,6 +1889,10 @@
"确定要删除所有已自动禁用的密钥吗?": "Are you sure you want to delete all automatically disabled keys?",
"此操作不可撤销,将永久删除已自动禁用的密钥": "This operation cannot be undone, and all automatically disabled keys will be permanently deleted.",
"删除自动禁用密钥": "Delete auto disabled keys",
+ "确定要删除此密钥吗?": "Are you sure you want to delete this key?",
+ "此操作不可撤销,将永久删除该密钥": "This operation cannot be undone, and the key will be permanently deleted.",
+ "密钥已删除": "Key has been deleted",
+ "删除密钥失败": "Failed to delete key",
"图标": "Icon",
"模型图标": "Model icon",
"请输入图标名称": "Please enter the icon name",
@@ -2095,6 +2099,11 @@
"优惠": "Discount",
"折": "% off",
"节省": "Save",
+ "今天": "Today",
+ "近 7 天": "Last 7 Days",
+ "本周": "This Week",
+ "本月": "This Month",
+ "近 30 天": "Last 30 Days",
"代理设置": "Proxy Settings",
"更新Worker设置": "Update Worker Settings",
"SSRF防护设置": "SSRF Protection Settings",
diff --git a/web/vite.config.js b/web/vite.config.js
index 3515dce7..d57fd9d9 100644
--- a/web/vite.config.js
+++ b/web/vite.config.js
@@ -20,10 +20,16 @@ For commercial licensing, please contact support@quantumnous.com
import react from '@vitejs/plugin-react';
import { defineConfig, transformWithEsbuild } from 'vite';
import pkg from '@douyinfe/vite-plugin-semi';
+import path from 'path';
const { vitePluginSemi } = pkg;
// https://vitejs.dev/config/
export default defineConfig({
+ resolve: {
+ alias: {
+ '@': path.resolve(__dirname, './src'),
+ },
+ },
plugins: [
{
name: 'treat-js-files-as-jsx',