init: RAG 知识库服务初始提交
- 后端 API(Flask + Gunicorn) - RAG 引擎(混合检索 + 云端 Reranker + 引用溯源) - 文档解析(MinerU + 多格式支持) - Docker 生产部署配置 - 排除前端项目、敏感配置、模型文件
This commit is contained in:
28
repositories/stateless_session_repo.py
Normal file
28
repositories/stateless_session_repo.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
无状态会话存储实现(生产环境)
|
||||
|
||||
生产环境不存储会话数据,历史由后端传入。
|
||||
"""
|
||||
|
||||
from .session_repo import BaseSessionRepo
|
||||
from typing import List, Dict, Optional
|
||||
|
||||
|
||||
class StatelessSessionRepo(BaseSessionRepo):
|
||||
"""生产环境:无状态,不存储"""
|
||||
|
||||
def get_history(self, session_id: str) -> List[Dict]:
|
||||
"""生产环境:历史由后端传入,不查询"""
|
||||
return []
|
||||
|
||||
def add_message(self, session_id: str, role: str, content: str, metadata: Optional[Dict] = None) -> None:
|
||||
"""生产环境:不存储消息"""
|
||||
pass
|
||||
|
||||
def create_session(self, user_id: str, title: str = "新对话") -> str:
|
||||
"""生产环境:不创建会话,返回占位符"""
|
||||
return "stateless"
|
||||
|
||||
def get_user_sessions(self, user_id: str) -> List[Dict]:
|
||||
"""生产环境:会话列表由后端管理"""
|
||||
return []
|
||||
Reference in New Issue
Block a user