chore: 清除所有 console.log,主进程日志接入执行日志面板
This commit is contained in:
@@ -26,7 +26,7 @@ import { setToolEnabled } from './services/tool-registry.js';
|
||||
import { initToolConfirmModal } from './components/tool-confirm-modal.js';
|
||||
import { initMemoryPanel } from './components/memory-panel.js';
|
||||
import { initWorkspacePanel } from './components/workspace-panel.js';
|
||||
import { initLogPanel } from './services/log-service.js';
|
||||
import { initLogPanel, addLog } from './services/log-service.js';
|
||||
import { logInfo, logSuccess, logError, logDebug, logInit, logWarn } from './services/log-service.js';
|
||||
import type { ChatSession } from './types.js';
|
||||
|
||||
@@ -78,6 +78,11 @@ function setupDesktopIntegration(): void {
|
||||
}
|
||||
}) as EventListener);
|
||||
|
||||
// 主进程日志转发到日志面板
|
||||
bridge.onMainLog((data: { level: string; message: string; detail?: string }) => {
|
||||
addLog(data.level as any, data.message, data.detail);
|
||||
});
|
||||
|
||||
// 退出时释放显存
|
||||
bridge.onAppQuit(() => {
|
||||
const api = state.get<OllamaAPI | null>(KEYS.API);
|
||||
|
||||
Vendored
+1
@@ -229,6 +229,7 @@ export interface MetonaDesktopAPI {
|
||||
onTrayAction: (callback: (action: string) => void) => void;
|
||||
onAppQuit: (callback: () => void) => void;
|
||||
removeAllListeners: (channel: string) => void;
|
||||
onMainLog: (callback: (data: { level: string; message: string; detail?: string }) => void) => void;
|
||||
workspace: {
|
||||
getDir: () => Promise<{ dir: string; defaultDir: string }>;
|
||||
setDir: (dir: string) => Promise<{ success: boolean; dir?: string; error?: string }>;
|
||||
|
||||
Reference in New Issue
Block a user