Fix Observer KB: filter knowledge tables from sidebar, improve error handling

- Sidebar now excludes knowledge_topics/decisions/insights/questions tables
- Better error display when conversation load fails
- Prevents JSON parse errors from unfiltered dataset names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
root
2026-03-27 23:17:16 -05:00
co-authored by Claude Opus 4.6
parent 2189a6dbee
commit 1dcbe8e04c
+4 -4
View File
@@ -110,7 +110,7 @@ let CONVS=[];let CUR=null;
// Init
async function init(){
const old=['call_log','placements','clients','threat_intel','timesheets','meta_runs','candidates','job_orders','lab_trials','users','email_log','new_candidates','schema_test_v1','schema_test_v2','stress_test_ingest','stress_ingest'];
const old=['call_log','placements','clients','threat_intel','timesheets','meta_runs','candidates','job_orders','lab_trials','users','email_log','new_candidates','schema_test_v1','schema_test_v2','stress_test_ingest','stress_ingest','knowledge_topics','knowledge_decisions','knowledge_insights','knowledge_questions'];
try{
const ds=await(await fetch(API+'/catalog/datasets')).json();
CONVS=ds.filter(d=>!old.includes(d.name));
@@ -159,7 +159,7 @@ pg.textContent='page '+row.page_number;
msg.append(role,content,pg);el.appendChild(msg);
});
if(!r.rows.length)el.textContent='No content';
}catch(e){el.textContent='Error: '+e}
}catch(e){const err=document.createElement("div");err.className="empty";err.textContent="Error loading: "+e;el.appendChild(err)}
}
// Search view
@@ -194,7 +194,7 @@ actions.appendChild(saveBtn);
item.append(score,src,text,actions);el.appendChild(item);
});
if(!(r.results||[]).length){el.textContent='No results — try different terms'}
}catch(e){el.textContent='Error: '+e}
}catch(e){const err=document.createElement("div");err.className="empty";err.textContent="Error loading: "+e;el.appendChild(err)}
}
async function saveToKB(hit){
@@ -232,7 +232,7 @@ item.append(sc,tx);sources.appendChild(item);
const saveBtn=document.createElement('button');saveBtn.className='btn btn-sm btn-save';saveBtn.textContent='Save Answer';saveBtn.style.marginTop='12px';
saveBtn.onclick=()=>{saveToKB({doc_id:'ai_answer',chunk_text:q+'\n\n'+r.answer});saveBtn.textContent='Saved';saveBtn.disabled=true};
el.append(resp,meta,sources,saveBtn);
}catch(e){el.textContent='Error: '+e}
}catch(e){const err=document.createElement("div");err.className="empty";err.textContent="Error loading: "+e;el.appendChild(err)}
$('abtn').disabled=false;$('abtn').textContent='Ask AI';
}