qulab-infinite / agent_lab /backend /ech0_server_minimal.py
workofarttattoo's picture
πŸš€ QuLab MCP Server: Complete Experiment Taxonomy Deployment
91994bf
"""
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
@app.post("/chat", summary="Chat with ECH0")
def chat_with_ech0(payload: ChatPayload):
"""Direct interface to ECH0 (via Ollama + Together.ai)."""
return ech0.chat(payload.message)
@app.get("/chat/greeting", summary="Get a daily briefing from ECH0")
def get_ech0_greeting():
"""Generates a context-aware greeting from the AI host."""
return {"greeting": ech0.generate_greeting()}
@app.get("/health")
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)