Spaces:
Running
Running
Commit History
-
Personas → heroes: shield icon, hero terminology, empty state, active highlight
- Nav icon for Personas: 🪖 (contemporary helmet) → 🛡 (fantasy shield). - "Recruit a soldier" → "Recruit hero"; all "soldier" copy → "hero" ("No heroes saved yet", prompts, store defaults, diary). - Persona page hides the hero fields until a hero is generated or picked (empty state "Recruit a hero, or pick one from the barracks"). - The selected hero is highlighted in the barracks roster (ink fill + red accent bar). Verified: icon, empty/shown toggle, active highlight, terminology. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>29474fc -
Move Voice settings into the Settings page; add a sidebar ⚙ Settings button
- settingsPanel.js injects two sections into Gradio's settings page now: "Local AI Model" + "Voice" (the TTS engine/voice picker, moved off the diary page). Both ride the shared singletons. Auto-narrate is now global facade state (getAutoNarrate / setAutoNarrate) so the diary reads it without the bar being mounted. - diaryPanel: drop the voice bar; keep the Read-aloud button + narration; read getAutoNarrate() for "narrate as it writes". - Sidebar gains a "⚙ Settings" item (nav.json) that opens the SAME Gradio settings page as the footer link (tiny.js wraps tacNavigate to click the footer button). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>dffe06d -
Add Qwen3-TTS Voice Design (DashScope) + persona voice descriptions
Reuse the oikomi Space's one trick — proxy Alibaba DashScope's qwen-voice-design API — but with our own DASHSCOPE_API_KEY (Space secret), server-side so the key never hits the browser. No GPU/ZeroGPU needed. - app.py: POST /qwen-tts {text, instruct} → DashScope qwen-voice-design → 24kHz WAV. - web/ttsQwen3.js: new TTS engine (mode pcm) calling /qwen-tts; the "voice" is a free-form description (preset, or the persona's). Registered in the TTS facade with setVoiceDescription() + previewVoice(); labeled cloud (not local-first). - Persona generation now emits a `voice` field (one-line how-they-sound description); cap raised 100→160. Parser keeps it; panel shows it + a 🔊 Hear voice button that designs the voice and reads the about aloud. - Diary: Qwen3 "persona voice" is designed from the unit's traits. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>717332c -
Cap persona + diary at 100 tokens; shorten prompts; stream the diary
- maxTokens 100 for both persona and diary (was 220/768 via thinkMaxTokens) so models can't ramble past the answer. Prompts tightened to match: persona about → "1-2 short sentences (~25 words)"; diary → "1-2 vivid sentences (~60 words), be brief". - War diary now streams visibly: it used the aggressive stripThink live, which an unclosed <think> emptied — so it showed blank until the end. Use stripThinkFinal in the live onToken so the prose (and narration) appear token-by-token. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>b862211 -
Fix empty-JSON: keep the answer when a model leaves <think> unclosed
Root cause (from a real debug report): Qwen3 on WebLLM opens a <think> tag and jumps straight to the answer WITHOUT closing it. Our stripThink had a rule that deletes an unterminated <think> all the way to end-of-string — so it nuked the entire JSON answer and the parser saw 0 chars ("model returned empty / unparseable JSON"). The model was actually producing a perfect, fully-filled persona. Add stripThinkFinal() (drop closed <think>…</think> blocks + stray unclosed tags, KEEP the answer) and use it for the final persona parse + diary display; keep the aggressive stripThink only for the live streaming preview. Verified against the exact failing output: parses name/about/specialty/personality/vibe correctly. Also: settings section now inserts directly above "Display Theme" (below the Settings title), not at the very top of the page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>62070d0 -
Settings: model section to top; default WebLLM + Qwen3 0.6B; copyable debug
- Inject the "Local AI Model" section at the TOP of Gradio's settings page. - Default engine = WebLLM (best on mobile WebGPU; falls back to wllama with no WebGPU) and default model = Qwen3 0.6B. - Persona + diary panels gain a "📋 Copy debug" button that copies a paste-ready report (engine · backend · model · input · outcome · raw output · stripped text, plus exception/stack), so failures like the empty-JSON persona can be sent back verbatim. Clipboard-blocked contexts fall back to selecting the text. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>898540a -
Move engine/model settings to a Settings page; share one model across both pages
The model picker was duplicated on Personas and War Diaries. Move the engine + model selector and cache controls into a new Settings tab (settingsPanel.js); both pages now read the same selection from the runtime.js singleton, so there's one place to choose the model and it's guaranteed identical on both. The diary page keeps its Voice (TTS) controls. nav.json gains an "App › Settings" item (Space-only). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>627d835 -
Fix Qwen3 on WebLLM: budget for thinking + capture reasoning_content
Symptom: WebLLM Qwen3 "rambled" but the output was just unfinished. MLC doesn't honour the `/no_think` text switch (wllama does), so Qwen3 keeps reasoning, and max_tokens:220 caps the TOTAL (reasoning + answer) — the JSON gets truncated before it closes, so parsing fails. - thinkMaxTokens(): give thinking models (qwen3) ≥768 tokens so they can reason AND still finish the answer. When /no_think IS honoured (wllama/transformers) the model stops early at EOS, so this costs nothing there. - WebLLM stream now captures MLC's separate `reasoning_content`, re-wrapped as <think>…</think>, so stripThink + the raw "thinking" view treat every engine the same (and the budget math is visible). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>eba5aae -
Fix Qwen3 parsing (/no_think) + WebLLM double-load guard & progress clarity
Qwen3 is a thinking model: with a 220-token budget it spent everything on a <think> block and never emitted the JSON/answer, so persona parsing failed after the thinking. Append Qwen3's `/no_think` soft switch for these structured tasks (persona + diary) so it goes straight to the answer. Helper noThink(modelId) keyed on the model id; no-op for non-Qwen3. WebLLM "downloads twice / no cache": - ensure() guarded on _loadedId (only set AFTER load), so a re-entrant ensure during a slow download could start a SECOND load. Guard on _loadingId (set up front) instead — same fix applied to the Transformers.js engine. - MLC runs two phases through one progress callback (Fetching from network, then Loading from cache into GPU) — both 0→100%, which reads as "downloading twice". Pass MLC's progress text through so the status line shows which phase it is; the second pass is a cache-load, not a re-download. (Caching = MLC Cache API + our storage.persist(); evictable under quota pressure.…ab87288 -
Mobile: collapse model/voice control bars behind tap-to-expand
On phones the diary had two full control bars (model + voice) stacking ~830px of controls above the story. Wrap each bar in a <details> that's open on desktop (summary hidden) and collapsed on mobile (tap "⚙ Model" / "🔊 Voice" to expand), so the war story / persona sits near the top on a phone. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>0218dca -
Mobile: give persona/diary content real space on phones
On phones the controls panel and result were two scroll panes splitting a fixed- height box, squeezing the story/persona to a sliver, and the floating ☰ button overlapped the top of the content. Now (≤768px): the whole .persona-view scrolls as one column, the result gets min-height 62vh, controls clear the hamburger (padding-top), inputs use 16px (no iOS focus-zoom) with bigger tap targets, and tapping Generate/Write scrolls the result into view. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>db5fc22 -
Add in-browser TTS: read war diaries aloud (Kokoro / Kitten / Web Speech)
The diary panel can now narrate entries on the user's device — fully local-first, no audio touches the Space. A switchable TTS facade (tts.js) mirrors the LLM facade: - ttsKokoro.js — Kokoro-82M via kokoro-js (Transformers.js/ONNX, WebGPU/WASM), best quality, Apache-2.0, ~92MB q8 / 326MB fp32; weights from HF. - ttsKitten.js — KittenTTS Nano 15M (~24MB) via onnxruntime-web + phonemizer, WASM for robustness; tokenizer/voices vendored under web/kitten/. - ttsWebSpeech.js— Web Speech API, zero download, OS voices (instant fallback). - ttsAudio.js — one shared AudioContext, sequential sentence playback. - tts.js — facade + makeNarrator(): streams sentence-by-sentence so the diary narrates itself while the LLM is still writing. - ttsBar.js — engine + voice picker + "narrate as it writes" toggle. diaryPanel.js gains a 🔊 Read aloud / ⏹ Stop button and live auto-narration. Reuses storage.js persist() so the voice m…9c371b5 -
Multi-engine benchmark: wllama vs Transformers.js vs WebLLM (engine selector)
Add a runtime facade (runtime.js) over three in-browser LLM engines so the same model can be A/B'd and tok/s compared: - engineWllama.js — llama.cpp WASM + WebGPU (GGUF from HF; 🦙 + local-first) - engineTransformers.js — HF Transformers.js (ONNX, WebGPU/WASM) - engineWebllm.js — MLC WebLLM (WebGPU only; greyed out without GPU) - genStats.js — shared tok/s tracker (decode rate, TTFT) for fair benchmarking modelBar.js gains an Engine selector (unavailable engines disabled); persona + diary panels now import from runtime.js. Removes the old wllamaLlm.js (folded into engineWllama.js). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>f8d0843 -
Add Qwen3-0.6B; surface WebGPU backend; strip <think> from answers
- Catalog: add Qwen3-0.6B (unsloth GGUF, 397MB, ungated) — newest tiny model. - wllama V3 (3.4.1) already ships the llama.cpp WebGPU backend (auto-enabled, 10-15x over WASM on capable browsers); show ⚡WebGPU vs CPU(WASM) in the model bar. - stripThink(): Qwen3's <think>…</think> reasoning shows in the raw 'thinking' view but is removed from the parsed persona / diary prose. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>a4ca9e9 -
In-browser models: catalog + picker + cache delete, live tok/s stats, raw 'thinking' stream
- modelCatalog.js: 8 verified ungated GGUFs ≤~2GB (SmolLM2 360M/1.7B, Qwen2.5 0.5B/1.5B/3B, Qwen3 1.7B, Llama 3.2 1B/3B) with real sizes; bigger (Gemma 4 E2B 3GB, Qwen3-4B, MiniMax) excluded — exceed the browser 2GB single-file limit. - wllamaLlm.js: setModel/ensureModel per-model, cache list/delete via wllama ModelManager (exit() + remove()), tok/s + first-token stats during streaming. - modelBar.js: model dropdown (label · size · ✓downloaded) + 🗑 delete-from-cache. - persona/diary panels: model picker, live tok/s, and a raw 'thinking' stream view so you watch tokens arrive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>8eac3eb -
Personas + War Diary now run llama.cpp IN THE BROWSER via wllama (local-first)
Generation moved off the slow Space CPU (0.58 tok/s) onto the visitor's device: wllama (llama.cpp compiled to WASM) loads a small GGUF from HF and streams tokens client-side. Earns 🔌 Off the Grid (no cloud/server inference) + 🦙 Llama Champion (it IS llama.cpp). Reuses woid's persona parser (vendored personaParse.js) + extractLivePersona. New web/wllamaLlm.js + personaPrompts.js + diaryPanel.js; the Barracks + Personas tabs are now gr.HTML divs filled by the in-browser panels. The Python llama-cpp-python path stays as a lazy fallback (no startup prewarm). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>03708ca