From 1b7a6781e7af5fa0368d44331494109eecf0774d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=9C=A8=E5=9D=A4?= Date: Sun, 18 Jan 2026 15:57:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E4=B8=BB?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=92=8C=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在主应用中注册认证路由 - 更新requirements.txt添加认证相关依赖(jose, passlib, bcrypt) --- api/main.py | 3 ++- api/requirements.txt | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/api/main.py b/api/main.py index cff24ec..e7cf4ee 100644 --- a/api/main.py +++ b/api/main.py @@ -11,7 +11,7 @@ from fastapi.middleware.cors import CORSMiddleware load_dotenv() from database import init_db -from routers import websocket, chapters, books, conversations +from routers import websocket, chapters, books, conversations, auth # 初始化数据库 init_db() @@ -28,6 +28,7 @@ app.add_middleware( ) # 注册路由 +app.include_router(auth.router) # 认证路由(放在最前面) app.websocket("/ws/conversation/{conversation_id}")(websocket.websocket_endpoint) app.include_router(conversations.router) app.include_router(chapters.router) diff --git a/api/requirements.txt b/api/requirements.txt index 5add0e5..73ae30e 100644 --- a/api/requirements.txt +++ b/api/requirements.txt @@ -2,13 +2,11 @@ fastapi==0.115.0 uvicorn[standard]==0.32.0 websockets==14.1 -python-multipart==0.0.12 +python-multipart==0.0.19 # LangChain and AI -langchain==0.3.0 +langchain==0.3.7 langchain-openai==0.2.0 -langchain-community==0.3.0 -openai==1.54.0 # Database sqlalchemy==2.0.36 @@ -23,7 +21,12 @@ pydantic==2.9.2 pydantic-settings==2.5.2 python-dotenv==1.0.1 +# Authentication +python-jose[cryptography]==3.3.0 +passlib[bcrypt]==1.7.4 + # Audio Processing (optional, for future ASR/TTS integration) # pydub==0.25.1 # speech-recognition==3.10.4 +openai \ No newline at end of file