mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
fix(electron): offload chart plugin compute to worker
This commit is contained in:
1 parent
d96299b16e
commit
eea1dad907
5 files changed
+32
-2
No files matched your search
@@ -78,6 +78,13 @@ export const chatApi = {
|
||||
): Promise<{ success: boolean; newMessageCount: number; error?: string }> =>
|
||||
ipcRenderer.invoke('chat:incrementalImport', sessionId, filePath),
|
||||
|
||||
/**
|
||||
* 图表插件计算会处理大量消息数组,Electron 下必须卸载到 worker,
|
||||
* 避免 renderer 主线程同步执行造成窗口卡顿。
|
||||
*/
|
||||
pluginCompute: <T = unknown>(fnString: string, input: unknown): Promise<T> =>
|
||||
ipcRenderer.invoke('chat:pluginCompute', fnString, input),
|
||||
|
||||
// ==================== Demo ====================
|
||||
|
||||
importDemo: (
|
||||
|
||||
Reference in new issue
Block a user