From 410492a7fac6cbe6e57732782ad7387e7d337bcb Mon Sep 17 00:00:00 2001 From: xcaliber Date: Wed, 18 Feb 2026 21:07:57 +0000 Subject: [PATCH] Upload 5 modified files from chat-switchboard-v0.5.1-1.zip --- src/index.html | 10 +++++----- src/js/app.js | 21 +++++++++++++++++++-- src/js/debug.js | 3 ++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/index.html b/src/index.html index eadceb6..994390a 100644 --- a/src/index.html +++ b/src/index.html @@ -7,7 +7,7 @@ - + @@ -305,9 +305,9 @@ onerror="this.onerror=null; this.src='https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.2.4/purify.min.js'"> - - - - + + + + diff --git a/src/js/app.js b/src/js/app.js index 85c5a6c..668f1d1 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -260,7 +260,17 @@ async function sendMessage() { UI.toast('Generation stopped', 'warning'); } else { console.error('Completion error:', e); - UI.toast(e.message, 'error'); + // Distinguish provider-side auth errors from session issues + const msg = e.message || ''; + if (msg.includes('provider error') && msg.includes('401')) { + UI.toast('Provider API key rejected — check your key in Settings → Providers', 'error'); + } else if (msg.includes('provider error') && msg.includes('429')) { + UI.toast('Provider rate limit hit — wait a moment and retry', 'warning'); + } else if (msg.includes('no API config') || msg.includes('no model')) { + UI.toast('No provider configured — add one in Settings → Providers', 'error'); + } else { + UI.toast(msg, 'error'); + } } } finally { App.isGenerating = false; @@ -306,7 +316,14 @@ async function regenerate() { chat.messages.push({ role: 'assistant', content, model, timestamp: new Date().toISOString() }); UI.showRegenerate(true); } catch (e) { - if (e.name !== 'AbortError') UI.toast(e.message, 'error'); + if (e.name !== 'AbortError') { + const msg = e.message || ''; + if (msg.includes('provider error') && msg.includes('401')) { + UI.toast('Provider API key rejected — check Settings → Providers', 'error'); + } else { + UI.toast(msg, 'error'); + } + } } finally { App.isGenerating = false; App.abortController = null; diff --git a/src/js/debug.js b/src/js/debug.js index 015b5df..a34def8 100644 --- a/src/js/debug.js +++ b/src/js/debug.js @@ -508,7 +508,8 @@ function switchDebugTab(tab) { document.querySelectorAll('.debug-tab').forEach(t => t.classList.remove('active')); document.querySelectorAll('.debug-tab-content').forEach(c => c.style.display = 'none'); document.querySelector(`.debug-tab[data-tab="${tab}"]`)?.classList.add('active'); - document.getElementById(`debug${tab.charAt(0).toUpperCase() + tab.slice(1)}Tab`)?.style.display = ''; + const panel = document.getElementById(`debug${tab.charAt(0).toUpperCase() + tab.slice(1)}Tab`); + if (panel) panel.style.display = ''; DebugLog.render(); }