()
| 211 | |
| 212 | // 注册IPC处理器 |
| 213 | export function setupImageAnalysisAPI(): void { |
| 214 | ipcMain.handle('analyze-image', async (_event, imagePath: string) => { |
| 215 | try { |
| 216 | return await analyzeImage(imagePath) |
| 217 | } catch (error) { |
| 218 | console.error('[ImageAnalysis] 图片分析失败:', error) |
| 219 | return { isSimpleIcon: false, mainColor: null, isDark: false, needsAdaptation: false } |
| 220 | } |
| 221 | }) |
| 222 | } |