feat(advisor): Legal-RAG Zitier-Metadaten — ai-sdk + Advisor/Drafting lesen article_label

ai-sdk (legal_rag_client/scroll/types) liest die gepinnten Spec-Felder
article_label/regulation_code/article/paragraph/sub/citation_style/is_recital
mit Fallback auf alt-ingestierte Chunks (regulation_id, section); neuer getBool-Helfer.
Advisor + Drafting-Engine bilden die Quellenzeile primaer aus article_label
("BDSG § 38 Abs. 1"), sonst aus den strukturierten Feldern. 17 Tests gruen, tsc sauber.
Vertrag: docs-src/development/rag_reingest_spec.md (§2/§7). Deploy an den Re-Ingest
gekoppelt — neue Felder sind bis dahin leer (graceful Fallback).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-20 14:34:15 +02:00
parent b664d73ffc
commit 017c9b3c12
7 changed files with 198 additions and 7 deletions
@@ -24,6 +24,20 @@ describe('advisor-rag', () => {
expect(out).toEqual([{ content: 'Art. 35 DSGVO ...', source: 'DSGVO', score: 0.91 }])
})
it('haengt article/paragraph an die Quelle an (Fallback ohne article_label)', () => {
const out = mod.mapSdkResults([
{ text: 'Pflicht zur Benennung ...', regulation_short: 'BDSG', article: '§ 38', paragraph: '(1)', score: 0.8 },
])
expect(out).toEqual([{ content: 'Pflicht zur Benennung ...', source: 'BDSG § 38 (1)', score: 0.8 }])
})
it('nutzt article_label direkt, wenn vorhanden (druckbare Fundstelle)', () => {
const out = mod.mapSdkResults([
{ text: 'x', regulation_short: 'BDSG', article: '38', paragraph: '1', sub: 'Satz 2', article_label: 'BDSG § 38 Abs. 1', score: 0.9 },
])
expect(out[0].source).toBe('BDSG § 38 Abs. 1')
})
it('faellt auf regulation_name/code zurueck und filtert leere Inhalte', () => {
const out = mod.mapSdkResults([
{ text: '', regulation_short: 'X' },