feat: implement cross-group retry functionality and update translations

This commit is contained in:
CaIon 2025-12-12 18:28:33 +08:00
parent c87deaa7d9
commit ffb1931906
8 changed files with 33 additions and 13 deletions

View File

@ -27,8 +27,10 @@ func CacheGetRandomSatisfiedChannel(c *gin.Context, group string, modelName stri
crossGroupRetry := common.GetContextKeyBool(c, constant.ContextKeyTokenCrossGroupRetry) crossGroupRetry := common.GetContextKeyBool(c, constant.ContextKeyTokenCrossGroupRetry)
if crossGroupRetry && retry > 0 { if crossGroupRetry && retry > 0 {
logger.LogDebug(c, "Auto group retry cross group, retry: %d", retry) logger.LogDebug(c, "Auto group retry cross group, retry: %d", retry)
if lastIndex, exists := c.Get(string(constant.ContextKeyAutoGroupIndex)); exists { if lastIndex, exists := common.GetContextKey(c, constant.ContextKeyAutoGroupIndex); exists {
startIndex = lastIndex.(int) + 1 if idx, ok := lastIndex.(int); ok {
startIndex = idx + 1
}
} }
logger.LogDebug(c, "Auto group retry cross group, start index: %d", startIndex) logger.LogDebug(c, "Auto group retry cross group, start index: %d", startIndex)
} }
@ -40,7 +42,7 @@ func CacheGetRandomSatisfiedChannel(c *gin.Context, group string, modelName stri
continue continue
} else { } else {
c.Set("auto_group", autoGroup) c.Set("auto_group", autoGroup)
c.Set(string(constant.ContextKeyAutoGroupIndex), i) common.SetContextKey(c, constant.ContextKeyAutoGroupIndex, i)
selectGroup = autoGroup selectGroup = autoGroup
logger.LogDebug(c, "Auto selected group: %s", autoGroup) logger.LogDebug(c, "Auto selected group: %s", autoGroup)
break break

View File

@ -88,7 +88,7 @@ const renderStatus = (text, record, t) => {
}; };
// Render group column // Render group column
const renderGroupColumn = (text, t) => { const renderGroupColumn = (text, record, t) => {
if (text === 'auto') { if (text === 'auto') {
return ( return (
<Tooltip <Tooltip
@ -98,8 +98,8 @@ const renderGroupColumn = (text, t) => {
position='top' position='top'
> >
<Tag color='white' shape='circle'> <Tag color='white' shape='circle'>
{' '} {t('智能熔断')}
{t('智能熔断')}{' '} {record && record.cross_group_retry ? `(${t('跨分组')})` : ''}
</Tag> </Tag>
</Tooltip> </Tooltip>
); );
@ -455,7 +455,7 @@ export const getTokensColumns = ({
title: t('分组'), title: t('分组'),
dataIndex: 'group', dataIndex: 'group',
key: 'group', key: 'group',
render: (text) => renderGroupColumn(text, t), render: (text, record) => renderGroupColumn(text, record, t),
}, },
{ {
title: t('密钥'), title: t('密钥'),

View File

@ -2176,6 +2176,9 @@
"默认区域,如: us-central1": "Default region, e.g.: us-central1", "默认区域,如: us-central1": "Default region, e.g.: us-central1",
"默认折叠侧边栏": "Default collapse sidebar", "默认折叠侧边栏": "Default collapse sidebar",
"默认测试模型": "Default Test Model", "默认测试模型": "Default Test Model",
"默认补全倍率": "Default completion ratio" "默认补全倍率": "Default completion ratio",
"跨分组重试": "Cross-group retry",
"跨分组": "Cross-group",
"开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "After enabling, when the current group channel fails, it will try the next group's channel in order"
} }
} }

View File

@ -2225,6 +2225,9 @@
"默认助手消息": "Bonjour ! Comment puis-je vous aider aujourd'hui ?", "默认助手消息": "Bonjour ! Comment puis-je vous aider aujourd'hui ?",
"可选,用于复现结果": "Optionnel, pour des résultats reproductibles", "可选,用于复现结果": "Optionnel, pour des résultats reproductibles",
"随机种子 (留空为随机)": "Graine aléatoire (laisser vide pour aléatoire)", "随机种子 (留空为随机)": "Graine aléatoire (laisser vide pour aléatoire)",
"默认补全倍率": "Taux de complétion par défaut" "默认补全倍率": "Taux de complétion par défaut",
"跨分组重试": "Nouvelle tentative inter-groupes",
"跨分组": "Inter-groupes",
"开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "Après activation, lorsque le canal du groupe actuel échoue, il essaiera le canal du groupe suivant dans l'ordre"
} }
} }

View File

@ -2124,6 +2124,9 @@
"默认用户消息": "こんにちは", "默认用户消息": "こんにちは",
"默认助手消息": "こんにちは!何かお手伝いできることはありますか?", "默认助手消息": "こんにちは!何かお手伝いできることはありますか?",
"可选,用于复现结果": "オプション、結果の再現用", "可选,用于复现结果": "オプション、結果の再現用",
"随机种子 (留空为随机)": "ランダムシード(空欄でランダム)" "随机种子 (留空为随机)": "ランダムシード(空欄でランダム)",
"跨分组重试": "グループ間リトライ",
"跨分组": "グループ間",
"开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "有効にすると、現在のグループチャネルが失敗した場合、次のグループのチャネルを順番に試行します"
} }
} }

View File

@ -2235,6 +2235,9 @@
"默认用户消息": "Здравствуйте", "默认用户消息": "Здравствуйте",
"默认助手消息": "Здравствуйте! Чем я могу вам помочь?", "默认助手消息": "Здравствуйте! Чем я могу вам помочь?",
"可选,用于复现结果": "Необязательно, для воспроизводимых результатов", "可选,用于复现结果": "Необязательно, для воспроизводимых результатов",
"随机种子 (留空为随机)": "Случайное зерно (оставьте пустым для случайного)" "随机种子 (留空为随机)": "Случайное зерно (оставьте пустым для случайного)",
"跨分组重试": "Повторная попытка между группами",
"跨分组": "Межгрупповой",
"开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "После включения, когда канал текущей группы не работает, он будет пытаться использовать канал следующей группы по порядку"
} }
} }

View File

@ -2735,6 +2735,9 @@
"默认用户消息": "Xin chào", "默认用户消息": "Xin chào",
"默认助手消息": "Xin chào! Tôi có thể giúp gì cho bạn?", "默认助手消息": "Xin chào! Tôi có thể giúp gì cho bạn?",
"可选,用于复现结果": "Tùy chọn, để tái tạo kết quả", "可选,用于复现结果": "Tùy chọn, để tái tạo kết quả",
"随机种子 (留空为随机)": "Hạt giống ngẫu nhiên (để trống cho ngẫu nhiên)" "随机种子 (留空为随机)": "Hạt giống ngẫu nhiên (để trống cho ngẫu nhiên)",
"跨分组重试": "Thử lại giữa các nhóm",
"跨分组": "Giữa các nhóm",
"开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "Sau khi bật, khi kênh nhóm hiện tại thất bại, nó sẽ thử kênh của nhóm tiếp theo theo thứ tự"
} }
} }

View File

@ -2202,6 +2202,9 @@
"默认用户消息": "你好", "默认用户消息": "你好",
"默认助手消息": "你好!有什么我可以帮助你的吗?", "默认助手消息": "你好!有什么我可以帮助你的吗?",
"可选,用于复现结果": "可选,用于复现结果", "可选,用于复现结果": "可选,用于复现结果",
"随机种子 (留空为随机)": "随机种子 (留空为随机)" "随机种子 (留空为随机)": "随机种子 (留空为随机)",
"跨分组重试": "跨分组重试",
"跨分组": "跨分组",
"开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道"
} }
} }