From 3275af09e94f228a20c6277342530e2ede079d83 Mon Sep 17 00:00:00 2001 From: Z User Date: Thu, 29 Oct 2026 20:41:35 +0000 Subject: [PATCH] fix: Perf tab field mapping + TTS service (openedai-speech) + v0.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 1. Perf tab — fixed based on actual /props + /slots JSON User provided raw JSON showing the real field names: - default_generation_settings.params.temperature (NOT .temperature) - modalities.vision (NOT has_multimodal) - default_generation_settings.n_ctx (NOT n_context) - slots: n_prompt_tokens / n_prompt_tokens_processed / n_prompt_tokens_cache - slots: next_token[0].n_decoded / n_remain - slots: NO timings field (only available in chat completions) - slots: speculative boolean (not spec object) **Fix:** - SlotInfo interface extended with all new fields - OverviewView: extracts gen from dgs.params (nested), checks modalities.vision, uses dgs.n_ctx for total ctx, shows build_info, shows speculative status - SlotsView: uses n_prompt_tokens_processed (newer) ?? n_past (legacy) for ctx display, shows n_prompt_tokens + n_prompt_tokens_cache, shows next_token decoded/remaining when no timings, shows speculative badge - Sampling values now use .toFixed(2) for readability - Raw JSON dump section preserved (useful for future field changes) ## 2. TTS service (openedai-speech) Added OpenAI-compatible TTS service using openedai-speech: - compose.yaml: new 'tts' service with profile 'tts' - image: ghcr.io/matatonic/openedai-speech:latest - gpus: all (GPU acceleration for faster synthesis) - volumes: gpu/tts/voices + gpu/tts/cache - port: 8000 (internal) - labels: node.role=tts - tailscale serve: port 8100 → tts:8000 - sleep_mode: tts added to removal list - wake_mode: tts added to startup list with --profile tts - gpuctl usage: tts added to services list - dashboard: tts added to ServiceRole type, COMPOSE_PROFILES, VALID_ROLES TTS API is OpenAI-compatible: POST http://gpu-node:8100/v1/audio/speech { model: 'tts-1', voice: 'alloy', input: 'Hello world' } → audio/mpeg response ## 3. Version bump to 0.7.0 ## After merge ```sh git pull && sh build.sh docker compose up -d --force-recreate dashboard docker compose --profile tts up -d tts ``` Check footer — v0.7.0. For TTS: ```sh curl -X POST http://gpu-node-win:8100/v1/audio/speech \ -H 'Content-Type: application/json' \ -d '{"model":"tts-1","voice":"alloy","input":"Hello world"}' \ --output test.mp3 ``` --- compose.yaml | 19 + dashboard/src/app/api/debug/route.ts | 2 +- .../src/app/api/services/[role]/route.ts | 1 + dashboard/src/app/page.tsx | 328 +++++++++++------- dashboard/src/lib/docker.ts | 2 + dashboard/src/lib/version.ts | 2 +- ssh/gpuctl | 2 +- ssh/scripts/status.sh | 8 +- tailscale/config/serve.json | 3 + 9 files changed, 242 insertions(+), 125 deletions(-) diff --git a/compose.yaml b/compose.yaml index a804e81..61bba28 100644 --- a/compose.yaml +++ b/compose.yaml @@ -163,6 +163,25 @@ services: - "node.role=comfyui" - "node.instance=${TAILSCALE_HOSTNAME:-gpu-node}" + tts: + profiles: + - tts + image: ghcr.io/matatonic/openedai-speech:latest + container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-tts + gpus: all + volumes: + - ${HOST_PROJECT_PATH:-./}/gpu/tts/voices:/app/voices + - ${HOST_PROJECT_PATH:-./}/gpu/tts/cache:/app/cache + environment: + PORT: 8000 + HALF_PRECISION: "false" + networks: + - gpu-node + restart: "no" + labels: + - "node.role=tts" + - "node.instance=${TAILSCALE_HOSTNAME:-gpu-node}" + dashboard: image: gpu-node-dashboard container_name: ${TAILSCALE_HOSTNAME:-gpu-node}-dashboard diff --git a/dashboard/src/app/api/debug/route.ts b/dashboard/src/app/api/debug/route.ts index c27527d..084f81e 100644 --- a/dashboard/src/app/api/debug/route.ts +++ b/dashboard/src/app/api/debug/route.ts @@ -120,7 +120,7 @@ export async function GET() { ok: envError === null, error: envError, }, - version: "0.6.0", + version: "0.7.0", timestamp: new Date().toISOString(), }); } diff --git a/dashboard/src/app/api/services/[role]/route.ts b/dashboard/src/app/api/services/[role]/route.ts index dd5248b..9342379 100644 --- a/dashboard/src/app/api/services/[role]/route.ts +++ b/dashboard/src/app/api/services/[role]/route.ts @@ -21,6 +21,7 @@ const VALID_ROLES: ServiceRole[] = [ "ssh-companion", "gpu-test", "dashboard", + "tts", ]; function parseRole(role: string): ServiceRole | null { diff --git a/dashboard/src/app/page.tsx b/dashboard/src/app/page.tsx index f95ed06..6a3b0a0 100644 --- a/dashboard/src/app/page.tsx +++ b/dashboard/src/app/page.tsx @@ -3825,9 +3825,25 @@ interface SlotInfo { id: number; is_processing: boolean; n_ctx: number; - n_past: number; - n_eval: number; - prompt: number[]; + // Newer llama.cpp field names + n_prompt_tokens?: number; + n_prompt_tokens_processed?: number; + n_prompt_tokens_cache?: number; + speculative?: boolean; + // Legacy field names (older versions) + n_past?: number; + n_eval?: number; + prompt?: number[]; + // Next token info (newer versions) + next_token?: Array<{ + has_next_token?: boolean; + has_new_line?: boolean; + n_remain?: number; + n_decoded?: number; + }>; + // Per-slot params (newer versions include these) + params?: Record; + // Timings — only present after generation in some versions timings?: { prompt_n: number; prompt_ms: number; @@ -3839,7 +3855,6 @@ interface SlotInfo { predicted_per_second: number; cache_hit_rate?: number; }; - // Speculative decoding stats (if --spec-* was passed at startup) spec?: { accepted: number; drafted: number; @@ -3996,11 +4011,16 @@ function OverviewView({

); } - // Try multiple key names — llama.cpp has changed these across versions - const gen = (props.default_generation_settings || - props.generation_settings) as + + // Extract params from nested structure + // Newer llama.cpp: default_generation_settings.params.temperature + // Older: default_generation_settings.temperature + const dgs = (props.default_generation_settings || + props.generation_settings) as Record | undefined; + const gen = (dgs?.params || dgs) as | { n_predict?: number; + max_tokens?: number; temperature?: number; top_k?: number; top_p?: number; @@ -4008,45 +4028,75 @@ function OverviewView({ repeat_penalty?: number; } | undefined; - // Cumulative timings across all slots (sum of per-slot) + + // Cumulative timings across all slots const totalPredictedN = slots.reduce( - (s, x) => s + (x.timings?.predicted_n || 0), + (s, x) => + s + + (x.timings?.predicted_n || x.next_token?.[0]?.n_decoded || 0), 0 ); const totalPromptN = slots.reduce( - (s, x) => s + (x.timings?.prompt_n || 0), + (s, x) => + s + + (x.timings?.prompt_n || + x.n_prompt_tokens_processed || + x.n_past || + 0), 0 ); - // Average TPS across active slots + // Average TPS — from timings (if available) const activeSlots = slots.filter((s) => s.timings?.predicted_per_second); const avgTps = activeSlots.length > 0 - ? activeSlots.reduce((s, x) => s + (x.timings?.predicted_per_second || 0), 0) / - activeSlots.length + ? activeSlots.reduce( + (s, x) => s + (x.timings?.predicted_per_second || 0), + 0 + ) / activeSlots.length : null; + + // Multimodal — newer: modalities.vision, older: has_multimodal + const modalities = props.modalities as + | { vision?: boolean; audio?: boolean; video?: boolean } + | undefined; const hasMultimodal = Boolean( - props.has_multimodal ?? props.mmproj_path ?? props.is_multimodal + modalities?.vision || + modalities?.audio || + props.has_multimodal || + props.is_multimodal ); + const totalSlots = (props.total_slots as number) || (props.n_slots as number) || slots.length; - // Ctx usage — guard against NaN (slots may not have n_past/n_ctx when idle) + + // Ctx usage — try newer field names first const ctxUsed = slots.reduce( - (s, x) => s + (typeof x.n_past === "number" ? x.n_past : 0), + (s, x) => + s + + (x.n_prompt_tokens_processed ?? x.n_past ?? 0), 0 ); const ctxTotal = slots.reduce( - (s, x) => s + (typeof x.n_ctx === "number" ? x.n_ctx : 0), + (s, x) => s + (x.n_ctx ?? 0), 0 ); - // n_context from props (might be n_context or n_ctx_total) + // Total ctx from props: newer: default_generation_settings.n_ctx const totalCtx = + (dgs?.n_ctx as number) || (props.n_context as number) || (props.n_ctx_total as number) || ctxTotal || null; + // Speculative decoding + const specSlots = slots.filter((s) => s.speculative); + const hasSpec = specSlots.length > 0; + + // Build info + const buildInfo = props.build_info as string | undefined; + const [showRaw, setShowRaw] = React.useState(false); return ( @@ -4061,7 +4111,7 @@ function OverviewView({ {/* Cumulative stats */}
0 ? `${totalPredictedN}` : "—"} - hint="tokens generated" + hint="tokens decoded" />
@@ -4113,7 +4163,7 @@ function OverviewView({ {slots.length > 0 && (
- Slots + Slots ({totalCtx != null ? `${totalCtx} ctx` : ""}{buildInfo ? ` · ${buildInfo}` : ""})
@@ -4127,22 +4177,22 @@ function OverviewView({
- temp: {gen.temperature ?? "?"} + temp: {gen.temperature?.toFixed(2) ?? "?"} top_k: {gen.top_k ?? "?"} - top_p: {gen.top_p ?? "?"} + top_p: {gen.top_p?.toFixed(2) ?? "?"} - min_p: {gen.min_p ?? "?"} + min_p: {gen.min_p?.toFixed(2) ?? "?"} - rep: {gen.repeat_penalty ?? "?"} + rep: {gen.repeat_penalty?.toFixed(2) ?? "?"} - n_pred: {gen.n_predict ?? "?"} + n_pred: {gen.n_predict ?? gen.max_tokens ?? "?"}
@@ -4187,95 +4237,135 @@ function SlotsView({ slots }: { slots: SlotInfo[] }) { } return (
- {slots.map((s) => ( -
-
-
- - {s.is_processing ? "processing" : "idle"} - - - slot #{s.id} - -
-
- ctx: {s.n_past ?? "?"}/{s.n_ctx ?? "?"} + {slots.map((s) => { + // Use n_prompt_tokens_processed (newer) or n_past (legacy) + const promptTokens = + s.n_prompt_tokens_processed ?? s.n_past ?? null; + const totalPromptTokens = + s.n_prompt_tokens ?? null; + const cacheTokens = s.n_prompt_tokens_cache ?? null; + const decodedTokens = s.next_token?.[0]?.n_decoded ?? null; + const remainTokens = s.next_token?.[0]?.n_remain ?? null; + const hasTimings = !!s.timings; + + return ( +
+
+
+ + {s.is_processing ? "processing" : "idle"} + + + slot #{s.id} + + {s.speculative && ( + + spec + + )} +
+
+ ctx: {promptTokens ?? "?"}/{s.n_ctx ?? "?"} + {totalPromptTokens != null && ` (${totalPromptTokens} prompt)`} + {cacheTokens != null && ` · ${cacheTokens} cached`} +
+ + {hasTimings ? ( +
+ + + + +
+ ) : ( +
+

+ No per-token timings (idle or no generation yet). +

+ {decodedTokens != null && ( +
+ + + +
+ )} +
+ )} + + {s.spec && ( +
+ + + 0 + ? `${((s.spec.accepted / s.spec.drafted) * 100).toFixed(0)}%` + : "—" + } + /> +
+ )}
- - {s.timings ? ( -
- - - - -
- ) : ( -

- No timings yet — slot hasn't processed any tokens. -

- )} - - {s.spec && ( -
- - - 0 - ? `${((s.spec.accepted / s.spec.drafted) * 100).toFixed(0)}%` - : "—" - } - /> -
- )} -
- ))} + ); + })}
); } diff --git a/dashboard/src/lib/docker.ts b/dashboard/src/lib/docker.ts index a1690c9..0c0d0df 100644 --- a/dashboard/src/lib/docker.ts +++ b/dashboard/src/lib/docker.ts @@ -1207,6 +1207,7 @@ export type ServiceRole = | "ssh-companion" | "gpu-test" | "dashboard" + | "tts" | "tailscale"; const COMPOSE_PROFILES: Partial> = { @@ -1219,6 +1220,7 @@ const COMPOSE_PROFILES: Partial> = { "ssh-companion": "wake", "model-worker": "wake", webdav: "wake", + tts: "tts", }; export async function startService( diff --git a/dashboard/src/lib/version.ts b/dashboard/src/lib/version.ts index 8405e2e..920169f 100644 --- a/dashboard/src/lib/version.ts +++ b/dashboard/src/lib/version.ts @@ -4,7 +4,7 @@ * Displayed in the footer and available via /api/debug so the user can * verify the update actually took effect. */ -export const DASHBOARD_VERSION = "0.6.0"; +export const DASHBOARD_VERSION = "0.7.0"; /** * Build timestamp — set at build time by Next.js. diff --git a/ssh/gpuctl b/ssh/gpuctl index 14ea264..13ef11b 100644 --- a/ssh/gpuctl +++ b/ssh/gpuctl @@ -34,7 +34,7 @@ Usage: gpuctl restart gpuctl logs -Services: llama, comfy, model-worker, webdav, dashboard, +Services: llama, comfy, model-worker, webdav, dashboard, tts, ssh-main, ssh-companion, gpu-test EOF } diff --git a/ssh/scripts/status.sh b/ssh/scripts/status.sh index b43e772..4d555c2 100644 --- a/ssh/scripts/status.sh +++ b/ssh/scripts/status.sh @@ -115,7 +115,7 @@ sleep_mode() { echo "Entering sleep mode for instance: $NODE_INSTANCE" echo "Keeping: tailscale + $KEEP_SSH_ROLE" - for ROLE in llama comfyui gpu-test model-worker webdav dashboard; do + for ROLE in llama comfyui gpu-test model-worker webdav dashboard tts; do CTR=$(get_service_container "$ROLE" 2>/dev/null) || true [ -n "$CTR" ] && docker rm -f "$CTR" 2>/dev/null || true done @@ -151,17 +151,19 @@ wake_mode() { echo "Entering wake mode for instance: $NODE_INSTANCE" echo "Current SSH role: $SSH_ROLE" echo "Host project: $HOST_PROJECT_PATH" - echo "Starting: $TARGET_SSH_SERVICE + model-worker + webdav + dashboard" + echo "Starting: $TARGET_SSH_SERVICE + model-worker + webdav + dashboard + tts" HOST_PROJECT_PATH="$HOST_PROJECT_PATH" \ docker compose \ -f "$COMPOSE_FILE" \ --profile wake \ + --profile tts \ up -d \ "$TARGET_SSH_SERVICE" \ model-worker \ webdav \ - dashboard + dashboard \ + tts # Belt-and-suspenders: ensure dashboard is up even if the --profile wake # flag above didn't include it (compose v2 with --profile + explicit names diff --git a/tailscale/config/serve.json b/tailscale/config/serve.json index d307781..e6f3e9b 100644 --- a/tailscale/config/serve.json +++ b/tailscale/config/serve.json @@ -17,6 +17,9 @@ }, "8090": { "TCPForward": "dashboard:3000" + }, + "8100": { + "TCPForward": "tts:8000" } } } -- 2.49.1