fix(grok): default client tool caching on for Free accounts

This commit is contained in:
superman2003 committed 2026-07-19 18:59:50 +08:00
1 parent eea02c38fc
commit c8ff478876
6 files changed
+176 -38

No files matched your search

@@ -2768,7 +2768,9 @@ const headerOverrideCapable = computed(
// Grok OAuth 自定义上游地址(仅转发端点;OAuth 授权/令牌刷新不受影响)
const grokOAuthCustomBaseUrlEnabled = ref(false)
const grokOAuthBaseUrl = ref('')
const grokClientToolCacheEnabled = ref(false)
// Grok Free OAuth accounts use client-tool prompt caching by default. Keep an
// explicit false in the account extra as the opt-out signal.
const grokClientToolCacheEnabled = ref(true)
const interceptWarmupRequests = ref(false)
const autoPauseOnExpired = ref(false)
@@ -3424,10 +3426,14 @@ const syncFormFromAccount = (newAccount: Account | null) => {
// Load Grok OAuth custom upstream URL state(存储的官方地址视同未定制)
grokOAuthCustomBaseUrlEnabled.value = false
grokOAuthBaseUrl.value = ''
const grokClientToolCacheSetting =
newAccount.platform === 'grok' && newAccount.type === 'oauth'
? newAccount.extra?.[GROK_CLIENT_TOOL_CACHE_EXTRA_KEY]
: undefined
grokClientToolCacheEnabled.value =
newAccount.platform === 'grok' &&
newAccount.type === 'oauth' &&
newAccount.extra?.[GROK_CLIENT_TOOL_CACHE_EXTRA_KEY] === true
(grokClientToolCacheSetting === undefined || grokClientToolCacheSetting === true)
if (newAccount.platform === 'grok' && newAccount.type === 'oauth' && newAccount.credentials) {
const grokCreds = newAccount.credentials as Record<string, unknown>
if (isCustomGrokBaseUrl(grokCreds.base_url)) {
@@ -4318,11 +4324,9 @@ const handleSubmit = async () => {
const newExtra: Record<string, unknown> = {
...((props.account.extra as Record<string, unknown>) || {})
}
if (grokClientToolCacheEnabled.value) {
newExtra[GROK_CLIENT_TOOL_CACHE_EXTRA_KEY] = true
} else {
delete newExtra[GROK_CLIENT_TOOL_CACHE_EXTRA_KEY]
}
// Persist both states so a disabled account remains opted out when the
// backend applies the default-enabled policy to missing values.
newExtra[GROK_CLIENT_TOOL_CACHE_EXTRA_KEY] = grokClientToolCacheEnabled.value
updatePayload.extra = newExtra
}