feat: 全面补充执行日志(135处)

补日志的模块:
- vector-store.ts: 0→7(init/create/delete/add/search 全覆盖)
- rag.ts: 3→7(initVectorStore/embedBatch/removeDoc/retrieveContext)
- chat-area.ts: 2→5(3个导出函数加日志)
- history-modal.ts: 4→5(打开历史记录)
- kb-modal.ts: 7→8(打开知识库管理)
- header.ts: 5→7(运行中模型状态)
This commit is contained in:
thzxx
2026-04-07 01:47:02 +08:00
parent 60152fb443
commit 9735a1ed38
6 changed files with 26 additions and 10 deletions
+4 -1
View File
@@ -3,7 +3,7 @@
*/
import { state, KEYS } from '../state/state.js';
import { logError } from '../services/log-service.js';
import { logError, logSession } from '../services/log-service.js';
import { marked } from '../utils/marked-config.js';
import { escapeHtml, formatTime } from '../utils/utils.js';
import type { ChatSession, ChatMessage, ToolCallRecord } from '../types.js';
@@ -420,6 +420,7 @@ export async function exportAsMarkdown(session: ChatSession): Promise<void> {
if (m.think) md += `> **思考:** ${m.think}\n\n`;
});
await nativeSaveFile(`${session.title}.md`, md);
logSession('导出', `${session.title}.md`);
}
export async function exportAsHtml(session: ChatSession): Promise<void> {
@@ -435,6 +436,7 @@ code{background:rgba(0,0,0,0.2);padding:2px 6px;border-radius:4px;}</style></hea
});
html += '</body></html>';
await nativeSaveFile(`${session.title}.html`, html);
logSession('导出', `${session.title}.html`);
}
export async function exportAsTxt(session: ChatSession): Promise<void> {
@@ -443,4 +445,5 @@ export async function exportAsTxt(session: ChatSession): Promise<void> {
txt += `[${m.role === 'user' ? '用户' : 'AI'}]\n${m.content || ''}\n\n`;
});
await nativeSaveFile(`${session.title}.txt`, txt);
logSession('导出', `${session.title}.txt`);
}