Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景:全模块部署时,每次新建连接会重复初始化所有组件(如 TTS/LLM/ASR),部分网络依赖型组件(如 LLM)初始化耗时较长,导致连接响应慢。
改动:为所有核心模块(TTS/LLM/Intent/Memory/VAD/ASR)添加基于配置的缓存机制,相同配置时复用已初始化的组件实例,减少重复初始化耗时。
顾虑:缓存组件实例可能增加资源占用,并发共享时需考虑线程安全(待验证)。
后续:计划通过配置开关控制缓存启用,平衡性能与资源安全。