Spaces:
No application file
No application file
| """ | |
| Minimal ECH0 Server - For Testing | |
| Exposes just the ECH0 chat interface without hive_mind dependencies. | |
| """ | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from pydantic import BaseModel | |
| app = FastAPI(title="ECH0 API", version="0.1.0") | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| try: | |
| from ech0_service import ech0 | |
| except ImportError: | |
| try: | |
| from .ech0_service import ech0 | |
| except ImportError: | |
| from agent_lab.backend.ech0_service import ech0 | |
| class ChatPayload(BaseModel): | |
| message: str | |
| def chat_with_ech0(payload: ChatPayload): | |
| """Direct interface to ECH0 (via Ollama + Together.ai).""" | |
| return ech0.chat(payload.message) | |
| def get_ech0_greeting(): | |
| """Generates a context-aware greeting from the AI host.""" | |
| return {"greeting": ech0.generate_greeting()} | |
| def health_check(): | |
| return {"status": "online", "service": "ECH0"} | |
| if __name__ == "__main__": | |
| import uvicorn | |
| print("π Starting ECH0 Service on http://localhost:8000") | |
| uvicorn.run(app, host="0.0.0.0", port=8000) | |