每次 openNodeAIChat / closeNodeAIHelper / startNodeAILoading / cancelNodeAILoading 都会 push 一条;用户多次开关就会持续增长,并且 aiHistory 还跟随 aiNodesStatus 全量发布事件,造成不必要的复制。
建议:要么限制最近 N 条(环形缓冲),要么把 history 改为 WeakMap/独立模块;并明确这块状态是否需要随 schema 持久化(看起来不需要)。
Originally posted by @chilingling in #1800 (comment)
每次 openNodeAIChat / closeNodeAIHelper / startNodeAILoading / cancelNodeAILoading 都会 push 一条;用户多次开关就会持续增长,并且 aiHistory 还跟随 aiNodesStatus 全量发布事件,造成不必要的复制。
建议:要么限制最近 N 条(环形缓冲),要么把 history 改为 WeakMap/独立模块;并明确这块状态是否需要随 schema 持久化(看起来不需要)。
Originally posted by @chilingling in #1800 (comment)