MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / load

Method load

runtime/node/agent/memory/file_memory.py:53–70  ·  view source on GitHub ↗

Load existing index or build new one from file sources. Validates index integrity and performs incremental updates if needed.

(self)

Source from the content-addressed store, hash-verified

51 self.file_metadata: Dict[str, Dict[str, Any]] = {}
52
53 def load(self) -> None:
54 """
55 Load existing index or build new one from file sources.
56 Validates index integrity and performs incremental updates if needed.
57 """
58 if self.index_path and os.path.exists(self.index_path):
59 logger.info(f"Loading existing index from {self.index_path}")
60 self._load_from_file()
61
62 # Validate and update if files changed
63 if self._validate_and_update_index():
64 logger.info("Index updated due to file changes")
65 self.save()
66 else:
67 logger.info("Building new index from file sources")
68 self._build_index_from_sources()
69 if self.index_path:
70 self.save()
71
72 def save(self) -> None:
73 """Persist the memory index to disk"""

Calls 5

_load_from_fileMethod · 0.95
saveMethod · 0.95
infoMethod · 0.45

Tested by

no test coverage detected