mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Remove the Roo model defaults (#9340)
This commit is contained in:
parent
4bfd0709e4
commit
f455493af0
3 changed files with 4 additions and 45 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import { z } from "zod"
|
||||
|
||||
import type { ModelInfo } from "../model.js"
|
||||
import { TOOL_PROTOCOL } from "../tool.js"
|
||||
|
||||
/**
|
||||
* Roo Code Cloud is a dynamic provider - models are loaded from the /v1/models API endpoint.
|
||||
|
|
@ -15,38 +14,6 @@ export const rooDefaultModelId = "xai/grok-code-fast-1"
|
|||
*/
|
||||
export const rooModels = {} as const satisfies Record<string, ModelInfo>
|
||||
|
||||
/**
|
||||
* Model-specific defaults for Roo provider models.
|
||||
* These defaults are merged with dynamically fetched model data.
|
||||
*
|
||||
* Use this to configure model-specific settings like defaultToolProtocol.
|
||||
*
|
||||
* Example usage:
|
||||
* ```typescript
|
||||
* export const rooModelDefaults: Record<string, Partial<ModelInfo>> = {
|
||||
* "anthropic/claude-3-5-sonnet-20241022": {
|
||||
* defaultToolProtocol: "xml",
|
||||
* },
|
||||
* "openai/gpt-4o": {
|
||||
* defaultToolProtocol: "native",
|
||||
* },
|
||||
* "xai/grok-code-fast-1": {
|
||||
* defaultToolProtocol: "native",
|
||||
* },
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export const rooModelDefaults: Record<string, Partial<ModelInfo>> = {
|
||||
// Add model-specific defaults below.
|
||||
// You can configure defaultToolProtocol and other ModelInfo fields for specific model IDs.
|
||||
"anthropic/claude-haiku-4.5": {
|
||||
defaultToolProtocol: TOOL_PROTOCOL.NATIVE,
|
||||
},
|
||||
"minimax/minimax-m2:free": {
|
||||
defaultToolProtocol: TOOL_PROTOCOL.NATIVE,
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Roo Code Cloud API response schemas
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { RooModelsResponseSchema, rooModelDefaults } from "@roo-code/types"
|
||||
import { RooModelsResponseSchema } from "@roo-code/types"
|
||||
|
||||
import type { ModelRecord } from "../../../shared/api"
|
||||
import { parseApiPrice } from "../../../shared/cost"
|
||||
|
|
@ -119,10 +119,7 @@ export async function getRooModels(baseUrl: string, apiKey?: string): Promise<Mo
|
|||
isFree: tags.includes("free"),
|
||||
}
|
||||
|
||||
// Merge with model-specific defaults if they exist
|
||||
// Defaults take precedence over dynamically fetched data for specified fields
|
||||
const modelDefaults = rooModelDefaults[modelId]
|
||||
models[modelId] = modelDefaults ? { ...baseModelInfo, ...modelDefaults } : baseModelInfo
|
||||
models[modelId] = baseModelInfo
|
||||
}
|
||||
|
||||
return models
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Anthropic } from "@anthropic-ai/sdk"
|
||||
import OpenAI from "openai"
|
||||
|
||||
import { rooDefaultModelId, rooModelDefaults, getApiProtocol } from "@roo-code/types"
|
||||
import { rooDefaultModelId, getApiProtocol } from "@roo-code/types"
|
||||
import { CloudService } from "@roo-code/cloud"
|
||||
|
||||
import type { ApiHandlerOptions, ModelRecord } from "../../shared/api"
|
||||
|
|
@ -274,8 +274,7 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
|
|||
}
|
||||
|
||||
// Return the requested model ID even if not found, with fallback info.
|
||||
// Check if there are model-specific defaults configured
|
||||
const baseModelInfo = {
|
||||
const fallbackInfo = {
|
||||
maxTokens: 16_384,
|
||||
contextWindow: 262_144,
|
||||
supportsImages: false,
|
||||
|
|
@ -287,10 +286,6 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
|
|||
isFree: false,
|
||||
}
|
||||
|
||||
// Merge with model-specific defaults if they exist
|
||||
const modelDefaults = rooModelDefaults[modelId]
|
||||
const fallbackInfo = modelDefaults ? { ...baseModelInfo, ...modelDefaults } : baseModelInfo
|
||||
|
||||
return {
|
||||
id: modelId,
|
||||
info: fallbackInfo,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue