修改rag,实现混合检索
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m42s

This commit is contained in:
2026-05-04 04:28:32 +08:00
parent d0590240f9
commit 82dde7113e
15 changed files with 536 additions and 65 deletions

View File

@@ -98,7 +98,7 @@ async def health_check():
class ChatRequest(BaseModel):
message: str
thread_id: str | None = None
model: str = "zhipu"
model: str = "local"
user_id: str = "default_user"
class ChatResponse(BaseModel):
@@ -212,7 +212,7 @@ async def chat_endpoint(
@app.get("/threads")
async def list_threads(
user_id: str = Query("default_user", description="用户 ID"),
limit: int = Query(50, ge=1, le=200, description="返回数量限制"),
limit: int = Query(4, ge=1, le=200, description="返回数量限制"),
history_service: ThreadHistoryService = Depends(get_history_service)
):
"""获取当前用户的对话历史列表"""
@@ -312,7 +312,7 @@ async def websocket_endpoint(
data = await websocket.receive_json()
message = data.get("message")
thread_id = data.get("thread_id", str(uuid.uuid4()))
model = data.get("model", "zhipu")
model = data.get("model", "local")
user_id = data.get("user_id", "default_user")
if not message:
await websocket.send_json({"error": "missing message"})
@@ -435,4 +435,10 @@ if __name__ == "__main__":
import uvicorn
# 使用环境变量或默认端口 8079避免与 llama.cpp 的 8081 端口冲突)
port = int(BACKEND_PORT)
uvicorn.run(app, host="0.0.0.0", port=port)
uvicorn.run(
app,
host="0.0.0.0",
port=port,
log_level="debug",
access_log=True
)