From 8e3b413fdd282669fc3f5adb8e75f4b3c6a9dcf7 Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Wed, 30 Jul 2025 16:27:28 +0800 Subject: [PATCH] Fix Default Model Configuration and Fallback Behavior (#142) * rename the default model to 'qwen3-coder-plus' * fix: use DEFAULT_GEMINI_MODEL fallback when OPENAI_MODEL is unset * fix: npm run format --- packages/core/src/config/models.ts | 2 +- packages/core/src/core/contentGenerator.ts | 3 ++- packages/core/src/core/prompts.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/core/src/config/models.ts b/packages/core/src/config/models.ts index 7ed14f9f..a9e5f745 100644 --- a/packages/core/src/config/models.ts +++ b/packages/core/src/config/models.ts @@ -4,6 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -export const DEFAULT_GEMINI_MODEL = 'qwen3-coder-max'; +export const DEFAULT_GEMINI_MODEL = 'qwen3-coder-plus'; export const DEFAULT_GEMINI_FLASH_MODEL = 'gemini-2.5-flash'; export const DEFAULT_GEMINI_EMBEDDING_MODEL = 'gemini-embedding-001'; diff --git a/packages/core/src/core/contentGenerator.ts b/packages/core/src/core/contentGenerator.ts index ab658c5b..be1fe54a 100644 --- a/packages/core/src/core/contentGenerator.ts +++ b/packages/core/src/core/contentGenerator.ts @@ -116,7 +116,8 @@ export async function createContentGeneratorConfig( if (authType === AuthType.USE_OPENAI && openaiApiKey) { contentGeneratorConfig.apiKey = openaiApiKey; - contentGeneratorConfig.model = process.env.OPENAI_MODEL || ''; + contentGeneratorConfig.model = + process.env.OPENAI_MODEL || DEFAULT_GEMINI_MODEL; return contentGeneratorConfig; } diff --git a/packages/core/src/core/prompts.ts b/packages/core/src/core/prompts.ts index e30d23a6..d37ad9f5 100644 --- a/packages/core/src/core/prompts.ts +++ b/packages/core/src/core/prompts.ts @@ -17,6 +17,7 @@ import { WriteFileTool } from '../tools/write-file.js'; import process from 'node:process'; import { isGitRepository } from '../utils/gitUtils.js'; import { MemoryTool, GEMINI_CONFIG_DIR } from '../tools/memoryTool.js'; +import { DEFAULT_GEMINI_MODEL } from '../config/models.js'; export interface ModelTemplateMapping { baseUrls?: string[]; @@ -65,7 +66,7 @@ export function getCoreSystemPrompt( // Check for system prompt mappings from global config if (config?.systemPromptMappings) { - const currentModel = process.env.OPENAI_MODEL || ''; + const currentModel = process.env.OPENAI_MODEL || DEFAULT_GEMINI_MODEL; const currentBaseUrl = process.env.OPENAI_BASE_URL || ''; const matchedMapping = config.systemPromptMappings.find((mapping) => {