mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-12 23:01:21 +00:00
Default grok code fast to native tools (#9717)
This commit is contained in:
parent
b5acebccf5
commit
8244f70d7b
3 changed files with 21 additions and 14 deletions
|
|
@ -77,6 +77,7 @@ describe("getRooModels", () => {
|
|||
description: "Fast coding model",
|
||||
deprecated: false,
|
||||
isFree: false,
|
||||
defaultToolProtocol: "native", // Applied from MODEL_DEFAULTS
|
||||
},
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,10 +1,25 @@
|
|||
import { RooModelsResponseSchema } from "@roo-code/types"
|
||||
import { RooModelsResponseSchema, type ModelInfo } from "@roo-code/types"
|
||||
|
||||
import type { ModelRecord } from "../../../shared/api"
|
||||
import { parseApiPrice } from "../../../shared/cost"
|
||||
|
||||
import { DEFAULT_HEADERS } from "../constants"
|
||||
|
||||
// Model-specific defaults that should be applied even when models come from API cache
|
||||
// These override API-provided values for specific models
|
||||
// Exported so RooHandler.getModel() can also apply these for fallback cases
|
||||
export const MODEL_DEFAULTS: Record<string, Partial<ModelInfo>> = {
|
||||
"minimax/minimax-m2": {
|
||||
defaultToolProtocol: "native",
|
||||
},
|
||||
"anthropic/claude-haiku-4.5": {
|
||||
defaultToolProtocol: "native",
|
||||
},
|
||||
"xai/grok-code-fast-1": {
|
||||
defaultToolProtocol: "native",
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches available models from the Roo Code Cloud provider
|
||||
*
|
||||
|
|
@ -119,7 +134,9 @@ export async function getRooModels(baseUrl: string, apiKey?: string): Promise<Mo
|
|||
isFree: tags.includes("free"),
|
||||
}
|
||||
|
||||
models[modelId] = baseModelInfo
|
||||
// Apply model-specific defaults (e.g., defaultToolProtocol)
|
||||
const modelDefaults = MODEL_DEFAULTS[modelId]
|
||||
models[modelId] = modelDefaults ? { ...baseModelInfo, ...modelDefaults } : baseModelInfo
|
||||
}
|
||||
|
||||
return models
|
||||
|
|
|
|||
|
|
@ -14,22 +14,11 @@ import { getRooReasoning } from "../transform/reasoning"
|
|||
import type { ApiHandlerCreateMessageMetadata } from "../index"
|
||||
import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider"
|
||||
import { getModels, getModelsFromCache } from "../providers/fetchers/modelCache"
|
||||
import { MODEL_DEFAULTS } from "../providers/fetchers/roo"
|
||||
import { handleOpenAIError } from "./utils/openai-error-handler"
|
||||
import { generateImageWithProvider, generateImageWithImagesApi, ImageGenerationResult } from "./utils/image-generation"
|
||||
import { t } from "../../i18n"
|
||||
|
||||
import type { ModelInfo } from "@roo-code/types"
|
||||
|
||||
// Model-specific defaults that should be applied even when models come from API cache
|
||||
const MODEL_DEFAULTS: Record<string, Partial<ModelInfo>> = {
|
||||
"minimax/minimax-m2": {
|
||||
defaultToolProtocol: "native",
|
||||
},
|
||||
"anthropic/claude-haiku-4.5": {
|
||||
defaultToolProtocol: "native",
|
||||
},
|
||||
}
|
||||
|
||||
// Extend OpenAI's CompletionUsage to include Roo specific fields
|
||||
interface RooUsage extends OpenAI.CompletionUsage {
|
||||
cache_creation_input_tokens?: number
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue