refactor: 移除内置USER.md — 仅从工作空间读取,不存在则不注入

This commit is contained in:
thzxx
2026-06-24 22:01:59 +08:00
parent 2348bea5c3
commit 95c23bd19f
4 changed files with 7 additions and 20 deletions
+3 -12
View File
@@ -502,28 +502,19 @@ async function handleInit(
systemPromptParts.push(`[AGENT.md] ${truncated}`);
}
// ── 扫描工作空间 USER.md ──
let userMdContent = '';
// ── 扫描工作空间 USER.md(仅工作空间,无内置 fallback)──
if (workspaceDir) {
try {
const userResult = await window.metonaDesktop?.workspace.readFile(
workspaceDir.replace(/[\\/]+$/, '') + '/USER.md'
);
if (userResult?.success && userResult.content) {
userMdContent = userResult.content;
const userMdContent = userResult.content;
systemPromptParts.push(`[USER.md] ${userMdContent}`);
logInfo('USER.md 已从工作空间加载', `${userResult.lines || 0}`);
}
} catch { /* ignore */ }
}
if (!userMdContent) {
try {
const resp = await fetch('./USER.md');
if (resp.ok) { userMdContent = await resp.text(); logInfo('USER.md 已从内置加载', `${userMdContent.length} 字符`); }
} catch { /* ignore */ }
}
if (userMdContent) {
systemPromptParts.push(`[USER.md] ${userMdContent}`);
}
// 注入记忆上下文
if (userContent) {