feat(multimodel): support multimodal memory display and improve code style

This commit is contained in:
Eternity
2026-03-13 13:33:58 +08:00
parent cbc8714414
commit b71bc1f875
31 changed files with 877 additions and 543 deletions

View File

@@ -2,7 +2,7 @@ import uuid
from datetime import datetime
from typing import List, Tuple, Optional
from sqlalchemy import and_, desc
from sqlalchemy import and_, desc, select
from sqlalchemy.orm import Session
from app.core.logging_config import get_db_logger
@@ -127,6 +127,17 @@ class MemoryPerceptualRepository:
db_logger.error(f"Failed to query perceptual memory timeline: end_user_id={end_user_id} - {str(e)}")
raise
def get_by_url(
self,
file_url: str
) -> list[MemoryPerceptualModel]:
try:
stmt = select(MemoryPerceptualModel).where(MemoryPerceptualModel.file_path == file_url)
return list(self.db.execute(stmt).scalars())
except Exception:
db_logger.error(f"Failed to query perceptual memories by file_url: file_url={file_url}")
raise
def get_by_type(
self,
end_user_id: uuid.UUID,