Skip to content

Commit e5ae0b6

Browse files
author
James Mtendamema
committed
fix: prevent caching of models for zoo-gateway and update service URL in settings
1 parent 8f03729 commit e5ae0b6

20 files changed

Lines changed: 26 additions & 22 deletions

File tree

src/api/providers/fetchers/modelCache.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ async function fetchModelsFromProvider(options: GetModelsOptions): Promise<Model
127127
export const getModels = async (options: GetModelsOptions): Promise<ModelRecord> => {
128128
const { provider } = options
129129

130-
let models = getModelsFromCache(provider)
130+
// Always fetch fresh to prevent serving stale models from different auth contexts.
131+
const shouldSkipCache = provider === "zoo-gateway"
132+
133+
let models = shouldSkipCache ? undefined : getModelsFromCache(provider)
131134

132135
if (models) {
133136
return models
@@ -139,13 +142,14 @@ export const getModels = async (options: GetModelsOptions): Promise<ModelRecord>
139142

140143
// Only cache non-empty results to prevent persisting failed API responses
141144
// Empty results could indicate API failure rather than "no models exist"
142-
if (modelCount > 0) {
145+
// Zoo Gateway models are user-specific - skip caching entirely
146+
if (modelCount > 0 && !shouldSkipCache) {
143147
memoryCache.set(provider, models)
144148

145149
await writeModels(provider, models).catch((err) =>
146150
console.error(`[MODEL_CACHE] Error writing ${provider} models to file cache:`, err),
147151
)
148-
} else {
152+
} else if (modelCount === 0) {
149153
TelemetryService.instance.captureEvent(TelemetryEventName.MODEL_CACHE_EMPTY_RESPONSE, {
150154
provider,
151155
context: "getModels",

webview-ui/src/components/settings/providers/ZooGateway.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const ZooGateway = ({
7373
models={routerModels?.["zoo-gateway"] ?? {}}
7474
modelIdKey="zooGatewayModelId"
7575
serviceName="Zoo Gateway"
76-
serviceUrl="https://www.zoocode.dev/dashboard"
76+
serviceUrl="https://www.zoocode.dev/dashboard/models"
7777
organizationAllowList={organizationAllowList}
7878
errorMessage={modelValidationError}
7979
simplifySettings={simplifySettings}

webview-ui/src/i18n/locales/ca/settings.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/de/settings.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@
930930
}
931931
},
932932
"modelPicker": {
933-
"automaticFetch": "The extension automatically fetches the latest list of models available on <serviceLink>{{serviceName}}</serviceLink>. If you're unsure which model to choose, Zoo Code works best with <defaultModelLink>{{defaultModelId}}</defaultModelLink>. You can also try searching \"free\" for no-cost options currently available.",
933+
"automaticFetch": "The extension automatically fetches the latest list of models available on <serviceLink>{{serviceName}}</serviceLink>. If you're unsure which model to choose, Zoo Code works best with <defaultModelLink>{{defaultModelId}}</defaultModelLink>.",
934934
"label": "Model",
935935
"searchPlaceholder": "Search",
936936
"noMatchFound": "No match found",

webview-ui/src/i18n/locales/es/settings.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/fr/settings.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/hi/settings.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/id/settings.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/it/settings.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)