Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/api/providers/__tests__/roo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,33 @@ describe("RooHandler", () => {
expect(modelInfo.info.contextWindow).toBeDefined()
}
})

it("should migrate deprecated code-supernova model ID to code-supernova-1-million", () => {
const handlerWithDeprecatedModel = new RooHandler({
apiModelId: "roo/code-supernova",
})
const modelInfo = handlerWithDeprecatedModel.getModel()
// Should return the migrated model ID
expect(modelInfo.id).toBe("roo/code-supernova-1-million")
expect(modelInfo.info).toBeDefined()
})

it("should not migrate non-deprecated model IDs", () => {
const testCases = [
"roo/code-supernova-1-million", // Already migrated
"xai/grok-code-fast-1", // Different model
"roo/sonic", // Different model
"unknown-model", // Unknown model
]

for (const modelId of testCases) {
const handlerWithModel = new RooHandler({ apiModelId: modelId })
const modelInfo = handlerWithModel.getModel()
// Should return the same model ID without migration
expect(modelInfo.id).toBe(modelId)
expect(modelInfo.info).toBeDefined()
}
})
})

describe("temperature and model configuration", () => {
Expand Down
12 changes: 11 additions & 1 deletion src/api/providers/roo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,17 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
}

override getModel() {
const modelId = this.options.apiModelId || rooDefaultModelId
let modelId = this.options.apiModelId || rooDefaultModelId

// Migrate deprecated model IDs to their new versions
const modelMigrations: Record<string, string> = {
"roo/code-supernova": "roo/code-supernova-1-million",
}

// Apply migration if needed
if (modelMigrations[modelId]) {
modelId = modelMigrations[modelId]
}

// Get models from shared cache
const models = getModelsFromCache("roo") || {}
Expand Down