Feature/memory perceptual (#48)

* perf(workflow): pass JSON data to HTTP node as a string

* perf(prompt_opt): simplify log output

* feat(memory): add perceptual memory page API and related database schema

* perf(log): clean up API exception log output

* perf(memory): simplify perceptual memory timeline response by removing metadata
This commit is contained in:
Eternity
2026-01-07 16:00:22 +08:00
committed by GitHub
parent 957f8f83ff
commit c52b360068
8 changed files with 758 additions and 4 deletions

View File

@@ -0,0 +1,40 @@
import datetime
import uuid
from enum import IntEnum
from sqlalchemy import Column, ForeignKey, Integer, DateTime, String
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.dialects.postgresql import JSONB
from app.db import Base
class PerceptualType(IntEnum):
VISION = 1
AUDIO = 2
TEXT = 3
CONVERSATION = 4
class FileStorageType(IntEnum):
LOCAL = 1
REMOTE = 2
class MemoryPerceptualModel(Base):
__tablename__ = "memory_perceptual"
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
end_user_id = Column(UUID(as_uuid=True), ForeignKey("end_users.id"), index=True)
perceptual_type = Column(Integer, index=True, nullable=False, comment="感知类型")
storage_service = Column(Integer, default=0, comment="存储服务类型")
file_path = Column(String, nullable=False, comment="文件路径")
file_name = Column(String, nullable=False, comment="文件名称")
file_ext = Column(String, nullable=False, comment="文件后缀名")
summary = Column(String, comment="摘要")
meta_data = Column(JSONB, comment="元信息")
created_time = Column(DateTime, default=datetime.datetime.now, comment="创建时间")