feat(relationship): 重构关系信息提取系统并集成聊天流印象

- 在 RelationshipFetcher 中添加 build_chat_stream_impression 方法,支持聊天流印象信息构建
- 扩展数据库模型,为 ChatStreams 表添加聊天流印象相关字段(stream_impression_text、stream_chat_style、stream_topic_keywords、stream_interest_score)
- 为 UserRelationships 表添加用户别名和偏好关键词字段(user_aliases、preference_keywords)
- 在 DefaultReplyer、Prompt 和 S4U PromptBuilder 中集成用户关系信息和聊天流印象的组合输出
- 重构工具系统,为 BaseTool 添加 chat_stream 参数支持上下文感知
- 移除旧的 ChatterRelationshipTracker 及相关关系追踪逻辑,统一使用评分API
- 在 AffinityChatterPlugin 中添加 UserProfileTool 和 ChatStreamImpressionTool 支持
- 优化计划执行器,移除关系追踪相关代码并改进错误处理

BREAKING CHANGE: 移除了 ChatterRelationshipTracker 类及相关的关系追踪功能,现在统一使用 scoring_api 进行关系管理。BaseTool 构造函数现在需要 chat_stream 参数。
This commit is contained in:
Windpicker-owo
2025-10-30 16:58:26 +08:00
parent cfa642cf0a
commit ea7c1f22f9
17 changed files with 1264 additions and 989 deletions

View File

@@ -47,8 +47,9 @@ class BaseTool(ABC):
sub_tools: list[tuple[str, str, list[tuple[str, ToolParamType, str, bool, list[str] | None]]]] = []
"""子工具列表,格式为[(子工具名, 子工具描述, 子工具参数)]。仅在二步工具中使用"""
def __init__(self, plugin_config: dict | None = None):
def __init__(self, plugin_config: dict | None = None, chat_stream: Any = None):
self.plugin_config = plugin_config or {} # 直接存储插件配置字典
self.chat_stream = chat_stream # 存储聊天流信息,可用于获取上下文
@classmethod
def get_tool_definition(cls) -> dict[str, Any]: