fix: Brain token overflow size (v1.0.17)

This commit is contained in:
Jay
2026-04-13 13:45:07 +09:00
parent 9551f28977
commit 5d101bb9f3
2 changed files with 14 additions and 3 deletions
+13 -2
View File
@@ -361,10 +361,21 @@ class SidebarChatProvider implements vscode.WebviewViewProvider {
};
const files = findFilesRecursive(brainDir);
let currentLen = 0;
const MAX_BRAIN_CHARS = 15000;
for (const file of files) {
if (currentLen > MAX_BRAIN_CHARS) break;
const content = fs.readFileSync(file, 'utf-8');
// 컨텍스트 크기 제한 방지 (각 파일당 최대 3000자 반영)
combined += `\n--- [User Knowledge Base: ${path.basename(file)}] ---\n${content.slice(0, 3000)}\n`;
// 각 파일당 최대 3000자 반영
const snippet = `\n--- [User Knowledge Base: ${path.basename(file)}] ---\n${content.slice(0, 3000)}\n`;
combined += snippet;
currentLen += snippet.length;
}
if (combined.length > MAX_BRAIN_CHARS) {
combined = combined.slice(0, MAX_BRAIN_CHARS) + '\n... (일부 지식만 로드됨 - 컨텍스트 용량 제한)';
}
} catch (e) {
console.error('Brain read error', e);