Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,6 @@ from typing import Optional
|
|
| 5 |
|
| 6 |
from fastapi import FastAPI, UploadFile, File, Form, HTTPException
|
| 7 |
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
-
from pydantic import BaseModel
|
| 9 |
|
| 10 |
from contextlib import asynccontextmanager
|
| 11 |
from langchain_mcp_adapters.client import MultiServerMCPClient
|
|
@@ -41,10 +40,16 @@ app = FastAPI(lifespan=lifespan)
|
|
| 41 |
|
| 42 |
app.add_middleware(
|
| 43 |
CORSMiddleware,
|
| 44 |
-
allow_origins=[
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
allow_headers=["*"],
|
| 47 |
)
|
|
|
|
| 48 |
# --- API ENDPOINTS ---
|
| 49 |
|
| 50 |
@app.post("/initialize")
|
|
@@ -126,5 +131,4 @@ async def chat(
|
|
| 126 |
return {"error": f"Agent Error: {str(e)}"}
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 130 |
-
|
|
|
|
| 5 |
|
| 6 |
from fastapi import FastAPI, UploadFile, File, Form, HTTPException
|
| 7 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 8 |
|
| 9 |
from contextlib import asynccontextmanager
|
| 10 |
from langchain_mcp_adapters.client import MultiServerMCPClient
|
|
|
|
| 40 |
|
| 41 |
app.add_middleware(
|
| 42 |
CORSMiddleware,
|
| 43 |
+
allow_origins=[
|
| 44 |
+
"https://research-agent-heduc5oop-research-paper-agent.vercel.app",
|
| 45 |
+
"http://localhost:3000",
|
| 46 |
+
"http://localhost:5173",
|
| 47 |
+
],
|
| 48 |
+
allow_credentials=True,
|
| 49 |
+
allow_methods=["GET", "POST"],
|
| 50 |
allow_headers=["*"],
|
| 51 |
)
|
| 52 |
+
|
| 53 |
# --- API ENDPOINTS ---
|
| 54 |
|
| 55 |
@app.post("/initialize")
|
|
|
|
| 131 |
return {"error": f"Agent Error: {str(e)}"}
|
| 132 |
|
| 133 |
if __name__ == "__main__":
|
| 134 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|