修复: 队列发送失败回填不丢消息+池权重revert+lang解析DRY+注释变量名修正
This commit is contained in:
@@ -318,6 +318,7 @@ async function onPoolToggle(p: AiProviderConfig, enabled: boolean) {
|
||||
function onPoolWeightChange(p: AiProviderConfig, raw: number) {
|
||||
// NaN 兜底(清空输入):回退 50,防 IPC 传 NaN 后端 serde u32 失败
|
||||
const clamped = Math.min(100, Math.max(0, Number.isFinite(raw) ? Math.trunc(raw) : 50))
|
||||
const prev = p.weight
|
||||
p.weight = clamped
|
||||
if (_poolTimer) clearTimeout(_poolTimer)
|
||||
_poolTimer = setTimeout(async () => {
|
||||
@@ -325,6 +326,7 @@ function onPoolWeightChange(p: AiProviderConfig, raw: number) {
|
||||
await aiApi.updateProviderPool(p.id, p.enabled !== false, clamped)
|
||||
emit('toast', t('settings.toastPoolUpdateOk'), 'info')
|
||||
} catch (e) {
|
||||
p.weight = prev // revert
|
||||
console.error(t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), e)
|
||||
emit('toast', t('settings.toastPoolUpdateFail', { msg: errMsg(e) }), 'error')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user