Skip to content

Commit 3e179b6

Browse files
committed
feat(api): add cognima model selection support
Add cognimaModelId to provider settings schema and implement model selection logic in the UI hook for the cognima provider. Remove unused import from cognima fetcher.
1 parent 5e5c5d5 commit 3e179b6

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/types/src/provider-settings.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ const groqSchema = apiModelIdProviderModelSchema.extend({
354354
groqApiKey: z.string().optional(),
355355
})
356356

357-
const cognimaSchema = apiModelIdProviderModelSchema.extend({
357+
const cognimaSchema = baseProviderSettingsSchema.extend({
358+
cognimaModelId: z.string().optional(),
358359
cognimaApiKey: z.string().optional(),
359360
})
360361

@@ -536,6 +537,7 @@ export const modelIdKeys = [
536537
"ioIntelligenceModelId",
537538
"vercelAiGatewayModelId",
538539
"deepInfraModelId",
540+
"cognimaModelId",
539541
] as const satisfies readonly (keyof ProviderSettings)[]
540542

541543
export type ModelIdKey = (typeof modelIdKeys)[number]
@@ -576,7 +578,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
576578
requesty: "requestyModelId",
577579
xai: "apiModelId",
578580
groq: "apiModelId",
579-
cognima: "apiModelId",
581+
cognima: "cognimaModelId",
580582
chutes: "apiModelId",
581583
litellm: "litellmModelId",
582584
huggingface: "huggingFaceModelId",

src/api/providers/fetchers/cognima.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { z } from "zod"
33

44
import type { ModelInfo } from "@roo-code/types"
55

6-
import { parseApiPrice } from "../../../shared/cost"
7-
86
/**
97
* CognimaModel
108
*/

webview-ui/src/components/ui/hooks/useSelectedModel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import {
5454
qwenCodeDefaultModelId,
5555
qwenCodeModels,
5656
vercelAiGatewayDefaultModelId,
57+
cognimaDefaultModelId,
5758
BEDROCK_1M_CONTEXT_MODEL_IDS,
5859
deepInfraDefaultModelId,
5960
} from "@roo-code/types"
@@ -344,6 +345,11 @@ function getSelectedModel({
344345
const info = routerModels["vercel-ai-gateway"]?.[id]
345346
return { id, info }
346347
}
348+
case "cognima": {
349+
const id = apiConfiguration.cognimaModelId ?? cognimaDefaultModelId
350+
const info = routerModels.cognima?.[id]
351+
return { id, info }
352+
}
347353
// case "anthropic":
348354
// case "human-relay":
349355
// case "fake-ai":

0 commit comments

Comments
 (0)