From 36f7a9f440735d741737b05ef7d0f710e9fd324a Mon Sep 17 00:00:00 2001 From: grabowski Date: Fri, 23 Oct 2026 19:57:29 +0700 Subject: [PATCH] agent window: plain message when the endpoint wants a key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A 401/403 with an HTML error page (nginx) showed as "HTTP 401: 401 Authorization Required 401 Authorization Required nginx". Now: "The endpoint wants an API key: enter it in ⚙" before one is set, "The endpoint refused the API key (...)" after. --- studio/agent.js | 9 +++++++-- tools/agent_checks.py | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/studio/agent.js b/studio/agent.js index 971f8cb..29d35d5 100644 --- a/studio/agent.js +++ b/studio/agent.js @@ -91,8 +91,13 @@ var m = t; try { var x = JSON.parse(t); m = (x.error && (x.error.message || x.error)) || x.message || x.detail || t; } catch (e) { /* plain text */ } if (typeof m !== "string") m = JSON.stringify(m); - m = m.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim(); - var hint = r.status === 401 || r.status === 403 ? " Check the API key (⚙)." : r.status === 404 ? " Check the endpoint: most servers want the URL ending in /v1." : ""; + if (/^\s*