Commit b648b3cf by tbphp

fix: 缩进修复还原

parent 9e2af598
...@@ -194,4 +194,4 @@ func ModelRequestRateLimit() func(c *gin.Context) { ...@@ -194,4 +194,4 @@ func ModelRequestRateLimit() func(c *gin.Context) {
memoryRateLimitHandler(duration, totalMaxCount, successMaxCount)(c) memoryRateLimitHandler(duration, totalMaxCount, successMaxCount)(c)
} }
} }
} }
\ No newline at end of file
...@@ -402,4 +402,4 @@ func handleConfigUpdate(key, value string) bool { ...@@ -402,4 +402,4 @@ func handleConfigUpdate(key, value string) bool {
config.UpdateConfigFromMap(cfg, configMap) config.UpdateConfigFromMap(cfg, configMap)
return true // 已处理 return true // 已处理
} }
\ No newline at end of file
...@@ -9,62 +9,62 @@ import RequestRateLimit from '../pages/Setting/RateLimit/SettingsRequestRateLimi ...@@ -9,62 +9,62 @@ import RequestRateLimit from '../pages/Setting/RateLimit/SettingsRequestRateLimi
const RateLimitSetting = () => { const RateLimitSetting = () => {
const { t } = useTranslation(); const { t } = useTranslation();
let [inputs, setInputs] = useState({ let [inputs, setInputs] = useState({
ModelRequestRateLimitEnabled: false, ModelRequestRateLimitEnabled: false,
ModelRequestRateLimitCount: 0, ModelRequestRateLimitCount: 0,
ModelRequestRateLimitSuccessCount: 1000, ModelRequestRateLimitSuccessCount: 1000,
ModelRequestRateLimitDurationMinutes: 1, ModelRequestRateLimitDurationMinutes: 1,
ModelRequestRateLimitGroup: '', ModelRequestRateLimitGroup: '',
}); });
let [loading, setLoading] = useState(false); let [loading, setLoading] = useState(false);
const getOptions = async () => { const getOptions = async () => {
const res = await API.get('/api/option/'); const res = await API.get('/api/option/');
const { success, message, data } = res.data; const { success, message, data } = res.data;
if (success) { if (success) {
let newInputs = {}; let newInputs = {};
data.forEach((item) => { data.forEach((item) => {
if (item.key === 'ModelRequestRateLimitGroup') { if (item.key === 'ModelRequestRateLimitGroup') {
item.value = JSON.stringify(JSON.parse(item.value), null, 2); item.value = JSON.stringify(JSON.parse(item.value), null, 2);
} }
if (item.key.endsWith('Enabled')) { if (item.key.endsWith('Enabled')) {
newInputs[item.key] = item.value === 'true' ? true : false; newInputs[item.key] = item.value === 'true' ? true : false;
} else { } else {
newInputs[item.key] = item.value; newInputs[item.key] = item.value;
} }
}); });
setInputs(newInputs); setInputs(newInputs);
} else { } else {
showError(message); showError(message);
} }
}; };
async function onRefresh() { async function onRefresh() {
try { try {
setLoading(true); setLoading(true);
await getOptions(); await getOptions();
// showSuccess('刷新成功'); // showSuccess('刷新成功');
} catch (error) { } catch (error) {
showError('刷新失败'); showError('刷新失败');
} finally { } finally {
setLoading(false); setLoading(false);
} }
} }
useEffect(() => { useEffect(() => {
onRefresh(); onRefresh();
}, []); }, []);
return ( return (
<> <>
<Spin spinning={loading} size='large'> <Spin spinning={loading} size='large'>
{/* AI请求速率限制 */} {/* AI请求速率限制 */}
<Card style={{ marginTop: '10px' }}> <Card style={{ marginTop: '10px' }}>
<RequestRateLimit options={inputs} refresh={onRefresh} /> <RequestRateLimit options={inputs} refresh={onRefresh} />
</Card> </Card>
</Spin> </Spin>
</> </>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment