feat(chat): implement native hub chat with sqlite conversations store, SSE streaming and DSH 5th universe integration
This commit is contained in:
+8
-4
@@ -7,9 +7,10 @@ from typing import Optional, Tuple
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from app.config import settings, UNIVERSES, BASE_DIR
|
||||
from app.routers import api, proxy
|
||||
from app.routers import api, proxy, chat
|
||||
from app.proxy import close_http_client, proxy_request, proxy_websocket
|
||||
from app.personas import ensure_dirs
|
||||
from app.db import init_db
|
||||
|
||||
def get_subdomain_target(host: str) -> Optional[Tuple[str, str]]:
|
||||
"""
|
||||
@@ -20,7 +21,8 @@ def get_subdomain_target(host: str) -> Optional[Tuple[str, str]]:
|
||||
nyora-hub.yesminedor.tn -> (HERMES_NYORA_URL, 'nyora')
|
||||
perso-hub.yesminedor.tn -> (HERMES_PERSO_URL, 'perso')
|
||||
nabil-hub.yesminedor.tn -> (HERMES_NABIL_URL, 'nabil')
|
||||
dsh-hub.yesminedor.tn -> (DSH_FILEBROWSER_URL, 'nabil')
|
||||
dsh-hub.yesminedor.tn -> (HERMES_DSH_URL, 'dsh')
|
||||
files-hub.yesminedor.tn -> (DSH_FILEBROWSER_URL, 'nabil')
|
||||
|
||||
Apex / Hub UI:
|
||||
hub.yesminedor.tn -> None (Serves index.html Workspace Switcher)
|
||||
@@ -51,9 +53,9 @@ def get_subdomain_target(host: str) -> Optional[Tuple[str, str]]:
|
||||
if not sub or sub in ("hub", "www"):
|
||||
return None
|
||||
|
||||
if sub in ("dsh", "files", "dsh-files"):
|
||||
if sub in ("files", "dsh-files"):
|
||||
return (settings.dsh_filebrowser_url, "nabil")
|
||||
|
||||
|
||||
if sub in UNIVERSES:
|
||||
return (UNIVERSES[sub].backend_url, sub)
|
||||
|
||||
@@ -62,6 +64,7 @@ def get_subdomain_target(host: str) -> Optional[Tuple[str, str]]:
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
ensure_dirs()
|
||||
init_db()
|
||||
yield
|
||||
await close_http_client()
|
||||
|
||||
@@ -99,6 +102,7 @@ templates = Jinja2Templates(directory=str(templates_dir))
|
||||
# Include Routers
|
||||
app.include_router(api.router)
|
||||
app.include_router(proxy.router)
|
||||
app.include_router(chat.router)
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
@app.head("/", response_class=HTMLResponse)
|
||||
|
||||
Reference in New Issue
Block a user