Новый раг
This commit is contained in:
18
app/modules/rag/indexing/docs/classifier.py
Normal file
18
app/modules/rag/indexing/docs/classifier.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import PurePosixPath
|
||||
|
||||
from app.modules.rag.contracts import DocKind
|
||||
|
||||
|
||||
class DocsClassifier:
|
||||
def classify(self, path: str) -> str:
|
||||
upper = PurePosixPath(path).name.upper()
|
||||
lowered = path.lower()
|
||||
if "runbook" in lowered or upper.startswith("RUNBOOK"):
|
||||
return DocKind.RUNBOOK
|
||||
if upper.startswith("README"):
|
||||
return DocKind.README
|
||||
if "spec" in lowered or "architecture" in lowered:
|
||||
return DocKind.SPEC
|
||||
return DocKind.MISC
|
||||
Reference in New Issue
Block a user