diff --git a/package.json b/package.json index 66adf82..8b525c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metona-ollama-desktop", - "version": "1.1.0", + "version": "0.9.0", "description": "Metona Ollama - TypeScript + Electron 桌面 AI 聊天客户端", "main": "dist/main/main.js", "author": "thzxx", @@ -48,7 +48,7 @@ "requestedExecutionLevel": "asInvoker" }, "nsis": { - "artifactName": "Metona Ollama Setup v1.1.0.${ext}", + "artifactName": "Metona Ollama Setup v0.9.0.${ext}", "oneClick": false, "allowToChangeInstallationDirectory": true, "createDesktopShortcut": true, diff --git a/src/main/menu.ts b/src/main/menu.ts index 03910d9..d66cdf5 100644 --- a/src/main/menu.ts +++ b/src/main/menu.ts @@ -101,7 +101,7 @@ export function createMenu(): void { dialog.showMessageBox(mainWindow!, { type: 'info', title: '关于 Metona Ollama', - message: 'Metona Ollama Desktop v1.1.0', + message: 'Metona Ollama Desktop v0.9.0', detail: 'TypeScript + Electron Ollama AI 聊天客户端\n\nhttps://gitee.com/thzxx/metona-ollama', icon: getIconPath() }); diff --git a/src/renderer/components/input-area.ts b/src/renderer/components/input-area.ts index 14b40a3..d59faa9 100644 --- a/src/renderer/components/input-area.ts +++ b/src/renderer/components/input-area.ts @@ -697,6 +697,7 @@ export async function sendMessage(): Promise { // ── 扫描工作空间 SOUL.md ── let soulContent = ''; + let soulMdContent = ''; const workspaceDir = getWorkspaceDirPath(); if (workspaceDir) { try { @@ -704,9 +705,44 @@ export async function sendMessage(): Promise { workspaceDir.replace(/\/+$/, '') + '/SOUL.md' ); if (soulResult?.success && soulResult.content) { - soulContent = `[SOUL.md] ${soulResult.content}`; + soulMdContent = soulResult.content; } - } catch { /* SOUL.md 不存在,静默跳过 */ } + } catch { /* 工作空间 SOUL.md 不存在 */ } + } + + // fallback:读取内置 SOUL.md + if (!soulMdContent) { + try { + const resp = await fetch('./SOUL.md'); + if (resp.ok) { + soulMdContent = await resp.text(); + } + } catch { /* 内置 SOUL.md 也不可用 */ } + } + + if (soulMdContent) { + soulContent = `[SOUL.md] ${soulMdContent}`; + } + + // ── 扫描工作空间 USER.md ── + let userMdContent = ''; + if (workspaceDir) { + try { + const userResult = await window.metonaDesktop?.workspace.readFile( + workspaceDir.replace(/\/+$/, '') + '/USER.md' + ); + if (userResult?.success && userResult.content) { + userMdContent = userResult.content; + } + } catch { /* 工作空间 USER.md 不存在 */ } + } + if (!userMdContent) { + try { + const resp = await fetch('./USER.md'); + if (resp.ok) { + userMdContent = await resp.text(); + } + } catch { /* 内置 USER.md 也不可用 */ } } // ── Agent 记忆注入 ── @@ -716,7 +752,8 @@ export async function sendMessage(): Promise { const relevantMemories = searchMemories(userMessage, 6); if (relevantMemories.length > 0) { const memoryContext = buildMemoryContext(relevantMemories); - chatParams.system = (soulContent ? soulContent + '\n\n' : '') + memoryContext; + const parts = [soulContent, userMdContent ? `[USER.md] ${userMdContent}` : '', memoryContext].filter(Boolean); + chatParams.system = parts.join('\n\n'); for (const m of relevantMemories) { await markMemoryUsed(m.id); } @@ -725,7 +762,8 @@ export async function sendMessage(): Promise { } } if (soulContent && !chatParams.system) { - chatParams.system = soulContent; + const parts = [soulContent, userMdContent ? `[USER.md] ${userMdContent}` : ''].filter(Boolean); + chatParams.system = parts.join('\n\n'); } // 存入 state 供 chat-area 渲染系统提示词卡片 diff --git a/src/renderer/index.html b/src/renderer/index.html index b24644d..df2a2b9 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -28,7 +28,7 @@
Metona Ollama - v1.1.0 + v0.9.0