fix: the indexer address and token have their own Save; the card's Save & Close keeps its five keys
All checks were successful
Forgejo Docker Build / Root app tests (push) Successful in 52s
Forgejo Docker Build / Build Docker image (push) Successful in 18s
Forgejo Docker Build / End-to-end (browser) (push) Successful in 8s

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
This commit is contained in:
Daniel 2026-09-13 16:05:46 +02:00
parent 93426ac089
commit 34c495b5d8
2 changed files with 18 additions and 4 deletions

View file

@ -433,6 +433,7 @@
<input id="assistant-indexer-token" type="password" placeholder="leave blank to keep" class="admin-control" autocomplete="new-password">
</div>
</div>
<button type="button" class="btn btn-secondary btn-sm" id="btn-assistant-indexer-save" style="margin-top:6px;">Save indexer settings</button>
</details>
</div>
</div>

View file

@ -406,9 +406,24 @@ export function initClinicalAssistantAdmin(adminEscapeHtml) {
}).catch(function(err) { showToast(err.message, 'error'); if (box) box.textContent = err.message; })
.finally(function() { if (button) button.disabled = false; });
}
// The indexer's address and token have their own Save: the card's Save & Close
// writes exactly the five keys it shows, and a token is not a setting to
// rewrite on every visit.
function saveIndexerSettings() {
if (configState !== 'ready') return;
var writes = [putAssistantConfig('clinical_assistant.indexer_url', getValue('assistant-indexer-url') || '')];
if (getValue('assistant-indexer-token')) writes.push(putAssistantConfig('clinical_assistant.indexer_token', getValue('assistant-indexer-token')));
Promise.all(writes).then(function() {
setValue('assistant-indexer-token', '');
showToast('Indexer settings saved', 'success');
loadLibraryIndexStatus();
}).catch(function(err) { showToast(err.message || 'Save failed', 'error'); });
}
document.addEventListener('click', function(e) {
if (e.target.closest && e.target.closest('#btn-assistant-index-now')) runLibraryIndexNow();
else if (e.target.closest && e.target.closest('#btn-assistant-index-refresh')) loadLibraryIndexStatus();
if (!e.target.closest) return;
if (e.target.closest('#btn-assistant-index-now')) runLibraryIndexNow();
else if (e.target.closest('#btn-assistant-index-refresh')) loadLibraryIndexStatus();
else if (e.target.closest('#btn-assistant-indexer-save')) saveIndexerSettings();
});
// Each card saves exactly what it shows, so no card needs a note explaining
@ -421,8 +436,6 @@ export function initClinicalAssistantAdmin(adminEscapeHtml) {
Promise.all([
putAssistantConfig('clinical_assistant.conversation_chars', getValue('assistant-conversation-budget')),
putAssistantConfig('clinical_assistant.search_limit', getValue('assistant-search-limit') || '8'),
putAssistantConfig('clinical_assistant.indexer_url', getValue('assistant-indexer-url') || ''),
getValue('assistant-indexer-token') ? putAssistantConfig('clinical_assistant.indexer_token', getValue('assistant-indexer-token')) : Promise.resolve(),
putAssistantConfig('clinical_assistant.context_chars', getValue('assistant-context-chars') || '1400'),
putAssistantConfig('clinical_assistant.translate_provider', getValue('assistant-translate-provider') || 'libretranslate'),
putAssistantConfig('clinical_assistant.show_sources',