Se correige el error de la importación de la API del modulo server pero surge un nuevo error.
This commit is contained in:
		| @@ -29,7 +29,7 @@ from dotenv import load_dotenv | ||||
|  | ||||
| load_dotenv() | ||||
|  | ||||
| app = FastAPI() | ||||
| fa_app = FastAPI() | ||||
| llm = ChatOpenAI( | ||||
|     model="gpt-4o-mini", | ||||
|     temperature=0.9 | ||||
| @@ -119,20 +119,20 @@ graph = create_react_agent( | ||||
| ) | ||||
|  | ||||
|  | ||||
| @app.get("/") | ||||
| @fa_app.get("/") | ||||
| async def redirect_root_to_docs(): | ||||
|     return RedirectResponse("/docs") | ||||
|  | ||||
|  | ||||
| # # Edit this to add the chain you want to add | ||||
| add_routes( | ||||
|     app, | ||||
|     fa_app, | ||||
|     llm, | ||||
|     path="/openai" | ||||
| ) | ||||
|  | ||||
|  | ||||
| @app.post("/process_text") | ||||
| @fa_app.post("/process_text") | ||||
| async def process_text(request: Request): | ||||
|     data = await request.json() | ||||
|     user_input = data.get("text") | ||||
| @@ -157,4 +157,4 @@ async def process_text(request: Request): | ||||
| if __name__ == "__main__": | ||||
|     import uvicorn | ||||
|  | ||||
|     uvicorn.run(app, host="0.0.0.0", port=8000) | ||||
|     uvicorn.run(fa_app, host="0.0.0.0", port=8000) | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| #!/usr/bin/env python3 | ||||
| from fastapi.testclient import TestClient | ||||
| from ..server import app | ||||
| from app.server import fa_app | ||||
|  | ||||
| client = TestClient(app) | ||||
| client = TestClient(fa_app) | ||||
|  | ||||
|  | ||||
| def test_process_text(mocker): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user