Spaces:
Runtime error
Runtime error
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| import os | |
| app = FastAPI(title="Orion-OS AI Agents Cloud API") | |
| # تفعيل الـ CORS لتتمكن صفحة الويب الرئيسية لمشروعك من الاتصال بالوكلاء بأمان | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| def home(): | |
| return { | |
| "status": "Orion AI Agents Online", | |
| "platform": "Hugging Face Spaces (Docker CPU Basic)", | |
| "engine": "Python 3.10" | |
| } | |
| async def execute_agent(payload: dict): | |
| # نقطة اتصال تفاعلية لاستدعاء كود تشغيل الوكيل وتلقي المخرجات فوراً | |
| try: | |
| from ai.agents.agent_loop import agent_loop | |
| result = agent_loop(payload.get("input", {})) | |
| return {"success": True, "result": result} | |
| except Exception as e: | |
| return {"success": False, "error": str(e)} | |