Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
added CORS middleware
Dillon DuPont0e834c0a6f21
diff --git a/libs/python/computer-server/computer_server/main.py b/libs/python/computer-server/computer_server/main.pyindex 4d3dbd52f9..ea3dcc808d 100644--- a/libs/python/computer-server/computer_server/main.py+++ b/libs/python/computer-server/computer_server/main.py@@ -15,6 +15,7 @@ import aiohttpimport hashlibimport timeimport platform+from fastapi.middleware.cors import CORSMiddleware# Set up logging with more detaillogger = logging.getLogger(__name__)@@ -31,6 +32,16 @@ app = FastAPI(websocket_max_size=WEBSOCKET_MAX_SIZE,)+# CORS configuration+origins = ["*"]+app.add_middleware(+ CORSMiddleware,+ allow_origins=origins,+ allow_credentials=True,+ allow_methods=["*"],+ allow_headers=["*"],+)+protocol_version = 1try:from importlib.metadata import version@@ -428,9 +439,6 @@ async def cmd_endpoint(headers={"Cache-Control": "no-cache","Connection": "keep-alive",- "Access-Control-Allow-Origin": "*",- "Access-Control-Allow-Methods": "POST, OPTIONS",- "Access-Control-Allow-Headers": "Content-Type, X-Container-Name, X-API-Key"})@@ -662,27 +670,10 @@ async def agent_response_endpoint(headers = {"Cache-Control": "no-cache","Connection": "keep-alive",- "Access-Control-Allow-Methods": "POST, OPTIONS",- "Access-Control-Allow-Headers": "Content-Type, X-Container-Name, X-API-Key",- "Access-Control-Allow-Origin": "*",}return JSONResponse(content=payload, headers=headers)[email protected]("/responses")-async def agent_response_options(request: Request):- """CORS preflight for /responses"""- headers = {- "Cache-Control": "no-cache",- "Connection": "keep-alive",- "Access-Control-Allow-Methods": "POST, OPTIONS",- "Access-Control-Allow-Headers": "Content-Type, X-Container-Name, X-API-Key",- "Access-Control-Max-Age": "600",- "Access-Control-Allow-Origin": "*",- }- return JSONResponse(content={}, headers=headers)--if __name__ == "__main__":uvicorn.run(app, host="0.0.0.0", port=8000)