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:
@@ -110,7 +110,7 @@ let CONVS=[];let CUR=null;
|
|||||||
|
|
||||||
// Init
|
// Init
|
||||||
async function 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{
|
try{
|
||||||
const ds=await(await fetch(API+'/catalog/datasets')).json();
|
const ds=await(await fetch(API+'/catalog/datasets')).json();
|
||||||
CONVS=ds.filter(d=>!old.includes(d.name));
|
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);
|
msg.append(role,content,pg);el.appendChild(msg);
|
||||||
});
|
});
|
||||||
if(!r.rows.length)el.textContent='No content';
|
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
|
// Search view
|
||||||
@@ -194,7 +194,7 @@ actions.appendChild(saveBtn);
|
|||||||
item.append(score,src,text,actions);el.appendChild(item);
|
item.append(score,src,text,actions);el.appendChild(item);
|
||||||
});
|
});
|
||||||
if(!(r.results||[]).length){el.textContent='No results — try different terms'}
|
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){
|
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';
|
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};
|
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);
|
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';
|
$('abtn').disabled=false;$('abtn').textContent='Ask AI';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user