Новый раг
This commit is contained in:
27
app/modules/rag/indexing/code/entrypoints/registry.py
Normal file
27
app/modules/rag/indexing/code/entrypoints/registry.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class Entrypoint:
|
||||
entry_id: str
|
||||
entry_type: str
|
||||
framework: str
|
||||
route_or_command: str
|
||||
handler_symbol_id: str
|
||||
path: str
|
||||
start_line: int
|
||||
end_line: int
|
||||
metadata: dict = field(default_factory=dict)
|
||||
|
||||
|
||||
class EntrypointDetectorRegistry:
|
||||
def __init__(self, detectors: list) -> None:
|
||||
self._detectors = detectors
|
||||
|
||||
def detect_all(self, *, path: str, symbols: list) -> list[Entrypoint]:
|
||||
items: list[Entrypoint] = []
|
||||
for detector in self._detectors:
|
||||
items.extend(detector.detect(path=path, symbols=symbols))
|
||||
return items
|
||||
Reference in New Issue
Block a user