import os import sys from fastapi.responses import FileResponse # Add the agent_service directory to sys.path sys.path.append(os.path.join(os.path.dirname(__file__), "examples", "agent_service")) from main import app as agentscope_app import uvicorn frontend_path = os.path.join(os.path.dirname(__file__), "examples", "web_ui", "frontend", "dist") @agentscope_app.get("/{full_path:path}") async def catch_all(full_path: str): file_path = os.path.join(frontend_path, full_path) if full_path and os.path.isfile(file_path): return FileResponse(file_path) return FileResponse(os.path.join(frontend_path, "index.html")) if __name__ == "__main__": uvicorn.run(agentscope_app, host="0.0.0.0", port=7860)