feat: 合并代码后 系统设置 ui样式优化、bug修复、全局统一图标对齐等

This commit is contained in:
zhanjunhao
2026-11-10 17:27:36 +08:00
parent 23824dad32
commit 425077f94b
195 changed files with 3546 additions and 1984 deletions
@@ -17,6 +17,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { TestTube2 as ActionTestTube2 } from '@/components/common/icons/ActionIcons';
import {
RefreshCw as ActionRefreshCw,
Save as ActionSave,
} from '@/components/common/icons/ActionIcons';
import React, {
useCallback,
useEffect,
@@ -40,7 +45,7 @@ import {
Tag,
Typography,
} from '@/components/ui';
import { RefreshCw, Save, ShieldAlert, TestTube2 } from 'lucide-react';
import { ShieldAlert } from 'lucide-react';
import { API, showError, showSuccess } from '../../helpers';
import { useTranslation } from 'react-i18next';
import i18next from 'i18next';
@@ -394,7 +399,7 @@ export default function ContentGuardSetting() {
{statusTag(config, t)}
</Space>
<Button
icon={<RefreshCw size={16} />}
icon={<ActionRefreshCw size={16} />}
onClick={loadAll}
aria-label={t('刷新')}
/>
@@ -596,18 +601,18 @@ export default function ContentGuardSetting() {
htmlType='submit'
type='primary'
loading={saving}
icon={<Save size={16} />}
icon={<ActionSave size={16} />}
>
{t('保存配置')}
</Button>
<Button
icon={<TestTube2 size={16} />}
icon={<ActionTestTube2 size={16} />}
onClick={() => testPermission('moderate')}
>
moderate
</Button>
<Button
icon={<TestTube2 size={16} />}
icon={<ActionTestTube2 size={16} />}
onClick={() => testPermission('stream_moderate')}
>
stream_moderate
@@ -16,6 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import {
RefreshCw as ActionRefreshCw,
Plus as ActionPlus,
Upload as ActionUpload,
} from '@/components/common/icons/ActionIcons';
import React, { useState, useEffect, useCallback } from 'react';
import {
Card,
@@ -33,16 +38,7 @@ import {
Spin,
Upload,
} from '@/components/ui';
import {
Plus,
Pencil,
Trash2,
Power,
PowerOff,
RefreshCw,
Users,
Upload as UploadIcon,
} from 'lucide-react';
import { Users } from 'lucide-react';
import { API, showError, showSuccess } from '../../helpers';
import { useTranslation } from 'react-i18next';
@@ -313,20 +309,14 @@ const CustomerServiceSetting = () => {
render: (_, record) => (
<Space>
<Button
icon={
record.status === 1 ? <PowerOff size={14} /> : <Power size={14} />
}
size='small'
type={record.status === 1 ? 'danger' : 'primary'}
onClick={() => handleToggleStatus(record)}
type='link'
size='small'
danger={(record.status === 1 ? 'danger' : 'primary') === 'danger'}
>
{record.status === 1 ? t('下线') : t('上线')}
</Button>
<Button
icon={<Pencil size={14} />}
size='small'
onClick={() => openModal(record)}
>
<Button onClick={() => openModal(record)} type='link' size='small'>
{t('编辑')}
</Button>
<Popconfirm
@@ -334,7 +324,7 @@ const CustomerServiceSetting = () => {
content={t('确定要删除这个客服吗?')}
onConfirm={() => handleDelete(record.id)}
>
<Button icon={<Trash2 size={14} />} size='small' type='danger'>
<Button type='link' size='small' danger>
{t('删除')}
</Button>
</Popconfirm>
@@ -392,14 +382,14 @@ const CustomerServiceSetting = () => {
</Space>
<Space>
<Button
icon={<RefreshCw size={14} />}
icon={<ActionRefreshCw size={14} />}
onClick={fetchAgents}
loading={loading}
>
{t('刷新')}
</Button>
<Button
icon={<Plus size={14} />}
icon={<ActionPlus size={14} />}
type='primary'
onClick={() => openModal()}
>
@@ -457,7 +447,7 @@ const CustomerServiceSetting = () => {
customRequest={(fileInfo) => handleUpload(fileInfo, 'avatar')}
>
<Button
icon={<UploadIcon size={14} />}
icon={<ActionUpload size={14} />}
loading={uploadingAvatar}
>
{t('上传')}
@@ -497,7 +487,7 @@ const CustomerServiceSetting = () => {
}
>
<Button
icon={<UploadIcon size={14} />}
icon={<ActionUpload size={14} />}
loading={uploadingQrcode}
>
{t('上传')}
@@ -511,14 +511,14 @@ export default function DataSecuritySetting() {
title: t('操作'),
render: (_, rule) => (
<Space>
<Button size='small' onClick={() => openEditRule(rule)}>
<Button onClick={() => openEditRule(rule)} type='link' size='small'>
{t('编辑')}
</Button>
<Popconfirm
title={t('确认删除该规则?')}
onConfirm={() => deleteRule(rule)}
>
<Button size='small' type='danger'>
<Button type='link' size='small' danger>
{t('删除')}
</Button>
</Popconfirm>
@@ -649,7 +649,7 @@ export default function DataSecuritySetting() {
)}
onConfirm={() => reviewRequest(r.id, 'approve')}
>
<Button size='small' theme='solid'>
<Button type='link' size='small'>
{t('通过')}
</Button>
</Popconfirm>
@@ -657,7 +657,7 @@ export default function DataSecuritySetting() {
title={t('确认驳回?')}
onConfirm={() => reviewRequest(r.id, 'reject')}
>
<Button size='small' type='danger'>
<Button type='link' size='small' danger>
{t('驳回')}
</Button>
</Popconfirm>
@@ -881,7 +881,7 @@ export default function DataSecuritySetting() {
)}
onConfirm={() => deleteRule(rule)}
>
<Button size='small' type='danger'>
<Button type='link' size='small' danger>
{t('删除')}
</Button>
</Popconfirm>
@@ -1191,8 +1191,9 @@ export default function DataSecuritySetting() {
render: (_, row) => (
<Space>
<Button
size='small'
onClick={() => openEditOrgConfig(row)}
type='link'
size='small'
>
{t('编辑')}
</Button>
@@ -1200,7 +1201,7 @@ export default function DataSecuritySetting() {
title={t('确认删除该企业覆盖(回到继承全局)?')}
onConfirm={() => deleteOrgConfig(row.org_id)}
>
<Button size='small' type='danger'>
<Button type='link' size='small' danger>
{t('删除')}
</Button>
</Popconfirm>
+111 -116
View File
@@ -16,6 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Eraser as ActionEraser } from '@/components/common/icons/ActionIcons';
import {
Plus as ActionPlus,
RefreshCw as ActionRefreshCw,
ChevronDown as ActionChevronDown,
ChevronRight as ActionChevronRight,
} from '@/components/common/icons/ActionIcons';
import React, { useState, useEffect, useCallback, useMemo } from 'react';
import {
Card,
@@ -37,17 +44,7 @@ import {
Empty,
Switch,
} from '@/components/ui';
import {
Plus,
Pencil,
Trash2,
RefreshCw,
Copy,
Search,
Eraser,
ChevronDown,
ChevronRight,
} from 'lucide-react';
import { Search } from 'lucide-react';
import { API, showError, showSuccess } from '../../helpers';
import { useTranslation } from 'react-i18next';
import './LevelPolicySetting.css';
@@ -131,7 +128,7 @@ const GroupModelDiscountEditor = ({
/>
<Button
size='small'
icon={<Plus size={14} />}
icon={<ActionPlus size={14} />}
disabled={!allowAdd || pendingModels.length === 0 || pendingInvalid}
onClick={() => {
onAdd(pendingModels, pendingTrim);
@@ -149,102 +146,96 @@ const GroupModelDiscountEditor = ({
</Text>
)}
</Space>
{rows.length === 0 ? (
{rows.length === 0 &&
// 已废弃分组不显示「按分组折扣计费」——该分组已无流量,顶部已有废弃提示
allowAdd ? (
(allowAdd ? (
<div className='mt-2'>
<Text type='tertiary' size='small'>
{t('未配置模型折扣:该分组所有模型按分组折扣系数计费')}
</Text>
</div>
) : null
) : (
<Table
// 嵌在 358px 的弹窗体里,列宽合计 460~480px,必须给横向滚动
scroll={{ x: 'max-content' }}
size='small'
className='level-policy-table mt-2'
pagination={false}
dataSource={rows}
columns={[
{
title: t('模型'),
dataIndex: 'model',
render: (v, r) => (
<Space>
<span>{v}</span>
{r.maybeDisabled && (
<Tooltip
content={t(
'该模型不在启用模型列表中(可能已下线),折扣条目保留但不会有流量命中',
)}
>
<Tag color='orange' type='ghost'>
{t('未启用')}
</Tag>
</Tooltip>
)}
</Space>
),
},
{
title: t('折扣系数'),
dataIndex: 'raw',
width: 170,
render: (v, r) => {
const s = String(v ?? '').trim();
const num = Number(s);
const invalid = s !== '' && (!Number.isFinite(num) || num <= 0);
return (
<Input
size='small'
style={{ width: 130 }}
validateStatus={s === '' || invalid ? 'error' : 'default'}
value={String(v ?? '')}
onChange={(val) => onChange(r.model, val)}
/>
);
},
},
{
title: t('效果'),
width: 210,
render: (_, r) => (
<div>
{discountHint(r.raw) || (
<Text type='danger' size='small'>
{t('须填写,删除条目请点「移除」')}
</Text>
)}
<div>
<Text type='tertiary' size='small'>
{replaceHint}
</Text>
</div>
</div>
),
},
{
title: t('操作'),
width: 100,
render: (_, r) => (
<Popconfirm
title={t('确认移除该模型折扣?')}
onConfirm={() => onRemove(r.model)}
>
<Button
size='small'
type='danger'
icon={<Trash2 size={14} />}
) : null)}
<Table
// 嵌在 358px 的弹窗体里,列宽合计 460~480px,必须给横向滚动
scroll={{ x: 'max-content' }}
size='small'
className='level-policy-table mt-2'
pagination={false}
dataSource={rows}
columns={[
{
title: t('模型'),
dataIndex: 'model',
render: (v, r) => (
<Space>
<span>{v}</span>
{r.maybeDisabled && (
<Tooltip
content={t(
'该模型不在启用模型列表中(可能已下线),折扣条目保留但不会有流量命中',
)}
>
{t('移除')}
</Button>
</Popconfirm>
),
<Tag color='orange' type='ghost'>
{t('未启用')}
</Tag>
</Tooltip>
)}
</Space>
),
},
{
title: t('折扣系数'),
dataIndex: 'raw',
width: 170,
render: (v, r) => {
const s = String(v ?? '').trim();
const num = Number(s);
const invalid = s !== '' && (!Number.isFinite(num) || num <= 0);
return (
<Input
size='small'
style={{ width: 130 }}
validateStatus={s === '' || invalid ? 'error' : 'default'}
value={String(v ?? '')}
onChange={(val) => onChange(r.model, val)}
/>
);
},
]}
/>
)}
},
{
title: t('效果'),
width: 210,
render: (_, r) => (
<div>
{discountHint(r.raw) || (
<Text type='danger' size='small'>
{t('须填写,删除条目请点「移除」')}
</Text>
)}
<div>
<Text type='tertiary' size='small'>
{replaceHint}
</Text>
</div>
</div>
),
},
{
title: t('操作'),
width: 100,
render: (_, r) => (
<Popconfirm
title={t('确认移除该模型折扣?')}
onConfirm={() => onRemove(r.model)}
>
<Button type='link' size='small' danger>
{t('移除')}
</Button>
</Popconfirm>
),
},
]}
/>
</div>
);
};
@@ -988,17 +979,17 @@ const LevelPolicySetting = () => {
render: (_, r) => (
<Space>
<Button
size='small'
icon={<Pencil size={14} />}
onClick={() => openEditor(type, r.code)}
type='link'
size='small'
>
{t('编辑')}
</Button>
<Tooltip content={t('以该等级为模板新建')}>
<Button
size='small'
icon={<Copy size={14} />}
onClick={() => duplicateLevel(type, r.code)}
type='link'
size='small'
>
{t('复制')}
</Button>
@@ -1009,10 +1000,10 @@ const LevelPolicySetting = () => {
onConfirm={() => deleteLevel(type, r.code)}
>
<Button
size='small'
type='danger'
icon={<Trash2 size={14} />}
loading={deletingCode === `${type}/${r.code}`}
type='link'
size='small'
danger
>
{t('删除')}
</Button>
@@ -1106,7 +1097,7 @@ const LevelPolicySetting = () => {
headerExtraContent={
<Button
theme='solid'
icon={<Plus size={14} />}
icon={<ActionPlus size={14} />}
onClick={() => openEditor(type, null)}
>
{t('新增等级')}
@@ -1147,7 +1138,7 @@ const LevelPolicySetting = () => {
headerExtraContent={
<Space>
<Button
icon={<RefreshCw size={14} />}
icon={<ActionRefreshCw size={14} />}
onClick={fetchAll}
disabled={loading}
>
@@ -1355,7 +1346,11 @@ const LevelPolicySetting = () => {
title={t('清空全部逐模型覆盖?')}
onConfirm={clearOverrides}
>
<Button size='small' type='tertiary' icon={<Eraser size={14} />}>
<Button
size='small'
type='tertiary'
icon={<ActionEraser size={14} />}
>
{t('清空全部')}
</Button>
</Popconfirm>
@@ -1391,7 +1386,7 @@ const LevelPolicySetting = () => {
/>
<Button
theme='solid'
icon={<Plus size={14} />}
icon={<ActionPlus size={14} />}
disabled={overrideModels.length === 0}
onClick={addOverrides}
>
@@ -1465,10 +1460,10 @@ const LevelPolicySetting = () => {
width: 110,
render: (_, r) => (
<Button
size='small'
type='danger'
icon={<Trash2 size={14} />}
onClick={() => removeOverride(r.model)}
type='link'
size='small'
danger
>
{t('移除')}
</Button>
@@ -1632,9 +1627,9 @@ const LevelPolicySetting = () => {
type={r.modelDiscountCount > 0 ? 'primary' : 'tertiary'}
icon={
expanded ? (
<ChevronDown size={14} />
<ActionChevronDown size={14} />
) : (
<ChevronRight size={14} />
<ActionChevronRight size={14} />
)
}
onClick={() => toggleGroupExpanded(r.key)}
+3 -3
View File
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Check as ActionCheck } from '@/components/common/icons/ActionIcons';
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
import { writeClipboardText } from '../../helpers/clipboard';
import React, { useContext, useEffect, useState } from 'react';
@@ -47,7 +48,6 @@ import { UserContext } from '../../context/User';
import { Tag as AntTag } from 'antd';
import { Avatar, Tooltip, Card, Tabs } from '@/components/ui';
import { useTranslation } from 'react-i18next';
import { Check } from 'lucide-react';
// 导入内容区组件
import AccountBindingSection from './personal/sections/AccountBindingSection';
@@ -631,11 +631,11 @@ const PersonalSetting = () => {
>
<button
type='button'
className='ui-profile-id'
className='app-action-button ui-profile-id'
onClick={copyUserId}
>
ID:{userState?.user?.id}
{userIdCopied && <Check size={12} />}
{userIdCopied && <ActionCheck size={12} />}
</button>
</Tooltip>
<span aria-hidden='true'>·</span>
@@ -33,14 +33,7 @@ import {
Progress,
Empty,
} from '@/components/ui';
import {
IconPlus,
IconDelete,
IconEdit,
IconUpload,
IconPlayCircle,
IconEyeOpened,
} from '@/components/ui/icons';
import { IconPlus, IconUpload, IconPlayCircle } from '@/components/ui/icons';
import { API } from '../../helpers';
const TutorialVideoSetting = () => {
@@ -271,28 +264,23 @@ const TutorialVideoSetting = () => {
render: (_, record) => (
<div style={{ display: 'flex', gap: 8 }}>
<Button
icon={<IconEyeOpened />}
size='small'
theme='borderless'
onClick={() => handlePreview(record)}
/>
<Button
icon={<IconEdit />}
type='link'
size='small'
theme='borderless'
onClick={() => handleEdit(record)}
/>
>
{t('预览')}
</Button>
<Button onClick={() => handleEdit(record)} type='link' size='small'>
{t('编辑')}
</Button>
<Popconfirm
title={t('确定删除这个视频吗?')}
content={t('删除后将无法恢复')}
onConfirm={() => handleDelete(record.id)}
>
<Button
icon={<IconDelete />}
size='small'
theme='borderless'
type='danger'
/>
<Button type='link' size='small' danger>
{t('删除')}
</Button>
</Popconfirm>
</div>
),
@@ -17,10 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { Check as ActionCheck } from '@/components/common/icons/ActionIcons';
import React from 'react';
import { Segmented } from 'antd';
import { Button, Input } from '@/components/ui';
import { Check } from 'lucide-react';
import {
CARTOON_AVATAR_PRESETS,
USER_AVATAR_TYPES,
@@ -114,7 +114,12 @@ const AvatarSection = ({
);
handleAvatarSettingChange('avatarPreset', preset.id);
}}
className={`ui-avatar-option ${selected ? 'selected' : ''}`}
className={[
'app-action-button',
`ui-avatar-option ${selected ? 'selected' : ''}`,
]
.filter(Boolean)
.join(' ')}
>
<img
src={getCartoonAvatarDataUrl(preset.id, 96)}
@@ -122,7 +127,7 @@ const AvatarSection = ({
/>
<span>{t(preset.label)}</span>
{selected && (
<Check size={14} className='ui-avatar-check' />
<ActionCheck size={14} className='ui-avatar-check' />
)}
</button>
);
@@ -17,9 +17,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import {
Check as ActionCheck,
Copy as ActionCopy,
} from '@/components/common/icons/ActionIcons';
import React, { useRef, useEffect } from 'react';
import { Button, Form, Toast } from '@/components/ui';
import { Check, Copy } from 'lucide-react';
import { FormQuotaInput } from '../../../common/ui/QuotaInput';
import { copy } from '../../../../helpers';
import SectionHeader from '../components/SectionHeader';
@@ -127,14 +130,19 @@ const NotificationSection = ({
type='button'
aria-pressed={isSelected}
onClick={() => handleFormChange('warningType', option.value)}
className={`ui-notify-method ${isSelected ? 'selected' : ''}`}
className={[
'app-action-button',
`ui-notify-method ${isSelected ? 'selected' : ''}`,
]
.filter(Boolean)
.join(' ')}
>
<span className='ui-notify-method-text'>
<strong>{option.label}</strong>
<span>{option.desc}</span>
</span>
{isSelected && (
<Check size={16} className='ui-notify-method-check' />
<ActionCheck size={16} className='ui-notify-method-check' />
)}
</button>
);
@@ -212,11 +220,11 @@ const NotificationSection = ({
<span>{t('Webhook 请求结构说明')}</span>
<button
type='button'
className='ui-notify-copy'
className='app-action-button ui-notify-copy'
onClick={handleCopyExample}
>
{t('复制')}
<Copy size={14} />
<ActionCopy size={14} />
</button>
</div>
<pre className='ui-notify-code'>