Новый раг

This commit is contained in:
2026-03-01 14:21:33 +03:00
parent 2728c07ba9
commit 1ef0b4d68c
95 changed files with 3145 additions and 927 deletions

View File

@@ -0,0 +1,26 @@
from __future__ import annotations
from app.modules.rag.contracts import EvidenceLink, EvidenceType, RagDocument, RagLayer, RagSource, RagSpan
from app.modules.rag.indexing.code.entrypoints.registry import Entrypoint
class EntrypointDocumentBuilder:
def build(self, source: RagSource, entrypoint: Entrypoint) -> RagDocument:
return RagDocument(
layer=RagLayer.CODE_ENTRYPOINTS,
lang="python",
source=source,
title=entrypoint.route_or_command,
text=f"{entrypoint.framework} {entrypoint.entry_type} {entrypoint.route_or_command}",
span=RagSpan(entrypoint.start_line, entrypoint.end_line),
metadata={
"entry_id": entrypoint.entry_id,
"entry_type": entrypoint.entry_type,
"framework": entrypoint.framework,
"route_or_command": entrypoint.route_or_command,
"handler_symbol_id": entrypoint.handler_symbol_id,
"lang_payload": entrypoint.metadata,
"artifact_type": "CODE",
},
links=[EvidenceLink(type=EvidenceType.CODE_SPAN, target_id=entrypoint.entry_id, path=source.path, start_line=entrypoint.start_line, end_line=entrypoint.end_line)],
)