From bef08fb1fb281624e9146bd9b17ff6e9e91139ef Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Sun, 21 Dec 2025 00:16:43 -0300 Subject: [PATCH] feat(ai): expose node/gpu meta and improve chat UX --- backend/app.py | 18 ++++++++++ frontend/src/views/AiView.vue | 65 +++++++++++++++++++++++++++++++---- 2 files changed, 77 insertions(+), 6 deletions(-) diff --git a/backend/app.py b/backend/app.py index edbb625..ed591d4 100644 --- a/backend/app.py +++ b/backend/app.py @@ -34,6 +34,11 @@ AI_CHAT_SYSTEM_PROMPT = os.getenv( "You are the Titan Lab assistant for bstein.dev. Be concise and helpful.", ) AI_CHAT_TIMEOUT_SEC = float(os.getenv("AI_CHAT_TIMEOUT_SEC", "20")) +AI_NODE_NAME = os.getenv("AI_NODE_NAME") or os.getenv("NODE_NAME") or "unknown" +try: + AI_NODE_GPU_MAP = json.loads(os.getenv("AI_NODE_GPU_MAP", "{}")) +except json.JSONDecodeError: + AI_NODE_GPU_MAP = {} _LAB_STATUS_CACHE: dict[str, Any] = {"ts": 0.0, "value": None} @@ -181,6 +186,19 @@ def ai_chat() -> Any: return jsonify({"error": str(exc)}), 502 +@app.route("/api/ai/info", methods=["GET"]) +def ai_info() -> Any: + gpu_label = AI_NODE_GPU_MAP.get(AI_NODE_NAME, "local GPU (dynamic)") + return jsonify( + { + "node": AI_NODE_NAME, + "gpu": gpu_label, + "model": AI_CHAT_MODEL, + "endpoint": "/api/ai/chat", + } + ) + + @app.route("/", defaults={"path": ""}) @app.route("/") def serve_frontend(path: str) -> Any: diff --git a/frontend/src/views/AiView.vue b/frontend/src/views/AiView.vue index 8e0dd8e..fc96ab0 100644 --- a/frontend/src/views/AiView.vue +++ b/frontend/src/views/AiView.vue @@ -5,23 +5,26 @@

Atlas AI

Chat

- Lightweight LLM running on local GPU accelerated hardware. Anyone can chat without auth. The client streams responses - and shows round-trip latency for each turn. + Lightweight LLM running on local GPU accelerated hardware. Anyone can chat without auth. The client streams responses, + shows round-trip latency for each turn, and we're training an Atlas-aware model steeped in Titan Lab context.

Online
Model - qwen2.5-coder:7b-instruct-q4_0 + {{ meta.model }}
GPU - local GPU (dynamic) + {{ meta.gpu }}
Endpoint - {{ apiHost }} +
@@ -81,12 +84,17 @@ curl -X POST https://chat.ai.bstein.dev/api/ai/chat \