mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: remove unsafe as any casts in modelCache.ts by extending GetModelsOptions type
Add Ollama-specific optional fields (ollamaModelDiscoveryTimeout, ollamaMaxRetries, ollamaRetryDelay, ollamaEnableLogging) to the ollama entry in dynamicProviderExtras, so the discriminated union type properly includes these fields and no as any casts are needed.
This commit is contained in:
parent
51f14979e2
commit
f46a3ebe79
2 changed files with 10 additions and 5 deletions
|
|
@ -74,10 +74,10 @@ async function fetchModelsFromProvider(options: GetModelsOptions): Promise<Model
|
|||
break
|
||||
case "ollama":
|
||||
models = await getOllamaModels(options.baseUrl, options.apiKey, {
|
||||
modelDiscoveryTimeout: (options as any).ollamaModelDiscoveryTimeout,
|
||||
maxRetries: (options as any).ollamaMaxRetries,
|
||||
retryDelay: (options as any).ollamaRetryDelay,
|
||||
enableLogging: (options as any).ollamaEnableLogging,
|
||||
modelDiscoveryTimeout: options.ollamaModelDiscoveryTimeout,
|
||||
maxRetries: options.ollamaMaxRetries,
|
||||
retryDelay: options.ollamaRetryDelay,
|
||||
enableLogging: options.ollamaEnableLogging,
|
||||
})
|
||||
break
|
||||
case "lmstudio":
|
||||
|
|
|
|||
|
|
@ -173,7 +173,12 @@ const dynamicProviderExtras = {
|
|||
"vercel-ai-gateway": {} as {}, // eslint-disable-line @typescript-eslint/no-empty-object-type
|
||||
litellm: {} as { apiKey: string; baseUrl: string },
|
||||
requesty: {} as { apiKey?: string; baseUrl?: string },
|
||||
ollama: {} as {}, // eslint-disable-line @typescript-eslint/no-empty-object-type
|
||||
ollama: {} as {
|
||||
ollamaModelDiscoveryTimeout?: number
|
||||
ollamaMaxRetries?: number
|
||||
ollamaRetryDelay?: number
|
||||
ollamaEnableLogging?: boolean
|
||||
},
|
||||
lmstudio: {} as {}, // eslint-disable-line @typescript-eslint/no-empty-object-type
|
||||
roo: {} as { apiKey?: string; baseUrl?: string },
|
||||
} as const satisfies Record<RouterName, object>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue