Skip to content

Commit b765d99

Browse files
committed
refactor(api): only fetch router models for providers with configured profiles. Fixes #4065
Add hasConfiguredProfile helper to filter model fetch candidates based on listApiConfigMeta, preventing unnecessary API calls for providers without configured profiles. - Extract listApiConfigMeta from state to check configured providers - Filter candidates to only fetch models for providers in use - Make litellm and io-intelligence type properties optional - Add apiKey to glama and vercel-ai-gateway candidate options - Update tests to verify profile-based filtering behavior
1 parent 80a8734 commit b765d99

File tree

8 files changed

+269
-207
lines changed

8 files changed

+269
-207
lines changed

.changeset/tasty-mails-take.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": minor
3+
---
4+
5+
only fetch router models for providers with configured profiles

.vscode/launch.json

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,37 @@
4343
"VSCODE_DEBUG_MODE": "true"
4444
},
4545
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
46-
"presentation": { "hidden": false, "group": "tasks", "order": 1 }
46+
"presentation": {
47+
"hidden": false,
48+
"group": "tasks",
49+
"order": 1
50+
}
51+
},
52+
{
53+
"name": "Run Extension [Isolated,Proxy]",
54+
"type": "extensionHost",
55+
"request": "launch",
56+
"runtimeExecutable": "${execPath}",
57+
"args": [
58+
"--extensionDevelopmentPath=${workspaceFolder}/src",
59+
"--disable-extensions",
60+
"${input:extensionLaunchDir}"
61+
],
62+
"sourceMaps": true,
63+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
64+
"preLaunchTask": "${defaultBuildTask}",
65+
"env": {
66+
"NODE_ENV": "development",
67+
"VSCODE_DEBUG_MODE": "true",
68+
"http_proxy": "http://localhost:8080",
69+
"https_proxy": "http://localhost:8080"
70+
},
71+
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
72+
"presentation": {
73+
"hidden": false,
74+
"group": "tasks",
75+
"order": 1
76+
}
4777
},
4878
{
4979
"name": "Run Extension [Local Backend]",
@@ -60,7 +90,11 @@
6090
"KILOCODE_BACKEND_BASE_URL": "${input:kilocodeBackendBaseUrl}"
6191
},
6292
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"],
63-
"presentation": { "hidden": false, "group": "tasks", "order": 2 }
93+
"presentation": {
94+
"hidden": false,
95+
"group": "tasks",
96+
"order": 2
97+
}
6498
}
6599
],
66100
"inputs": [

pnpm-lock.yaml

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

src/api/providers/fetchers/modelCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const getModels = async (options: GetModelsOptions): Promise<ModelRecord>
9696
break
9797
case "litellm":
9898
// Type safety ensures apiKey and baseUrl are always provided for LiteLLM.
99-
models = await getLiteLLMModels(options.apiKey, options.baseUrl)
99+
models = await getLiteLLMModels(options.apiKey || "", options.baseUrl || "")
100100
break
101101
// kilocode_change start
102102
case "kilocode": {

src/api/providers/synthetic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// kilocode_change - provider added
22

33
import { Anthropic } from "@anthropic-ai/sdk"
4-
import OpenAI from "openai"
54

65
import { type SyntheticModelId, syntheticDefaultModelId, syntheticModels } from "@roo-code/types"
76

0 commit comments

Comments
 (0)