feat(advisor): v3 Clarity Gate — Case model + clarify/answer contract, [n] citations
Builds the FE against the SDK<->FE Clarity-Gate contract (board 2026-07-01 /
advisor-clarity-gate-contract). The advisor is now a CASE, not a chat:
- Request {question, context?}; response {mode: clarify|answer, clarity, general_answer,
answer, evidence, citations, visual_evidence, footnotes}.
- clarify mode: short L1 general answer (marked "allgemeine Definition, ohne Rechtsquelle")
+ domain context chips; picking a chip re-runs the case scoped (-> answer).
- answer mode: markdown answer with clickable [n] citation markers coupled to evidence
cards (highlight + scroll), evidence grouped by document family, visual_evidence
(visual_type), footnotes, honest summary counts (no trust score).
- FE never parses the answer for structure — only the deliberate [n] markers, mapped via
citations[]. New: contract.ts, useAdvisorCase, useCitationHighlight, ClarifyView,
EvidenceUnitCard, VisualEvidencePane, CaseView. Removed the v2 stream/chat components.
NOT deployed: FE shape-switch (JSON modes) must deploy TOGETHER with the SDK endpoint
delivering the contract (board deploy-coupling). Proxy/route.ts unchanged (SDK-owned).
tsc clean, 16 vitest (incl. clarify+answer fixtures), check-loc 0.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
'use client'
|
||||
|
||||
import { Hash } from 'lucide-react'
|
||||
import type { FootnoteUnit } from '@/lib/sdk/advisor/evidence'
|
||||
import type { Footnote } from '@/lib/sdk/advisor/contract'
|
||||
import { PaneHeader } from './PaneHeader'
|
||||
|
||||
/** Footnotes pane (C-FN) — rendered only when present. */
|
||||
export function FootnotesPane({ footnotes }: { footnotes: FootnoteUnit[] }) {
|
||||
export function FootnotesPane({ footnotes }: { footnotes: Footnote[] }) {
|
||||
if (footnotes.length === 0) return null
|
||||
return (
|
||||
<section>
|
||||
<PaneHeader icon={<Hash className="h-3.5 w-3.5 text-gray-500" />} title="Fußnoten" count={footnotes.length} />
|
||||
<div className="space-y-1">
|
||||
{footnotes.map((fn) => (
|
||||
<div key={fn.id} className="rounded-md border border-gray-200 bg-white p-2 text-[11px]">
|
||||
<span className="font-semibold text-gray-900">{fn.ref}</span>
|
||||
<span className="text-gray-400">
|
||||
{' · '}
|
||||
{fn.source.short}
|
||||
{fn.section ? ` / ${fn.section}` : ''}
|
||||
</span>
|
||||
{footnotes.map((fn, i) => (
|
||||
<div key={fn.footnote_id || i} className="rounded-md border border-gray-200 bg-white p-2 text-[11px]">
|
||||
<span className="font-semibold text-gray-900">{fn.ref || `Fußnote ${i + 1}`}</span>
|
||||
{(fn.document || fn.section) && (
|
||||
<span className="text-gray-400">
|
||||
{' · '}
|
||||
{fn.document}
|
||||
{fn.section ? ` / ${fn.section}` : ''}
|
||||
</span>
|
||||
)}
|
||||
{fn.text && <p className="mt-0.5 text-gray-600">{fn.text}</p>}
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user