mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-06 02:47:56 +00:00
fix: migrate deprecated code-supernova model ID to code-supernova-1-million
- Add model ID migration logic in RooHandler.getModel() to automatically convert the deprecated 'roo/code-supernova' model ID to 'roo/code-supernova-1-million' - Add comprehensive test coverage for the migration logic - Fixes #8880 where users get 404 errors when using the old model ID
This commit is contained in:
parent
11f1c06413
commit
008432a687
2 changed files with 38 additions and 1 deletions
|
|
@ -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", () => {
|
||||
|
|
|
|||
|
|
@ -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") || {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue