Add public showcase landing, doc summary cards, and chunk toggle
- index.php: public showcase landing page (hero, how-it-works, capabilities, evidence mock, login form) visible to unauthenticated visitors; full OG/SEO meta; app shell hidden behind auth as before - tools.css: showcase section styles (gradient hero, step cards, capability grid, CTA button, evidence mock, footer) - LegalTools.php: sourceFromChunk() batch-fetches doc_summaries from RAG DB for non-private chunks; excerpt shows doc summary when available, falls back to raw chunk text; chunk_text field always carries the raw excerpt - tools.js: renderEvidenceItem() shows doc summary as card body; adds a collapsible "View chunk" toggle when summary differs from raw chunk text Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -60,7 +60,7 @@ const els = {};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
Object.assign(els, {
|
||||
gate: document.querySelector('#passcodeGate'),
|
||||
gate: document.querySelector('#publicLanding'),
|
||||
app: document.querySelector('#appShell'),
|
||||
passcodeForm: document.querySelector('#passcodeForm'),
|
||||
loginEmail: document.querySelector('#loginEmail'),
|
||||
@@ -291,17 +291,26 @@ function renderEvidence(data) {
|
||||
function renderEvidenceItem(item) {
|
||||
const title = item.title || item.citation || 'Source';
|
||||
const body = item.excerpt || item.why_it_matters || item.citation || '';
|
||||
const chunkText = item.chunk_text || '';
|
||||
const meta = [
|
||||
item.package_or_corpus,
|
||||
item.section,
|
||||
item.score !== undefined && item.score !== null ? `score ${item.score}` : '',
|
||||
].filter(Boolean).join(' · ');
|
||||
|
||||
const chunkToggle = (chunkText && chunkText !== body) ? `
|
||||
<details class="chunk-details">
|
||||
<summary class="chunk-toggle">View chunk</summary>
|
||||
<pre class="chunk-text">${escapeHtml(chunkText)}</pre>
|
||||
</details>
|
||||
` : '';
|
||||
|
||||
return `
|
||||
<article class="source-card">
|
||||
<h4>${escapeHtml(title)}</h4>
|
||||
${meta ? `<p class="source-meta">${escapeHtml(meta)}</p>` : ''}
|
||||
<p>${escapeHtml(body)}</p>
|
||||
${chunkToggle}
|
||||
</article>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user