-
Notifications
You must be signed in to change notification settings - Fork 0
docs: top-notch README (banner, story diagrams, screenshots) + ingest hardening #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -375,14 +375,21 @@ <h3>Model & API key</h3> | |
| document.getElementById("q").addEventListener("keydown",e=>{ if((e.metaKey||e.ctrlKey)&&e.key==="Enter") ask(); }); | ||
| async function ask(){ | ||
| if(!activeDoc) return; const q=document.getElementById("q").value.trim(); if(!q) return; | ||
| if(!getSettings().apiKey){ openSettings(); document.getElementById("setStatus").innerHTML='<span style="color:var(--warn)">Set an API key to ask questions.</span>'; return; } | ||
| const out=document.getElementById("result"), btn=document.getElementById("ask"); btn.disabled=true; pdfDoc=null; | ||
| out.innerHTML=`<div class="res card" style="margin-top:16px"><div class="body"><span class="spin"></span><span class="askhint">Navigating the document…</span></div></div>`; | ||
| const t0=performance.now(); | ||
| try{ | ||
| const r=await fetch(E("/v1/answer/treewalk"),{method:"POST",headers:{"Content-Type":"application/json",...llmHeaders()},body:JSON.stringify({document_id:activeDoc.id,query:q})}); | ||
| const d=await r.json(); | ||
| if(!r.ok){ out.innerHTML=`<div class="res card"><div class="body err">Error: ${esc(d.error||JSON.stringify(d))}</div></div>`; return; } | ||
| if(!r.ok){ | ||
| const msg=d.error||JSON.stringify(d); | ||
| if(/no LLM credentials|X-LLM-Api-Key/i.test(msg)){ | ||
| out.innerHTML=""; openSettings(); | ||
| document.getElementById("setStatus").innerHTML='<span style="color:var(--warn)">Set your API key to ask questions.</span>'; | ||
|
Comment on lines
+386
to
+388
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (bug_risk): Relying on server error strings for credential detection is brittle and may cause extra round-trips. The previous client-side |
||
| return; | ||
| } | ||
| out.innerHTML=`<div class="res card"><div class="body err">Error: ${esc(msg)}</div></div>`; return; | ||
| } | ||
| renderResult(d,Math.round(performance.now()-t0)); | ||
| }catch(e){ out.innerHTML=`<div class="res card"><div class="body err">${esc(String(e))}</div></div>`; } | ||
| finally{ btn.disabled=false; } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Clearing the result area on missing-credentials errors may degrade UX by removing prior answers.
This now clears
out.innerHTMLon missing-API-key, removing any prior answer the user may still be reading. Previously we never entered the ask flow, so the last result stayed visible. Consider keeping the existing result card and only updating the settings/status UI, so going to settings doesn’t wipe the current content.