feat: update system prompt for qwen3-coder

This commit is contained in:
pomelo-nwu
2025-07-24 22:29:15 +08:00
parent b8e2891f3b
commit 09bafda05b

View File

@@ -34,6 +34,15 @@ export function getCoreSystemPrompt(userMemory?: string): string {
throw new Error(`missing system prompt file '${systemMdPath}'`); throw new Error(`missing system prompt file '${systemMdPath}'`);
} }
} }
if (
process.env.OPENAI_MODEL?.startsWith('qwen3') &&
process.env.OPENAI_BASE_URL?.includes('dashscope')
) {
const sandbox =
process.env.SANDBOX === 'sandbox-exec' ? 'sandbox-exec' : '';
return `SYSTEM_TEMPLATE:{"name":"qwen3_coder","params":{"is_git_repository":${isGitRepository(process.cwd())},"sandbox":"${sandbox}"}}`;
}
const basePrompt = systemMdEnabled const basePrompt = systemMdEnabled
? fs.readFileSync(systemMdPath, 'utf8') ? fs.readFileSync(systemMdPath, 'utf8')
: ` : `
@@ -256,6 +265,7 @@ Your core function is efficient and safe assistance. Balance extreme conciseness
`.trim(); `.trim();
// if GEMINI_WRITE_SYSTEM_MD is set (and not 0|false), write base system prompt to file // if GEMINI_WRITE_SYSTEM_MD is set (and not 0|false), write base system prompt to file
const writeSystemMdVar = process.env.GEMINI_WRITE_SYSTEM_MD?.toLowerCase(); const writeSystemMdVar = process.env.GEMINI_WRITE_SYSTEM_MD?.toLowerCase();
if (writeSystemMdVar && !['0', 'false'].includes(writeSystemMdVar)) { if (writeSystemMdVar && !['0', 'false'].includes(writeSystemMdVar)) {
if (['1', 'true'].includes(writeSystemMdVar)) { if (['1', 'true'].includes(writeSystemMdVar)) {