feat: add cached homepage information and manual AI interpretations

This commit is contained in:
yuxuanhui
2026-09-12 01:55:24 +08:00
parent 394438e753
commit d9fbaa7cf7
19 changed files with 1674 additions and 18 deletions
+21
View File
@@ -572,3 +572,24 @@ class MCPAudit(Base):
result_code: Mapped[str] = mapped_column(String(60))
elapsed_ms: Mapped[int] = mapped_column(Integer)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now, index=True)
class HomeInformation(Base):
"""Account-scoped last successful source and manually generated interpretation."""
__tablename__ = "home_information"
user_id: Mapped[str] = mapped_column(String(100), primary_key=True)
resource: Mapped[str] = mapped_column(String(200), primary_key=True)
content: Mapped[dict | None] = mapped_column(JSON)
version: Mapped[str | None] = mapped_column(String(64))
fetched_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
error: Mapped[str | None] = mapped_column(Text)
analysis: Mapped[dict | None] = mapped_column(JSON)
class HomeRankHistory(Base):
__tablename__ = "home_rank_history"
id: Mapped[str] = mapped_column(String(36), primary_key=True)
user_id: Mapped[str] = mapped_column(String(100), index=True)
scope: Mapped[str] = mapped_column(String(200))
rank: Mapped[int] = mapped_column(Integer)
fetched_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)