Merge pull request #760 from Jasonzhu1207/main

feat:AI见解支持结合社交媒体平台消息以进行综合分析
This commit is contained in:
cc
2026-04-14 23:03:49 +08:00
committed by GitHub
9 changed files with 1155 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
import './preload-env'
import './preload-env'
import { app, BrowserWindow, ipcMain, nativeTheme, session, Tray, Menu, nativeImage } from 'electron'
import { Worker } from 'worker_threads'
import { randomUUID } from 'crypto'
@@ -31,6 +31,7 @@ import { destroyNotificationWindow, registerNotificationHandlers, showNotificati
import { httpService } from './services/httpService'
import { messagePushService } from './services/messagePushService'
import { insightService } from './services/insightService'
import { normalizeWeiboCookieInput, weiboService } from './services/social/weiboService'
import { bizService } from './services/bizService'
// 配置自动更新
@@ -1660,6 +1661,32 @@ function registerIpcHandlers() {
return insightService.generateFootprintInsight(payload)
})
ipcMain.handle('social:saveWeiboCookie', async (_, rawInput: string) => {
try {
if (!configService) {
return { success: false, error: 'Config service is not initialized' }
}
const normalized = normalizeWeiboCookieInput(rawInput)
configService.set('aiInsightWeiboCookie' as any, normalized as any)
weiboService.clearCache()
return { success: true, normalized, hasCookie: Boolean(normalized) }
} catch (error) {
return { success: false, error: (error as Error).message || 'Failed to save Weibo cookie' }
}
})
ipcMain.handle('social:validateWeiboUid', async (_, uid: string) => {
try {
if (!configService) {
return { success: false, error: 'Config service is not initialized' }
}
const cookie = String(configService.get('aiInsightWeiboCookie' as any) || '')
return await weiboService.validateUid(uid, cookie)
} catch (error) {
return { success: false, error: (error as Error).message || 'Failed to validate Weibo UID' }
}
})
ipcMain.handle('config:clear', async () => {
if (isLaunchAtStartupSupported() && getSystemLaunchAtStartup()) {
const result = setSystemLaunchAtStartup(false)
@@ -3790,3 +3817,7 @@ app.on('window-all-closed', () => {
app.quit()
}
})