Compare commits

..
Author SHA1 Message Date
Gerald LonlasandClaude Opus 4.7 ff4a63aa7b fix(web): use toast for error notifications instead of window.alert
Replace blocking window.alert calls with a notifyError helper that
mirrors notifySuccess, giving consistent toast-based UX for both
success and failure paths on the Refresh Models and Test Connection
buttons.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:44:46 +08:00
3 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ class LMStudioConnect(io.ComfyNode):
id="server_url",
display_name="Server URL",
default="http://127.0.0.1:1234",
placeholder="http://192.0.2.10:1234",
placeholder="http://10.168.168.7:1234",
tooltip="LMStudio server URL (without /v1).",
),
io.String.Input(
+1 -1
View File
@@ -6,7 +6,7 @@ import client
def test_normalize_server_url_trims_and_strips_v1() -> None:
assert client.normalize_server_url(" http://192.0.2.10:1234/v1/ ") == "http://192.0.2.10:1234"
assert client.normalize_server_url(" http://10.168.168.7:1234/v1/ ") == "http://10.168.168.7:1234"
@pytest.mark.parametrize(
+15 -2
View File
@@ -190,6 +190,19 @@ function notifySuccess(message) {
}
}
function notifyError(message) {
if (typeof app.extensionManager?.toast?.add === "function") {
app.extensionManager.toast.add({
severity: "error",
summary: "LMStudio",
detail: message,
life: 5000,
});
} else {
console.error(`[LMStudio] ${message}`);
}
}
function fitNodeToWidgets(node) {
if (typeof node.computeSize !== "function" || typeof node.setSize !== "function") {
return;
@@ -292,7 +305,7 @@ function attachButtons(node) {
} catch (error) {
const message = error?.message || String(error);
console.error("[LMStudio] Model refresh failed", error);
window.alert(`Model refresh failed: ${message}`);
notifyError(`Model refresh failed: ${message}`);
}
});
@@ -302,7 +315,7 @@ function attachButtons(node) {
} catch (error) {
const message = error?.message || String(error);
console.error("[LMStudio] Connectivity test failed", error);
window.alert(`Connectivity test failed: ${message}`);
notifyError(`Connectivity test failed: ${message}`);
}
});