diff --git a/service/channel_select.go b/service/channel_select.go index 348b89e5..b95aa025 100644 --- a/service/channel_select.go +++ b/service/channel_select.go @@ -27,8 +27,10 @@ func CacheGetRandomSatisfiedChannel(c *gin.Context, group string, modelName stri crossGroupRetry := common.GetContextKeyBool(c, constant.ContextKeyTokenCrossGroupRetry) if crossGroupRetry && retry > 0 { logger.LogDebug(c, "Auto group retry cross group, retry: %d", retry) - if lastIndex, exists := c.Get(string(constant.ContextKeyAutoGroupIndex)); exists { - startIndex = lastIndex.(int) + 1 + if lastIndex, exists := common.GetContextKey(c, constant.ContextKeyAutoGroupIndex); exists { + if idx, ok := lastIndex.(int); ok { + startIndex = idx + 1 + } } 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 } else { c.Set("auto_group", autoGroup) - c.Set(string(constant.ContextKeyAutoGroupIndex), i) + common.SetContextKey(c, constant.ContextKeyAutoGroupIndex, i) selectGroup = autoGroup logger.LogDebug(c, "Auto selected group: %s", autoGroup) break diff --git a/web/src/components/table/tokens/TokensColumnDefs.jsx b/web/src/components/table/tokens/TokensColumnDefs.jsx index 4e092f9c..ce8eab80 100644 --- a/web/src/components/table/tokens/TokensColumnDefs.jsx +++ b/web/src/components/table/tokens/TokensColumnDefs.jsx @@ -88,7 +88,7 @@ const renderStatus = (text, record, t) => { }; // Render group column -const renderGroupColumn = (text, t) => { +const renderGroupColumn = (text, record, t) => { if (text === 'auto') { return ( { position='top' > - {' '} - {t('智能熔断')}{' '} + {t('智能熔断')} + {record && record.cross_group_retry ? `(${t('跨分组')})` : ''} ); @@ -455,7 +455,7 @@ export const getTokensColumns = ({ title: t('分组'), dataIndex: 'group', key: 'group', - render: (text) => renderGroupColumn(text, t), + render: (text, record) => renderGroupColumn(text, record, t), }, { title: t('密钥'), diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 3f279e13..2539c9d1 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -2176,6 +2176,9 @@ "默认区域,如: us-central1": "Default region, e.g.: us-central1", "默认折叠侧边栏": "Default collapse sidebar", "默认测试模型": "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" } } diff --git a/web/src/i18n/locales/fr.json b/web/src/i18n/locales/fr.json index ed1df8a8..2e07dd1d 100644 --- a/web/src/i18n/locales/fr.json +++ b/web/src/i18n/locales/fr.json @@ -2225,6 +2225,9 @@ "默认助手消息": "Bonjour ! Comment puis-je vous aider aujourd'hui ?", "可选,用于复现结果": "Optionnel, pour des résultats reproductibles", "随机种子 (留空为随机)": "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" } } diff --git a/web/src/i18n/locales/ja.json b/web/src/i18n/locales/ja.json index 0e4786c6..f59ff604 100644 --- a/web/src/i18n/locales/ja.json +++ b/web/src/i18n/locales/ja.json @@ -2124,6 +2124,9 @@ "默认用户消息": "こんにちは", "默认助手消息": "こんにちは!何かお手伝いできることはありますか?", "可选,用于复现结果": "オプション、結果の再現用", - "随机种子 (留空为随机)": "ランダムシード(空欄でランダム)" + "随机种子 (留空为随机)": "ランダムシード(空欄でランダム)", + "跨分组重试": "グループ間リトライ", + "跨分组": "グループ間", + "开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "有効にすると、現在のグループチャネルが失敗した場合、次のグループのチャネルを順番に試行します" } } diff --git a/web/src/i18n/locales/ru.json b/web/src/i18n/locales/ru.json index 92171a0c..ad85a9dd 100644 --- a/web/src/i18n/locales/ru.json +++ b/web/src/i18n/locales/ru.json @@ -2235,6 +2235,9 @@ "默认用户消息": "Здравствуйте", "默认助手消息": "Здравствуйте! Чем я могу вам помочь?", "可选,用于复现结果": "Необязательно, для воспроизводимых результатов", - "随机种子 (留空为随机)": "Случайное зерно (оставьте пустым для случайного)" + "随机种子 (留空为随机)": "Случайное зерно (оставьте пустым для случайного)", + "跨分组重试": "Повторная попытка между группами", + "跨分组": "Межгрупповой", + "开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "После включения, когда канал текущей группы не работает, он будет пытаться использовать канал следующей группы по порядку" } } diff --git a/web/src/i18n/locales/vi.json b/web/src/i18n/locales/vi.json index 8af562f7..85da47cc 100644 --- a/web/src/i18n/locales/vi.json +++ b/web/src/i18n/locales/vi.json @@ -2735,6 +2735,9 @@ "默认用户消息": "Xin chào", "默认助手消息": "Xin chào! Tôi có thể giúp gì cho bạn?", "可选,用于复现结果": "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ự" } } diff --git a/web/src/i18n/locales/zh.json b/web/src/i18n/locales/zh.json index a0788563..8215ba14 100644 --- a/web/src/i18n/locales/zh.json +++ b/web/src/i18n/locales/zh.json @@ -2202,6 +2202,9 @@ "默认用户消息": "你好", "默认助手消息": "你好!有什么我可以帮助你的吗?", "可选,用于复现结果": "可选,用于复现结果", - "随机种子 (留空为随机)": "随机种子 (留空为随机)" + "随机种子 (留空为随机)": "随机种子 (留空为随机)", + "跨分组重试": "跨分组重试", + "跨分组": "跨分组", + "开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道": "开启后,当前分组渠道失败时会按顺序尝试下一个分组的渠道" } }