feat: add special user usable group setting

This commit is contained in:
CaIon
2025-10-28 23:25:43 +08:00
parent a25c11df2a
commit 6aec088693
22 changed files with 521 additions and 142 deletions

View File

@@ -46,6 +46,7 @@ const RatioSetting = () => {
DefaultUseAutoGroup: false,
ExposeRatioEnabled: false,
UserUsableGroups: '',
'group_ratio_setting.group_special_usable_group': '',
});
const [loading, setLoading] = useState(false);
@@ -57,17 +58,7 @@ const RatioSetting = () => {
let newInputs = {};
data.forEach((item) => {
if (
item.key === 'ModelRatio' ||
item.key === 'GroupRatio' ||
item.key === 'GroupGroupRatio' ||
item.key === 'AutoGroups' ||
item.key === 'UserUsableGroups' ||
item.key === 'CompletionRatio' ||
item.key === 'ModelPrice' ||
item.key === 'CacheRatio' ||
item.key === 'ImageRatio' ||
item.key === 'AudioRatio' ||
item.key === 'AudioCompletionRatio'
item.value.startsWith('{') || item.value.startsWith('[')
) {
try {
item.value = JSON.stringify(JSON.parse(item.value), null, 2);

View File

@@ -137,14 +137,12 @@ const EditTokenModal = (props) => {
if (statusState?.status?.default_use_auto_group) {
if (localGroupOptions.some((group) => group.value === 'auto')) {
localGroupOptions.sort((a, b) => (a.value === 'auto' ? -1 : 1));
} else {
localGroupOptions.unshift({ label: t('自动选择'), value: 'auto' });
}
}
setGroups(localGroupOptions);
if (statusState?.status?.default_use_auto_group && formApiRef.current) {
formApiRef.current.setValue('group', 'auto');
}
// if (statusState?.status?.default_use_auto_group && formApiRef.current) {
// formApiRef.current.setValue('group', 'auto');
// }
} else {
showError(t(message));
}