feat(corpus): add save-to-corpus + private corpus search scope
- POST /api/save-to-corpus.php — saves tool output text to user's default CaveauAI corpus via ClientRagPipeline
- api/case/upload.php — dual-writes uploaded PDFs to CaveauAI client_documents (best-effort)
- assets/js/corpus-save.js — shared <dialog> handler for .js-save-corpus buttons on all tool pages
- includes/layout_footer.php — injects corpus-save.js + shared save dialog markup
- korrespond/deep-research/barnevernet/discrepancy JS — save-to-corpus buttons on output sections
- api/search.php + LegalTools::search() — corpus_scope param ('shared'|'private'|'both'), merges personal CaveauAI corpus with shared legal library when 'both'
- includes/tool_form.php + assets/js/tools.js — corpus scope radio toggle shown on search tab
- api/user-docs.php — add POST upload method for non-SSO authenticated users
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -813,6 +813,21 @@
|
||||
els.results.appendChild(finalContainer.firstChild);
|
||||
}
|
||||
|
||||
// Save-to-corpus button
|
||||
const briefEl = els.results.querySelector('.dr-brief');
|
||||
if (briefEl) {
|
||||
briefEl.id = 'bvjBriefText';
|
||||
const saveBtn = document.createElement('button');
|
||||
saveBtn.type = 'button';
|
||||
saveBtn.className = 'js-save-corpus secondary-button';
|
||||
saveBtn.dataset.tool = 'barnevernet';
|
||||
saveBtn.dataset.contentId = 'bvjBriefText';
|
||||
saveBtn.dataset.suggestedTitle = 'BVJ analyse: ' + (document.getElementById('bvjQuestion')?.value?.slice(0, 80) ?? 'Svar');
|
||||
saveBtn.textContent = 'Save to corpus';
|
||||
saveBtn.style.marginTop = '12px';
|
||||
briefEl.insertAdjacentElement('afterend', saveBtn);
|
||||
}
|
||||
|
||||
// Bind source card clicks
|
||||
els.results.querySelectorAll('.dr-source-card[data-source-n]').forEach((node) => {
|
||||
node.addEventListener('click', (e) => {
|
||||
|
||||
Reference in New Issue
Block a user