Skip to content

Commit

Permalink
remove cors middlewares
Browse files Browse the repository at this point in the history
  • Loading branch information
RaoHai committed Apr 23, 2024
1 parent 05d583b commit 6f68590
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import uvicorn
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
from fastapi.middleware.cors import CORSMiddleware

from agent import stream

Expand All @@ -22,28 +21,16 @@
description="Agent Chat APIs"
)

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
)

app.include_router(health_checker.router)
app.include_router(github.router)
app.include_router(rag.router)
app.include_router(bot.router)


@app.post("/api/chat/stream", response_class=StreamingResponse)
def run_agent_chat(input_data: ChatData):
result = stream.agent_chat(input_data, open_api_key)
return StreamingResponse(result, media_type="text/event-stream")



if __name__ == "__main__":
if is_dev:
uvicorn.run("main:app", host="0.0.0.0", port=int(os.environ.get("PORT", "8080")), reload=True)
Expand Down

0 comments on commit 6f68590

Please sign in to comment.