Feature/memory redis (#151)
* [feature]Emotional memory cache * [feature]Implicit memory cache * [changes]Modify the expiration time of implicit memory to 24 hours. * [feature]Emotional memory cache * [feature]Implicit memory cache * [changes]Modify the expiration time of implicit memory to 24 hours. * [changes]Modify the code based on the AI review * [feature]Emotional memory cache * [feature]Implicit memory cache * [changes]Modify the expiration time of implicit memory to 24 hours. * [feature]Implicit memory cache * [changes]Modify the code based on the AI review
This commit is contained in:
@@ -27,8 +27,6 @@ from .tool_model import (
|
||||
ToolExecution, ToolType, ToolStatus, AuthType, ExecutionStatus
|
||||
)
|
||||
from .memory_perceptual_model import MemoryPerceptualModel
|
||||
from .emotion_suggestions_cache_model import EmotionSuggestionsCache
|
||||
from .implicit_memory_cache_model import ImplicitMemoryCache
|
||||
|
||||
__all__ = [
|
||||
"Tenants",
|
||||
@@ -79,6 +77,4 @@ __all__ = [
|
||||
"AuthType",
|
||||
"ExecutionStatus",
|
||||
"MemoryPerceptualModel",
|
||||
"EmotionSuggestionsCache",
|
||||
"ImplicitMemoryCache"
|
||||
]
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
"""情绪建议缓存模型"""
|
||||
|
||||
import uuid
|
||||
import datetime
|
||||
from sqlalchemy import Column, String, Text, Integer, DateTime, JSON
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from app.db import Base
|
||||
|
||||
|
||||
class EmotionSuggestionsCache(Base):
|
||||
"""情绪建议缓存表
|
||||
|
||||
用于缓存个性化情绪建议,减少 LLM 调用成本,提升响应速度。
|
||||
"""
|
||||
__tablename__ = "emotion_suggestions_cache"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, index=True)
|
||||
end_user_id = Column(String(255), nullable=False, unique=True, index=True, comment="终端用户ID(组ID)")
|
||||
health_summary = Column(Text, nullable=False, comment="健康状态摘要")
|
||||
suggestions = Column(JSON, nullable=False, comment="建议列表(JSON格式)")
|
||||
generated_at = Column(DateTime, nullable=False, default=datetime.datetime.now, comment="生成时间")
|
||||
expires_at = Column(DateTime, nullable=True, comment="过期时间")
|
||||
created_at = Column(DateTime, default=datetime.datetime.now)
|
||||
updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
|
||||
@@ -1,27 +0,0 @@
|
||||
"""隐性记忆缓存模型"""
|
||||
|
||||
import uuid
|
||||
import datetime
|
||||
from sqlalchemy import Column, String, Integer, DateTime, JSON
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from app.db import Base
|
||||
|
||||
|
||||
class ImplicitMemoryCache(Base):
|
||||
"""隐性记忆缓存表
|
||||
|
||||
用于缓存用户的完整隐性记忆画像,包括偏好标签、四维画像、兴趣领域和行为习惯。
|
||||
减少 LLM 调用成本,提升响应速度。
|
||||
"""
|
||||
__tablename__ = "implicit_memory_cache"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, index=True)
|
||||
end_user_id = Column(String(255), nullable=False, unique=True, index=True, comment="终端用户ID")
|
||||
preferences = Column(JSON, nullable=False, comment="偏好标签列表(JSON格式)")
|
||||
portrait = Column(JSON, nullable=False, comment="四维画像对象(JSON格式)")
|
||||
interest_areas = Column(JSON, nullable=False, comment="兴趣领域分布对象(JSON格式)")
|
||||
habits = Column(JSON, nullable=False, comment="行为习惯列表(JSON格式)")
|
||||
generated_at = Column(DateTime, nullable=False, default=datetime.datetime.now, comment="生成时间")
|
||||
expires_at = Column(DateTime, nullable=True, comment="过期时间")
|
||||
created_at = Column(DateTime, default=datetime.datetime.now)
|
||||
updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)
|
||||
Reference in New Issue
Block a user