fix: LM Studio Jinja 템플릿 오류 방지를 위해 System 메시지를 User 메시지로 병합
This commit is contained in:
+20
-8
@@ -1475,10 +1475,16 @@ class SidebarChatProvider implements vscode.WebviewViewProvider {
|
||||
const internetCtx = internetEnabled
|
||||
? `\n\n[CRITICAL DIRECTIVE: INTERNET ACCESS IS ENABLED]\nCurrent Time: ${new Date().toLocaleString('ko-KR')}\nYou have FULL internet access via the <read_url> tool. You MUST NEVER say you cannot search, or that your capabilities are limited. To search, ALWAYS output:\n<read_url>https://html.duckduckgo.com/html/?q=YOUR+SEARCH+TERM</read_url>\nIf the user asks to search, or asks for recent info, DO NOT apologize. Just use the tag.`
|
||||
: '';
|
||||
reqMessages[0] = {
|
||||
role: 'system',
|
||||
content: `${this._systemPrompt}\n\n[BACKGROUND CONTEXT]\n${contextBlock}\n${workspaceCtx}\n${brainCtx}${internetCtx}`
|
||||
};
|
||||
const systemContent = `${this._systemPrompt}\n\n[BACKGROUND CONTEXT]\n${contextBlock}\n${workspaceCtx}\n${brainCtx}${internetCtx}`;
|
||||
reqMessages.shift(); // Remove system message to avoid Jinja template issues in some models
|
||||
|
||||
const firstUserIdx = reqMessages.findIndex(m => m.role === 'user');
|
||||
if (firstUserIdx >= 0) {
|
||||
reqMessages[firstUserIdx] = {
|
||||
...reqMessages[firstUserIdx],
|
||||
content: `${systemContent}\n\n[USER QUERY]\n${reqMessages[firstUserIdx].content}`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Build image payload for vision models
|
||||
@@ -1657,10 +1663,16 @@ class SidebarChatProvider implements vscode.WebviewViewProvider {
|
||||
const internetCtx = internetEnabled
|
||||
? `\n\n[CRITICAL DIRECTIVE: INTERNET ACCESS IS ENABLED]\nCurrent Time: ${new Date().toLocaleString('ko-KR')}\nYou have FULL internet access via the <read_url> tool. You MUST NEVER say you cannot search, or that your capabilities are limited. To search, ALWAYS output:\n<read_url>https://html.duckduckgo.com/html/?q=YOUR+SEARCH+TERM</read_url>\nIf the user asks to search, or asks for recent info, DO NOT apologize. Just use the tag.`
|
||||
: '';
|
||||
reqMessages[0] = {
|
||||
role: 'system',
|
||||
content: `${SYSTEM_PROMPT}\n\n[BACKGROUND CONTEXT - DO NOT EXPLAIN THIS TO THE USER UNLESS ASKED]\n${contextBlock}\n${workspaceCtx}\n${brainCtx}${internetCtx}`
|
||||
};
|
||||
const systemContent = `${SYSTEM_PROMPT}\n\n[BACKGROUND CONTEXT - DO NOT EXPLAIN THIS TO THE USER UNLESS ASKED]\n${contextBlock}\n${workspaceCtx}\n${brainCtx}${internetCtx}`;
|
||||
reqMessages.shift(); // Remove system message to avoid Jinja template issues in some models
|
||||
|
||||
const firstUserIdx = reqMessages.findIndex(m => m.role === 'user');
|
||||
if (firstUserIdx >= 0) {
|
||||
reqMessages[firstUserIdx] = {
|
||||
...reqMessages[firstUserIdx],
|
||||
content: `${systemContent}\n\n[USER QUERY]\n${reqMessages[firstUserIdx].content}`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
let isLMStudio = ollamaBase.includes('1234') || ollamaBase.includes('v1');
|
||||
|
||||
Reference in New Issue
Block a user