diff --git a/src/renderer/components/chat-area.ts b/src/renderer/components/chat-area.ts index 56d02ec..46fef38 100644 --- a/src/renderer/components/chat-area.ts +++ b/src/renderer/components/chat-area.ts @@ -373,10 +373,6 @@ export function appendSystemMessage(text: string, tempClass?: string): void { scrollToBottom(); } -export function getMessagesContainer(): HTMLElement { - return messagesContainerEl; -} - export function clearMessages(): void { messagesContainerEl.innerHTML = ''; currentPlaceholder = null; diff --git a/src/renderer/main.ts b/src/renderer/main.ts index 40cfe11..1225d41 100644 --- a/src/renderer/main.ts +++ b/src/renderer/main.ts @@ -43,7 +43,7 @@ function initHelpModal(): void { } function setupDesktopIntegration(): void { - const bridge = window.__metonaBridge; + const bridge = window.metonaDesktop; if (!bridge || !bridge.isDesktop) { logDebug('非桌面环境,跳过桌面集成'); return; diff --git a/src/renderer/services/document-processor.ts b/src/renderer/services/document-processor.ts index 81ac8a3..ac24e85 100644 --- a/src/renderer/services/document-processor.ts +++ b/src/renderer/services/document-processor.ts @@ -58,10 +58,6 @@ function splitSentences(text: string): string[] { return parts.filter(p => p.trim()).map(p => p.trim() + ' '); } -export function extractDocument(content: string, filename: string): { text: string; filename: string } { - return { text: content, filename }; -} - export function createChunkMetadata(chunk: string, index: number, docId: string, filename: string) { return { id: `${docId}_chunk_${index}`, diff --git a/src/renderer/services/log-service.ts b/src/renderer/services/log-service.ts index 6456c27..e14aa47 100644 --- a/src/renderer/services/log-service.ts +++ b/src/renderer/services/log-service.ts @@ -183,5 +183,4 @@ export function logSession(action: string, detail?: string): void { addLog('info export function logMemory(action: string, detail?: string): void { addLog('debug', `记忆: ${action}`, detail); } export function logRAG(action: string, detail?: string): void { addLog('info', `RAG: ${action}`, detail); } export function logSetting(key: string, value: string): void { addLog('debug', `设置: ${key}`, value); } -export function logIPC(action: string, detail?: string): void { addLog('debug', `IPC: ${action}`, detail); } export function logInit(msg: string): void { addLog('info', `初始化: ${msg}`); } diff --git a/src/renderer/types.d.ts b/src/renderer/types.d.ts index 1e1536f..5cc31b1 100644 --- a/src/renderer/types.d.ts +++ b/src/renderer/types.d.ts @@ -234,25 +234,6 @@ export interface SaveFileOptions { filters?: Array<{ name: string; extensions: string[] }>; } -// ── 桌面 Bridge 接口 ── - -export interface DesktopBridge { - isDesktop: boolean; - getInfo: () => Promise<{ platform: string; version: string; arch?: string; electronVersion?: string; userDataPath?: string }>; - openFile: (filters?: Array<{ name: string; extensions: string[] }>) => Promise; - saveFile: (options?: SaveFileOptions) => Promise; - readFile: (filePath: string) => Promise<{ success: boolean; content?: string; name?: string; error?: string }>; - writeFile: (filePath: string, content: string) => Promise<{ success: boolean; error?: string }>; - notify: (title: string, body: string) => void; - minimize: () => void; - maximize: () => void; - close: () => void; - openExternal: (url: string) => void; - onMenuAction: (callback: (action: string) => void) => void; - onTrayAction: (callback: (action: string) => void) => void; - off: (channel: string) => void; -} - // ── State Keys ── export type StateKey = @@ -333,7 +314,6 @@ export type AgentState = 'idle' | 'sending' | 'accumulating' | 'executing' | 'co declare global { interface Window { metonaDesktop?: MetonaDesktopAPI; - __metonaBridge?: DesktopBridge; } } diff --git a/src/renderer/utils/sanitizer.ts b/src/renderer/utils/sanitizer.ts index cf51362..e5fa47c 100644 --- a/src/renderer/utils/sanitizer.ts +++ b/src/renderer/utils/sanitizer.ts @@ -3,7 +3,7 @@ */ export const SAFE_URI_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:', 'ftp:', 'ftps:', 'xmpp:']); -export const SAFE_DATA_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/svg+xml']); +const SAFE_DATA_TYPES = new Set(['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/svg+xml']); const ALLOWED_TAGS = new Set([ 'a', 'abbr', 'b', 'blockquote', 'br', 'code', 'del', 'details', 'div', diff --git a/vite.config.ts b/vite.config.ts index 1a1f803..00b683a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -14,7 +14,4 @@ export default defineConfig({ css: { preprocessorOptions: {}, }, - server: { - port: 5173, - }, });