feat: 增强插件管理和连接稳定性,添加会话令牌重置和组件清理功能
This commit is contained in:
@@ -93,6 +93,14 @@ class ComponentRegistry:
|
||||
comp = RegisteredComponent(name, component_type, plugin_id, metadata)
|
||||
if comp.full_name in self._components:
|
||||
logger.warning(f"组件 {comp.full_name} 已存在,覆盖")
|
||||
# 从 _by_plugin 列表中移除旧条目,防止幽灵组件堆积
|
||||
old_comp = self._components[comp.full_name]
|
||||
old_list = self._by_plugin.get(old_comp.plugin_id)
|
||||
if old_list is not None:
|
||||
try:
|
||||
old_list.remove(old_comp)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
self._components[comp.full_name] = comp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user