(ctx: SystemCommandContext)
| 234 | } |
| 235 | |
| 236 | function handleClearHistory(ctx: SystemCommandContext): any { |
| 237 | console.log('[SystemCmd] 执行清除使用记录') |
| 238 | try { |
| 239 | // 清空历史记录 |
| 240 | databaseAPI.dbPut('command-history', []) |
| 241 | |
| 242 | // 通知渲染进程刷新历史记录 |
| 243 | ctx.mainWindow?.webContents.send('history-changed') |
| 244 | |
| 245 | // 触发 app-launched 事件(隐藏窗口) |
| 246 | ctx.mainWindow?.webContents.send('app-launched') |
| 247 | ctx.mainWindow?.hide() |
| 248 | |
| 249 | console.log('[SystemCmd] 使用记录已清除') |
| 250 | return { success: true } |
| 251 | } catch (error) { |
| 252 | console.error('[SystemCmd] 清除使用记录失败:', error) |
| 253 | return { success: false, error: String(error) } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | async function handleWebSearch( |
| 258 | ctx: SystemCommandContext, |
no test coverage detected