This commit is contained in:
雅诺狐
2025-12-08 15:48:40 +08:00
parent 084192843b
commit 3edcc9d169
137 changed files with 2194 additions and 2237 deletions

View File

@@ -651,7 +651,7 @@ class UserPermissions(Base):
class UserRelationships(Base):
"""用户关系模型 - 存储用户与bot的关系数据
核心字段:
- relationship_text: 当前印象描述(用于兼容旧系统,逐步迁移到 impression_text
- impression_text: 长期印象(新字段,自然叙事风格)
@@ -667,19 +667,19 @@ class UserRelationships(Base):
user_id: Mapped[str] = mapped_column(get_string_field(100), nullable=False, unique=True, index=True)
user_name: Mapped[str | None] = mapped_column(get_string_field(100), nullable=True)
user_aliases: Mapped[str | None] = mapped_column(Text, nullable=True) # 用户别名,逗号分隔
# 印象相关(新旧兼容)
relationship_text: Mapped[str | None] = mapped_column(Text, nullable=True) # 旧字段,保持兼容
impression_text: Mapped[str | None] = mapped_column(Text, nullable=True) # 新字段:长期印象(自然叙事)
# 用户信息
preference_keywords: Mapped[str | None] = mapped_column(Text, nullable=True) # 用户偏好关键词,逗号分隔
key_facts: Mapped[str | None] = mapped_column(Text, nullable=True) # 关键信息JSON生日、职业等
# 关系状态
relationship_score: Mapped[float] = mapped_column(Float, nullable=False, default=0.3) # 好感度(0-1)
relationship_stage: Mapped[str | None] = mapped_column(get_string_field(50), nullable=True, default="stranger") # 关系阶段
# 时间记录
first_met_time: Mapped[float | None] = mapped_column(Float, nullable=True) # 首次认识时间戳
last_impression_update: Mapped[float | None] = mapped_column(Float, nullable=True) # 上次更新印象时间