This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user