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:
@@ -31,6 +31,12 @@ interface SdkRagResult {
|
||||
regulation_code?: string
|
||||
regulation_name?: string
|
||||
regulation_short?: string
|
||||
article_label?: string
|
||||
article?: string
|
||||
paragraph?: string
|
||||
sub?: string
|
||||
citation_style?: string
|
||||
is_recital?: boolean
|
||||
category?: string
|
||||
source_url?: string
|
||||
score?: number
|
||||
@@ -47,7 +53,15 @@ export function mapSdkResults(results: SdkRagResult[] | undefined): ScoredPassag
|
||||
return (results || [])
|
||||
.map((r) => ({
|
||||
content: r.text || '',
|
||||
source: r.regulation_short || r.regulation_name || r.regulation_code || 'Unbekannt',
|
||||
// Fundstelle: article_label ist die fertig formatierte, druckbare Quelle aus der
|
||||
// Ingestion ("BDSG § 38 Abs. 1"); Fallback baut sie aus den strukturierten Feldern
|
||||
// (bzw. alt-ingestierte Chunks ohne Legal-Metadaten). Siehe rag_reingest_spec.md §2/§7.
|
||||
source:
|
||||
(r.article_label && r.article_label.trim()) ||
|
||||
[r.regulation_short || r.regulation_name || r.regulation_code, r.article, r.paragraph, r.sub]
|
||||
.filter(Boolean)
|
||||
.join(' ') ||
|
||||
'Unbekannt',
|
||||
score: typeof r.score === 'number' ? r.score : 0,
|
||||
}))
|
||||
.filter((p) => p.content)
|
||||
|
||||
Reference in New Issue
Block a user