mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
Update default model
This commit is contained in:
parent
1389e6232b
commit
9d94c33a81
4 changed files with 11 additions and 5 deletions
|
|
@ -2,6 +2,9 @@
|
|||
* HuggingFace provider constants
|
||||
*/
|
||||
|
||||
export type HuggingFaceModelId = string
|
||||
export const huggingFaceDefaultModelId = "moonshotai/Kimi-K2-Instruct-0905"
|
||||
|
||||
// Default values for HuggingFace models
|
||||
export const HUGGINGFACE_DEFAULT_MAX_TOKENS = 2048
|
||||
export const HUGGINGFACE_MAX_TOKENS_FALLBACK = 8192
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { DEFAULT_HEADERS } from "./constants"
|
|||
import { BaseProvider } from "./base-provider"
|
||||
import { getHuggingFaceModels, getCachedHuggingFaceModels } from "./fetchers/huggingface"
|
||||
import { handleOpenAIError } from "./utils/openai-error-handler"
|
||||
import { huggingFaceDefaultModelId } from "@roo-code/types"
|
||||
|
||||
export class HuggingFaceHandler extends BaseProvider implements SingleCompletionHandler {
|
||||
private client: OpenAI
|
||||
|
|
@ -50,7 +51,7 @@ export class HuggingFaceHandler extends BaseProvider implements SingleCompletion
|
|||
messages: Anthropic.Messages.MessageParam[],
|
||||
metadata?: ApiHandlerCreateMessageMetadata,
|
||||
): ApiStream {
|
||||
const modelId = this.options.huggingFaceModelId || "meta-llama/Llama-3.3-70B-Instruct"
|
||||
const modelId = this.options.huggingFaceModelId || huggingFaceDefaultModelId
|
||||
const temperature = this.options.modelTemperature ?? 0.7
|
||||
|
||||
const params: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = {
|
||||
|
|
@ -94,7 +95,7 @@ export class HuggingFaceHandler extends BaseProvider implements SingleCompletion
|
|||
}
|
||||
|
||||
async completePrompt(prompt: string): Promise<string> {
|
||||
const modelId = this.options.huggingFaceModelId || "meta-llama/Llama-3.3-70B-Instruct"
|
||||
const modelId = this.options.huggingFaceModelId || huggingFaceDefaultModelId
|
||||
|
||||
try {
|
||||
const response = await this.client.chat.completions.create({
|
||||
|
|
@ -109,7 +110,7 @@ export class HuggingFaceHandler extends BaseProvider implements SingleCompletion
|
|||
}
|
||||
|
||||
override getModel() {
|
||||
const modelId = this.options.huggingFaceModelId || "meta-llama/Llama-3.3-70B-Instruct"
|
||||
const modelId = this.options.huggingFaceModelId || huggingFaceDefaultModelId
|
||||
|
||||
// Try to get model info from cache
|
||||
const modelInfo = this.modelCache?.[modelId]
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ import { WebviewMessage } from "../../shared/WebviewMessage"
|
|||
import { EMBEDDING_MODEL_PROFILES } from "../../shared/embeddingModels"
|
||||
import { ProfileValidator } from "../../shared/ProfileValidator"
|
||||
import { HUGGING_FACE_OAUTH_CLIENT_ID } from "../../shared/oauth-constants"
|
||||
import { huggingFaceDefaultModelId } from "@roo-code/types"
|
||||
|
||||
import { Terminal } from "../../integrations/terminal/Terminal"
|
||||
import { downloadTask } from "../../integrations/misc/export-markdown"
|
||||
|
|
@ -1474,7 +1475,7 @@ export class ClineProvider
|
|||
...apiConfiguration,
|
||||
apiProvider: "huggingface",
|
||||
huggingFaceApiKey: accessToken,
|
||||
huggingFaceModelId: apiConfiguration?.huggingFaceModelId || "meta-llama/Llama-3.3-70B-Instruct",
|
||||
huggingFaceModelId: apiConfiguration?.huggingFaceModelId || huggingFaceDefaultModelId,
|
||||
huggingFaceInferenceProvider: apiConfiguration?.huggingFaceInferenceProvider || "auto",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ import {
|
|||
vercelAiGatewayDefaultModelId,
|
||||
BEDROCK_CLAUDE_SONNET_4_MODEL_ID,
|
||||
deepInfraDefaultModelId,
|
||||
huggingFaceDefaultModelId,
|
||||
} from "@roo-code/types"
|
||||
|
||||
import type { ModelRecord, RouterModels } from "@roo/api"
|
||||
|
|
@ -174,7 +175,7 @@ function getSelectedModel({
|
|||
return { id, info }
|
||||
}
|
||||
case "huggingface": {
|
||||
const id = apiConfiguration.huggingFaceModelId ?? "meta-llama/Llama-3.3-70B-Instruct"
|
||||
const id = apiConfiguration.huggingFaceModelId ?? huggingFaceDefaultModelId
|
||||
const info = {
|
||||
maxTokens: 8192,
|
||||
contextWindow: 131072,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue