💬 refactor: separate chat settings into dedicated tab

- Create new ChatsSetting component for managing chat configurations
- Add "Chat Settings" tab with MessageSquare icon in settings page
- Remove chat settings section from OperationSetting component
- Update import path to use Chat directory structure
This commit is contained in:
Apple\Apple
2025-06-21 02:36:09 +08:00
parent edaff1c689
commit 8ec18dd21b
7 changed files with 87 additions and 51 deletions

View File

@@ -2,10 +2,7 @@ import React, { useEffect, useState, useRef } from 'react';
import {
Banner,
Button,
Col,
Form,
Popconfirm,
Row,
Space,
Spin,
} from '@douyinfe/semi-ui';
@@ -16,7 +13,6 @@ import {
showSuccess,
showWarning,
verifyJSON,
verifyJSONPromise,
} from '../../../helpers';
import { useTranslation } from 'react-i18next';
@@ -80,21 +76,6 @@ export default function SettingsChats(props) {
}
}
async function resetModelRatio() {
try {
let res = await API.post(`/api/option/rest_model_ratio`);
// return {success, message}
if (res.data.success) {
showSuccess(res.data.message);
props.refresh();
} else {
showError(res.data.message);
}
} catch (error) {
showError(error);
}
}
useEffect(() => {
const currentInputs = {};
for (let key in props.options) {
@@ -119,13 +100,7 @@ export default function SettingsChats(props) {
getFormApi={(formAPI) => (refForm.current = formAPI)}
style={{ marginBottom: 15 }}
>
<Form.Section text={t('令牌聊天设置')}>
<Banner
type='warning'
description={t(
'必须将上方聊天链接全部设置为空,才能使用下方聊天设置功能',
)}
/>
<Form.Section text={t('聊天设置')}>
<Banner
type='info'
description={t(

View File

@@ -6,7 +6,6 @@ import {
Form,
Row,
Spin,
Collapse,
Modal,
} from '@douyinfe/semi-ui';
import {
@@ -92,10 +91,6 @@ export default function GeneralSettings(props) {
return (
<>
<Spin spinning={loading}>
<Banner
type='warning'
description={t('聊天链接功能已经弃用,请使用下方聊天设置功能')}
/>
<Form
values={inputs}
getFormApi={(formAPI) => (refForm.current = formAPI)}

View File

@@ -9,7 +9,8 @@ import {
Shapes,
Cog,
MoreHorizontal,
LayoutDashboard
LayoutDashboard,
MessageSquare
} from 'lucide-react';
import SystemSetting from '../../components/settings/SystemSetting.js';
@@ -20,6 +21,7 @@ import RateLimitSetting from '../../components/settings/RateLimitSetting.js';
import ModelSetting from '../../components/settings/ModelSetting.js';
import DashboardSetting from '../../components/settings/DashboardSetting.js';
import RatioSetting from '../../components/settings/RatioSetting.js';
import ChatsSetting from '../../components/settings/ChatsSetting.js';
const Setting = () => {
const { t } = useTranslation();
@@ -39,6 +41,16 @@ const Setting = () => {
content: <OperationSetting />,
itemKey: 'operation',
});
panes.push({
tab: (
<span style={{ display: 'flex', alignItems: 'center', gap: '5px' }}>
<MessageSquare size={18} />
{t('聊天设置')}
</span>
),
content: <ChatsSetting />,
itemKey: 'chats',
});
panes.push({
tab: (
<span style={{ display: 'flex', alignItems: 'center', gap: '5px' }}>