feat(ai-sdk): /retrieve liefert footnotes[] (C-FN Evidence) für Advisor-Workspace
Footnote-Hits werden aus dem Qdrant-Payload (is_footnote/footnote_label/ footnote_verbatim/ref_citation_unit) in interne LegalSearchResult-Felder (json:"-", kein Pro-Result-Contract-Change) gemappt und im /retrieve-Handler als Top-Level footnotes[] (Frontend RawFootnote-Shape) herausgezogen; Hits bleiben in results[] (LLM-Kontext). figures[] als leerer C8-Platzhalter. Speist den Evidence-Workspace (evidence-adapter.ts) der Frontend-Session. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -111,11 +111,33 @@ func (h *RAGHandlers) Retrieve(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// C-FN: Fußnoten-Hits als separates footnotes[] herausziehen (Frontend RawFootnote-Shape),
|
||||||
|
// damit der Advisor-Evidence-Workspace sie im dedizierten Fußnoten-Bereich rendert. Die Hits
|
||||||
|
// bleiben zusätzlich in results[] (LLM-Kontext). figures[] = C8-Platzhalter (leer bis C8).
|
||||||
|
footnotes := make([]gin.H, 0)
|
||||||
|
for _, r := range results {
|
||||||
|
if !r.IsFootnote {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
footnotes = append(footnotes, gin.H{
|
||||||
|
"id": r.CitationUnit,
|
||||||
|
"ref": r.CitationUnit,
|
||||||
|
"number": r.FootnoteLabel,
|
||||||
|
"regulation_code": r.RegulationCode,
|
||||||
|
"regulation_short": r.RegulationShort,
|
||||||
|
"regulation_name": r.RegulationName,
|
||||||
|
"section": r.RefCitationUnit,
|
||||||
|
"text": r.FootnoteVerbatim,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"query": req.Query,
|
"query": req.Query,
|
||||||
"results": results,
|
"results": results,
|
||||||
"count": len(results),
|
"count": len(results),
|
||||||
"assessment": ucca.Assess(results),
|
"assessment": ucca.Assess(results),
|
||||||
|
"footnotes": footnotes,
|
||||||
|
"figures": []gin.H{},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ type LegalSearchResult struct {
|
|||||||
// Supersede-Status (status="superseded", use_for_primary=false) — Alt-Quelle,
|
// Supersede-Status (status="superseded", use_for_primary=false) — Alt-Quelle,
|
||||||
// die fuer Default-Fragen demoted wird (nicht versteckt; fuer Historie auffindbar).
|
// die fuer Default-Fragen demoted wird (nicht versteckt; fuer Historie auffindbar).
|
||||||
Superseded bool `json:"-"`
|
Superseded bool `json:"-"`
|
||||||
|
|
||||||
|
// C-FN Fußnoten-Evidence — intern (json:"-", kein Pro-Result-Contract-Change),
|
||||||
|
// aus dem Qdrant-Payload befuellt; der /retrieve-Handler baut daraus das Top-Level
|
||||||
|
// footnotes[] fuer den Advisor-Evidence-Workspace (Frontend RawFootnote).
|
||||||
|
IsFootnote bool `json:"-"`
|
||||||
|
FootnoteLabel string `json:"-"`
|
||||||
|
FootnoteVerbatim string `json:"-"`
|
||||||
|
RefCitationUnit string `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// LegalAssessment is the auditable explanation layer over a ranked result set:
|
// LegalAssessment is the auditable explanation layer over a ranked result set:
|
||||||
|
|||||||
@@ -195,6 +195,11 @@ func hitsToResults(hits []qdrantSearchHit) []LegalSearchResult {
|
|||||||
ReferencesOut: getStringSlice(hit.Payload, "references_out"),
|
ReferencesOut: getStringSlice(hit.Payload, "references_out"),
|
||||||
ReferencesIn: getStringSlice(hit.Payload, "references_in"),
|
ReferencesIn: getStringSlice(hit.Payload, "references_in"),
|
||||||
Superseded: getString(hit.Payload, "status") == "superseded",
|
Superseded: getString(hit.Payload, "status") == "superseded",
|
||||||
|
|
||||||
|
IsFootnote: getBool(hit.Payload, "is_footnote"),
|
||||||
|
FootnoteLabel: getString(hit.Payload, "footnote_label"),
|
||||||
|
FootnoteVerbatim: getString(hit.Payload, "footnote_verbatim"),
|
||||||
|
RefCitationUnit: getString(hit.Payload, "ref_citation_unit"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results
|
return results
|
||||||
|
|||||||
Reference in New Issue
Block a user