const fs = require('fs') const base = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/' function patch(file, pairs) { const p = base + file let c = fs.readFileSync(p, 'utf8') for (const [from, to] of pairs) { if (!c.includes(from)) { console.log('MISS in', file, '::', from.slice(0, 70).replace(/\n/g, '\\n')) continue } c = c.replace(from, to) } fs.writeFileSync(p, c, 'utf8') } // main:对话条展开为更高窗口,好让预设列表可见 patch('main/index.ts', [ [ `function createChatBar(): void {`, `let chatExpanded = false function createChatBar(): void {` ], [ ` x: Math.round(b.x + b.width / 2 - 210), y: Math.max(0, b.y - 118), width: 420, height: 54,`, ` x: Math.round(b.x + b.width / 2 - 210), y: Math.max(0, b.y - 118) + 54 - (chatExpanded ? 250 : 54), width: 420, height: chatExpanded ? 250 : 54,` ], [ ` ipcMain.on('pet:menu:toggle', () => toggleMenu())`, ` ipcMain.on('pet:menu:toggle', () => toggleMenu()) ipcMain.on('pet:chat:expand', (_e, open: boolean) => { chatExpanded = Boolean(open) positionChatBar() })` ] ]) // preload / api patch('preload/index.ts', [ [ " openDetail: () => void", " openDetail: () => void\n setChatExpanded: (open: boolean) => void" ], [ " openDetail: () => ipcRenderer.send('pet:detail:open'),", " openDetail: () => ipcRenderer.send('pet:detail:open'),\n setChatExpanded: (open: boolean) => ipcRenderer.send('pet:chat:expand', open)," ] ]) patch('renderer/src/api.ts', [ [ " openDetail: () => void", " openDetail: () => void\n setChatExpanded: (open: boolean) => void" ] ]) // ChatBar:切换展开 patch('renderer/src/chat/ChatBar.tsx', [ [ `