Skip to content

Local AI BGM and sound effects for Claude Code and any MCP client. Stable Audio 3 on Apple Silicon (MLX) and Windows NVIDIA GPUs (PyTorch). No cloud, no API key.

Web UI: toasts without an action no longer show "null" (GAME-224)

Kana760bbae6acb3
diff --git a/src/audio_studio_mcp/static/app.js b/src/audio_studio_mcp/static/app.js
index 1b99420..bcc3666 100644
--- a/src/audio_studio_mcp/static/app.js
+++ b/src/audio_studio_mcp/static/app.js
@@ -112,8 +112,9 @@ function typing(e) {
let toastTimer;
function toast(msg, action) {
const n = $("#toast");
- n.replaceChildren(el("span", { text: msg }), action ? el("button", { class: "link-btn toast-act", type: "button", text: action.label,
- onclick: () => { n.hidden = true; action.run(); } }) : null);
+ // replaceChildren would print a null as the text "null"
+ n.replaceChildren(el("span", { text: msg }), ...(action ? [el("button", { class: "link-btn toast-act", type: "button", text: action.label,
+ onclick: () => { n.hidden = true; action.run(); } })] : []));
n.hidden = false;
clearTimeout(toastTimer);
toastTimer = setTimeout(() => { n.hidden = true; }, action ? 6000 : 2200);
diff --git a/tests/test_webui_browser.py b/tests/test_webui_browser.py
index 2309417..3ffe786 100644
--- a/tests/test_webui_browser.py
+++ b/tests/test_webui_browser.py
@@ -138,6 +138,8 @@ def test_empty_states(web, browser, shots):
page.click("#gen-form label:has(input[name=audio_type][value=sfx])")
page.click("#examples >> text=Glass breaking")
assert page.input_value("#sound_source") == "glass bottle"
+ page.evaluate("toast('plain message')") # a toast without an action button
+ assert page.text_content("#toast") == "plain message"
page.click("#gen-reset") # clear, then undo from the toast
assert page.input_value("#sound_source") == ""
page.click("#toast >> text=Undo")