Inhalte werden ans LLM übergeben
This commit is contained in:
parent
cf5e53f341
commit
9c4696e9d5
|
|
@ -2,7 +2,7 @@
|
|||
app/core/retriever.py — Hybrider Such-Algorithmus
|
||||
|
||||
Version:
|
||||
0.5.1 (WP-05 Fix: Wrapper-Class added)
|
||||
0.5.2 (WP-05 Fix: Pass content in QueryHit source)
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -261,6 +261,9 @@ def _build_hits_from_semantic(
|
|||
node_key=payload.get("chunk_id") or payload.get("note_id")
|
||||
)
|
||||
|
||||
# FIX: Hier holen wir jetzt den Textinhalt (text, content oder page_content) aus dem Payload
|
||||
text_content = payload.get("page_content") or payload.get("text") or payload.get("content")
|
||||
|
||||
results.append(QueryHit(
|
||||
node_id=str(pid),
|
||||
note_id=payload.get("note_id"),
|
||||
|
|
@ -269,7 +272,11 @@ def _build_hits_from_semantic(
|
|||
centrality_bonus=cent_bonus,
|
||||
total_score=total,
|
||||
paths=None,
|
||||
source={"path": payload.get("path"), "section": payload.get("section") or payload.get("section_title")},
|
||||
source={
|
||||
"path": payload.get("path"),
|
||||
"section": payload.get("section") or payload.get("section_title"),
|
||||
"text": text_content # WICHTIG: Inhalt durchreichen
|
||||
},
|
||||
explanation=explanation_obj
|
||||
))
|
||||
|
||||
|
|
@ -315,22 +322,12 @@ def hybrid_retrieve(req: QueryRequest) -> QueryResponse:
|
|||
return _build_hits_from_semantic(hits, top_k=top_k, used_mode="hybrid", subgraph=subgraph, explain=req.explain)
|
||||
|
||||
|
||||
# --- WP-05 ADDITION: Wrapper Class for Chat Service ---
|
||||
class Retriever:
|
||||
"""
|
||||
Wrapper-Klasse für WP-05 (Chat), die die existierende funktionale Logik nutzt.
|
||||
Stellt sicher, dass WP-04 (/query) und WP-05 (/chat) dieselbe Basis verwenden.
|
||||
Wrapper-Klasse für WP-05 (Chat).
|
||||
"""
|
||||
def __init__(self):
|
||||
# Settings werden in den Funktionen via get_settings() geholt,
|
||||
# daher ist hier kein State nötig.
|
||||
pass
|
||||
|
||||
async def search(self, request: QueryRequest) -> QueryResponse:
|
||||
"""
|
||||
Führt die Suche aus.
|
||||
Mappt auf 'hybrid_retrieve' (synchron), daher trivialer Wrapper.
|
||||
"""
|
||||
# Da hybrid_retrieve synchron ist, blockiert es hier kurz den EventLoop.
|
||||
# Für den aktuellen Scale ist das okay.
|
||||
return hybrid_retrieve(request)
|
||||
Loading…
Reference in New Issue
Block a user