|
@@ -1,9 +1,19 @@
|
|
|
from opendevin.server.session import Session
|
|
from opendevin.server.session import Session
|
|
|
from fastapi import FastAPI, WebSocket
|
|
from fastapi import FastAPI, WebSocket
|
|
|
|
|
+from fastapi.middleware.cors import CORSMiddleware
|
|
|
import agenthub # noqa F401 (we import this to get the agents registered)
|
|
import agenthub # noqa F401 (we import this to get the agents registered)
|
|
|
|
|
+import litellm
|
|
|
|
|
|
|
|
app = FastAPI()
|
|
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
+app.add_middleware(
|
|
|
|
|
+ CORSMiddleware,
|
|
|
|
|
+ allow_origins=["http://localhost:3001"],
|
|
|
|
|
+ allow_credentials=True,
|
|
|
|
|
+ allow_methods=["*"],
|
|
|
|
|
+ allow_headers=["*"],
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
# This endpoint receives events from the client (i.e. the browser)
|
|
# This endpoint receives events from the client (i.e. the browser)
|
|
|
@app.websocket("/ws")
|
|
@app.websocket("/ws")
|
|
|
async def websocket_endpoint(websocket: WebSocket):
|
|
async def websocket_endpoint(websocket: WebSocket):
|
|
@@ -12,3 +22,9 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
|
# TODO: should this use asyncio instead of await?
|
|
# TODO: should this use asyncio instead of await?
|
|
|
await session.start_listening()
|
|
await session.start_listening()
|
|
|
|
|
|
|
|
|
|
+@app.get("/litellm-models")
|
|
|
|
|
+async def get_litellm_models():
|
|
|
|
|
+ """
|
|
|
|
|
+ Get all models supported by LiteLLM.
|
|
|
|
|
+ """
|
|
|
|
|
+ return litellm.model_list
|