From 8d85cb57f18b3af7c4c9e5e791ed60bbbb07da01 Mon Sep 17 00:00:00 2001 From: erio Date: Sat, 7 Mar 2026 02:43:41 +0800 Subject: [PATCH] feat: add client affinity toggle to create account modal The client affinity setting was only available when editing an account. Now it's also available during account creation for all Anthropic platform types (OAuth, Setup Token, API Key). Co-Authored-By: Claude Opus 4.6 --- .../components/account/CreateAccountModal.vue | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/frontend/src/components/account/CreateAccountModal.vue b/frontend/src/components/account/CreateAccountModal.vue index 5cbc9691df..fa361e637a 100644 --- a/frontend/src/components/account/CreateAccountModal.vue +++ b/frontend/src/components/account/CreateAccountModal.vue @@ -1410,6 +1410,36 @@ + +
+
+
+ +

+ {{ t('admin.accounts.quotaControl.clientAffinity.hint') }} +

+
+ +
+
+
(null) @@ -3140,6 +3173,7 @@ const resetForm = () => { editQuotaLimit.value = null editQuotaDailyLimit.value = null editQuotaWeeklyLimit.value = null + clientAffinityEnabled.value = false modelMappings.value = [] modelRestrictionMode.value = 'whitelist' allowedModels.value = [...claudeModels] // Default fill related models @@ -3243,10 +3277,20 @@ const buildAnthropicExtra = (base?: Record): Record 0 ? extra : undefined } +/** 将客户端亲和设置写入 extra(Anthropic 全类型通用) */ +const applyClientAffinity = (extra: Record) => { + if (clientAffinityEnabled.value) { + extra.client_affinity_enabled = true + } else { + delete extra.client_affinity_enabled + } +} + const buildSoraExtra = ( base?: Record, linkedOpenAIAccountId?: string | number @@ -4143,6 +4187,9 @@ const handleAnthropicExchange = async (authCode: string) => { extra.cache_ttl_override_target = cacheTTLOverrideTarget.value } + // Add client affinity setting + applyClientAffinity(extra) + const credentials: Record = { ...tokenInfo } applyInterceptWarmup(credentials, interceptWarmupRequests.value, 'create') await createAccountAndFinish(form.platform, addMethod.value as AccountType, credentials, extra)