mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-22 00:32:49 +00:00
- add neo4j dependency to project requirements - introduce NetworkXFileGraph to replace LocalFileGraph implementation - rename local_file_graph.py to networkx_file_graph.py with updated component registration as 'networkx' - remove pickle persistence logic from NetworkX backend, simplify initialization - update Neo4jFileGraph to return FileLink objects instead of (FileNode, FileLink) tuples from get_inlinks/get_outlinks methods - remove unused AsyncIterator import and adjust method signatures - add BareFileParser for handling binary/attachment files without content parsing - move wikilink resolution utilities to dedicated utility module - refactor memory I/O to use file graph's link resolution methods directly - remove link extraction utilities from schema module, consolidate in utils.wikilink_resolver
31 lines
964 B
Python
31 lines
964 B
Python
"""
|
|
BareFileParser — stat-only node for non-text files (attachments).
|
|
"""
|
|
from pathlib import Path
|
|
|
|
from .base_file_parser import BaseFileParser
|
|
from ..component_registry import R
|
|
from ...schema import FileChunk, FileNode
|
|
|
|
|
|
@R.register("bare")
|
|
class BareFileParser(BaseFileParser):
|
|
"""Stat-only parser for attachment/binary files.
|
|
|
|
No content read, no chunking, no link extraction. The resulting
|
|
``FileNode`` has empty ``links`` and ``chunk_ids``; ``front_matter``
|
|
carries ``mime`` and ``size`` as extras so retrieval can filter by
|
|
file type without reopening the file.
|
|
"""
|
|
|
|
async def parse(self, path: str | Path) -> tuple[FileNode, list[FileChunk]]:
|
|
file_path = Path(path)
|
|
stat = file_path.stat()
|
|
rel_path = self._get_relative_path(path)
|
|
node = FileNode(
|
|
path=rel_path,
|
|
st_mtime=stat.st_mtime,
|
|
links=[],
|
|
chunk_ids=[],
|
|
)
|
|
return node, []
|