merge: 同步 origin/ui-optimization(d224d5b6),保留 weiyuan 功能与 Semi 迁移
- 冲突以 weiyuan 功能(小程序登录、i18n 文案)为准,并保留远端 lint 重构与依赖收敛 - 删除 weiyuan 已移除、远端仅做 lint 修正的 3 个图片相关文件 - 适配远端零警告 ESLint:Monitoring/Subscription 改用 useEffectEvent,EditChannelModal 注明 t 依赖 - effect-events 单测补充 react-i18next mock - 对合并后仍不符合 Prettier 的文件做纯格式化
This commit is contained in:
@@ -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 { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Banner, Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import {
|
||||
@@ -87,7 +88,7 @@ export default function GroupRatioSettings(props) {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -97,7 +98,8 @@ export default function GroupRatioSettings(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -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 { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -121,7 +122,7 @@ export default function ModelRatioSettings(props) {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -131,7 +132,8 @@ export default function ModelRatioSettings(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -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 { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Table,
|
||||
@@ -74,12 +75,13 @@ export default function ModelRatioNotSetEditor(props) {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
// 获取所有启用的模型
|
||||
getAllEnabledModels();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange2 = useEffectEvent(() => {
|
||||
try {
|
||||
const modelPrice = JSON.parse(props.options.ModelPrice || '{}');
|
||||
const modelRatio = JSON.parse(props.options.ModelRatio || '{}');
|
||||
@@ -108,7 +110,11 @@ export default function ModelRatioNotSetEditor(props) {
|
||||
} catch (error) {
|
||||
console.error(t('JSON解析错误:'), error);
|
||||
}
|
||||
}, [props.options, enabledModels]);
|
||||
});
|
||||
useEffect(
|
||||
() => onOptionsChange2(),
|
||||
[onOptionsChange2, props.options, enabledModels],
|
||||
);
|
||||
|
||||
// 首先声明分页相关的工具函数
|
||||
const getPagedData = (data, currentPage, pageSize) => {
|
||||
|
||||
@@ -89,6 +89,7 @@ function ConflictConfirmModal({ t, visible, items, onOk, onCancel }) {
|
||||
}
|
||||
|
||||
export default function UpstreamRatioSync(props) {
|
||||
const { refresh } = props;
|
||||
const { t } = useTranslation();
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -383,7 +384,7 @@ export default function UpstreamRatioSync(props) {
|
||||
|
||||
if (results.every((res) => res.data.success)) {
|
||||
showSuccess(t('同步成功'));
|
||||
props.refresh();
|
||||
refresh();
|
||||
|
||||
setDifferences((prevDifferences) => {
|
||||
const newDifferences = { ...prevDifferences };
|
||||
@@ -413,7 +414,7 @@ export default function UpstreamRatioSync(props) {
|
||||
setLoading(false);
|
||||
}
|
||||
},
|
||||
[resolutions, props.options, props.refresh],
|
||||
[resolutions, refresh, t],
|
||||
);
|
||||
|
||||
const getCurrentPageData = (dataSource) => {
|
||||
|
||||
Reference in New Issue
Block a user