Merge pull request #653 from Jasonzhu1207/feature/ai-insight

Feature:增加AI见解功能
This commit is contained in:
cc
2026-04-07 22:21:42 +08:00
committed by GitHub
6 changed files with 1745 additions and 18 deletions

View File

@@ -30,6 +30,7 @@ import { cloudControlService } from './services/cloudControlService'
import { destroyNotificationWindow, registerNotificationHandlers, showNotification, setNotificationNavigateHandler } from './windows/notificationWindow'
import { httpService } from './services/httpService'
import { messagePushService } from './services/messagePushService'
import { insightService } from './services/insightService'
import { bizService } from './services/bizService'
// 配置自动更新
@@ -1621,6 +1622,19 @@ function registerIpcHandlers() {
return result
})
// AI 见解
ipcMain.handle('insight:testConnection', async () => {
return insightService.testConnection()
})
ipcMain.handle('insight:getTodayStats', async () => {
return insightService.getTodayStats()
})
ipcMain.handle('insight:triggerTest', async () => {
return insightService.triggerTest()
})
ipcMain.handle('config:clear', async () => {
if (isLaunchAtStartupSupported() && getSystemLaunchAtStartup()) {
const result = setSystemLaunchAtStartup(false)
@@ -3485,8 +3499,10 @@ app.whenReady().then(async () => {
registerIpcHandlers()
chatService.addDbMonitorListener((type, json) => {
messagePushService.handleDbMonitorChange(type, json)
insightService.handleDbMonitorChange(type, json)
})
messagePushService.start()
insightService.start()
await delay(200)
// 检查配置状态
@@ -3607,6 +3623,7 @@ app.on('before-quit', async () => {
if (tray) { try { tray.destroy() } catch {} tray = null }
// 通知窗使用 hide 而非 close退出时主动销毁避免残留窗口阻塞进程退出。
destroyNotificationWindow()
insightService.stop()
// 兜底5秒后强制退出防止某个异步任务卡住导致进程残留
const forceExitTimer = setTimeout(() => {
console.warn('[App] Force exit after timeout')