- Added `auth.py` for mock login and JWT issuance. - Introduced `chat.py` for handling chat requests with role-based access control. - Enhanced `main.py` to include new routers and middleware for tracing. - Implemented input validation in `input_guard.py` to prevent SQL injection. - Created repositories for managing agent sessions and audit logs. - Added exception handling for authorization errors. - Updated settings to include JWT configuration. - Introduced tests for authentication and input validation.
14 lines
386 B
Python
14 lines
386 B
Python
"""会话短期记忆薄封装(Wave 0:接口占位,后续接 Redis)。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.model.schemas import AuthContext
|
|
|
|
|
|
class MemoryService:
|
|
def session_key(self, session_id: str) -> str:
|
|
return f"session:{session_id}:messages"
|
|
|
|
def touch_session(self, ctx: AuthContext, session_id: str) -> None:
|
|
_ = (ctx, session_id)
|