From 168eef7f6cfb59859a3012b0f111ff857d3545c2 Mon Sep 17 00:00:00 2001 From: Barry-Anil Date: Fri, 17 Apr 2026 14:57:53 +0530 Subject: [PATCH 1/2] feat: add support and administration dashboard with authentication modal --- support/dashboard.html | 45 +++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/support/dashboard.html b/support/dashboard.html index 8abb484..a30952b 100644 --- a/support/dashboard.html +++ b/support/dashboard.html @@ -381,8 +381,8 @@

-

Github Auto-sync

-

Manage github auto-sync for live sync

+

Github Auto-sync Status Key

+

Manage github auto-sync status keys for live sync

@@ -571,32 +571,28 @@

LLM Keys

-
- - -
- - + +
-
+
@@ -697,25 +693,18 @@

LLM Keys

} function handleLlmKeyInput(element) { - const openai = document.getElementById('llm-key-openai'); const anthropic = document.getElementById('llm-key-anthropic'); - const gemini = document.getElementById('llm-key-gemini'); + const groq = document.getElementById('llm-key-groq'); const select = document.getElementById('llm-routing-model'); const hasValue = element.value.trim() !== ''; - if (element.id === 'llm-key-openai') { - anthropic.disabled = hasValue; - gemini.disabled = hasValue; - if (hasValue) select.value = 'gpt-4o'; - } else if (element.id === 'llm-key-anthropic') { - openai.disabled = hasValue; - gemini.disabled = hasValue; + if (element.id === 'llm-key-anthropic') { + groq.disabled = hasValue; if (hasValue) select.value = 'claude-3-5-sonnet'; - } else if (element.id === 'llm-key-gemini') { - openai.disabled = hasValue; + } else if (element.id === 'llm-key-groq') { anthropic.disabled = hasValue; - if (hasValue) select.value = 'gemini-1-5-pro'; + if (hasValue) select.value = 'groq'; } } @@ -730,12 +719,10 @@

LLM Keys

const keyName = select.value; let keyValue = ''; - if (keyName === 'gpt-4o') { - keyValue = document.getElementById('llm-key-openai').value; - } else if (keyName === 'claude-3-5-sonnet') { + if (keyName === 'claude-3-5-sonnet') { keyValue = document.getElementById('llm-key-anthropic').value; - } else if (keyName === 'gemini-1-5-pro') { - keyValue = document.getElementById('llm-key-gemini').value; + } else if (keyName === 'groq') { + keyValue = document.getElementById('llm-key-groq').value; } try { From 4e590a6c073bdde5f42ace80babbc7cf9d6c59e7 Mon Sep 17 00:00:00 2001 From: Barry-Anil Date: Fri, 17 Apr 2026 16:44:53 +0530 Subject: [PATCH 2/2] feat: add support and administration dashboard with authentication modal --- support/dashboard.html | 68 ++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/support/dashboard.html b/support/dashboard.html index a30952b..1943335 100644 --- a/support/dashboard.html +++ b/support/dashboard.html @@ -700,11 +700,11 @@

LLM Keys

const hasValue = element.value.trim() !== ''; if (element.id === 'llm-key-anthropic') { - groq.disabled = hasValue; - if (hasValue) select.value = 'claude-3-5-sonnet'; + if (groq) groq.disabled = hasValue; + if (select && hasValue) select.value = 'claude-3-5-sonnet'; } else if (element.id === 'llm-key-groq') { - anthropic.disabled = hasValue; - if (hasValue) select.value = 'groq'; + if (anthropic) anthropic.disabled = hasValue; + if (select && hasValue) select.value = 'groq'; } } @@ -715,43 +715,47 @@

LLM Keys

btn.disabled = true; btn.classList.add('opacity-70', 'cursor-not-allowed'); - const select = document.getElementById('llm-routing-model'); - const keyName = select.value; - - let keyValue = ''; - if (keyName === 'claude-3-5-sonnet') { - keyValue = document.getElementById('llm-key-anthropic').value; - } else if (keyName === 'groq') { - keyValue = document.getElementById('llm-key-groq').value; - } + const anthropicKey = document.getElementById('llm-key-anthropic')?.value; + const groqKey = document.getElementById('llm-key-groq')?.value; try { let metricsHostname = 'docs-embeddings-qdrant.zapconnecthub.com'; if (window.location.hostname && window.location.hostname !== 'localhost' && window.location.hostname !== '127.0.0.1') { metricsHostname = window.location.hostname.replace('wikijs', 'docs-embeddings-qdrant'); } - const response = await fetch(`https://${metricsHostname}/keys`, { - method: 'POST', - headers: { - 'accept': 'application/json', - 'Authorization': `Bearer ${sessionStorage.getItem('wiki_dashboard_jwt') || ''}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - key_name: keyName, - key_value: keyValue - }) - }); - if (!response.ok) { - console.error('Failed to save LLM Key', response.statusText); - showToast('Failed to save LLM key', true); + const saveKey = async (name, value) => { + if (!value) return true; // Nothing to save + const response = await fetch(`https://${metricsHostname}/keys`, { + method: 'POST', + headers: { + 'accept': 'application/json', + 'Authorization': `Bearer ${sessionStorage.getItem('wiki_dashboard_jwt') || ''}`, + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + key_name: name, + key_value: value + }) + }); + if (!response.ok) { + console.error(`Failed to save ${name}`, response.statusText); + return false; + } + return true; + }; + + const savedAnthropic = await saveKey('ANTHROPIC_API_KEY', anthropicKey); + const savedGroq = await saveKey('GROQ_API_KEY', groqKey); + + if (!savedAnthropic || !savedGroq) { + showToast('Failed to save one or more LLM keys', true); } else { - showToast('LLM key saved successfully'); + showToast('LLM keys saved successfully'); } } catch (err) { console.error('Request failed', err); - showToast('Network error, failed to save LLM key', true); + showToast('Network error, failed to save LLM keys', true); } finally { closeDrawers(); setTimeout(() => { @@ -807,7 +811,7 @@

LLM Keys

}, 500); } - document.addEventListener('DOMContentLoaded', () => { + // document.addEventListener('DOMContentLoaded', () => { const loginModal = document.getElementById('login-modal'); const loginForm = document.getElementById('login-form'); const loginError = document.getElementById('login-error'); @@ -1100,7 +1104,7 @@

${s.name}

loginSubmit.innerHTML = originalText; } }); - }); + \ No newline at end of file