feat: 实现用户画像、占卜历史与后端用户管理模块
This commit is contained in:
@@ -7,7 +7,7 @@ from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from schemas.agent.ui_schema import UiSchemaRenderer
|
||||
from schemas.domain.divination import DerivedDivinationData
|
||||
|
||||
|
||||
class AgentRepositoryLike(Protocol):
|
||||
@@ -31,6 +31,14 @@ class AgentRepositoryLike(Protocol):
|
||||
|
||||
async def get_latest_session_id_for_user(self, *, user_id: str) -> str | None: ...
|
||||
|
||||
async def get_latest_assistant_messages_by_user_sessions(
|
||||
self,
|
||||
*,
|
||||
user_id: str,
|
||||
visibility_mask: int | None = None,
|
||||
session_limit: int = 50,
|
||||
) -> list[dict[str, object]]: ...
|
||||
|
||||
async def persist_user_message(
|
||||
self,
|
||||
*,
|
||||
@@ -187,13 +195,31 @@ class HistoryMessage(BaseModel):
|
||||
default_factory=list,
|
||||
description="Temporary signed URLs for user-attached images",
|
||||
)
|
||||
ui_schema: UiSchemaRenderer | None = Field(
|
||||
|
||||
agent_output: HistoryAgentOutput | None = Field(
|
||||
default=None,
|
||||
description="Compiled UI schema from worker ui_hints for frontend rendering",
|
||||
description="Structured assistant output for history replay",
|
||||
)
|
||||
timestamp: str = Field(description="Message creation timestamp in ISO-8601 format")
|
||||
|
||||
|
||||
class HistoryAgentOutput(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
status: Literal["success", "failed"] | None = None
|
||||
sign_level: Literal["上上签", "中上签", "中下签", "下下签"] | None = None
|
||||
summary: str | None = None
|
||||
conclusion: list[str] = Field(default_factory=list)
|
||||
focus_points: list[str] = Field(default_factory=list)
|
||||
advice: list[str] = Field(default_factory=list)
|
||||
keywords: list[str] = Field(default_factory=list)
|
||||
answer: str | None = None
|
||||
key_points: list[str] = Field(default_factory=list)
|
||||
result_type: str | None = None
|
||||
suggested_actions: list[str] = Field(default_factory=list)
|
||||
divination_derived: DerivedDivinationData | None = None
|
||||
|
||||
|
||||
class HistorySnapshotResponse(BaseModel):
|
||||
"""Response schema for GET /api/v1/agent/history"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user