gateway: add public invoke/jobs facade with redis queue worker and SSE
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
"""
|
||||
FastAPI app instance for Gateway Bot
|
||||
"""
|
||||
"""FastAPI app instance for Gateway Bot."""
|
||||
import logging
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from http_api import router as gateway_router
|
||||
from http_api_doc import router as doc_router
|
||||
from daarion_facade.invoke_api import router as invoke_router
|
||||
from daarion_facade.registry_api import router as registry_router
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
@@ -15,36 +16,47 @@ logging.basicConfig(
|
||||
|
||||
app = FastAPI(
|
||||
title="Bot Gateway with DAARWIZZ",
|
||||
version="1.0.0",
|
||||
description="Gateway service for Telegram/Discord bots → DAGI Router"
|
||||
version="1.1.0",
|
||||
description="Gateway service for Telegram/Discord bots + DAARION public facade"
|
||||
)
|
||||
|
||||
# CORS middleware
|
||||
# CORS for web UI clients (gateway only).
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_origins=[
|
||||
"https://daarion.city",
|
||||
"https://www.daarion.city",
|
||||
"http://localhost:3000",
|
||||
],
|
||||
allow_origin_regex=r"https://.*\.lovable\.app",
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
allow_methods=["GET", "POST", "OPTIONS"],
|
||||
allow_headers=["Authorization", "Content-Type"],
|
||||
)
|
||||
|
||||
# Include gateway routes
|
||||
# Existing gateway routes.
|
||||
app.include_router(gateway_router, prefix="", tags=["gateway"])
|
||||
app.include_router(doc_router, prefix="", tags=["docs"])
|
||||
|
||||
# Public facade routes for DAARION.city UI.
|
||||
app.include_router(registry_router)
|
||||
app.include_router(invoke_router)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {
|
||||
"service": "bot-gateway",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"agent": "DAARWIZZ",
|
||||
"endpoints": [
|
||||
"POST /telegram/webhook",
|
||||
"POST /discord/webhook",
|
||||
"POST /api/doc/parse",
|
||||
"POST /api/doc/ingest",
|
||||
"POST /api/doc/ask",
|
||||
"GET /api/doc/context/{session_id}",
|
||||
"GET /health"
|
||||
"GET /v1/registry/agents",
|
||||
"GET /v1/registry/districts",
|
||||
"GET /v1/metrics",
|
||||
"POST /v1/invoke",
|
||||
"GET /v1/jobs/{job_id}",
|
||||
"GET /health",
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user