fix: fix some bugs in rag (#399)

* fix some bugs in rag

* fix a bug in costeer
This commit is contained in:
WinstonLiyt
2024-09-30 02:38:33 +08:00
committed by GitHub
parent a34761a52d
commit 3020789ecf
11 changed files with 207 additions and 128 deletions
+2 -2
View File
@@ -14,12 +14,12 @@ class KnowledgeBase:
if self.path is not None and self.path.exists():
with self.path.open("rb") as f:
self.__dict__.update(
pickle.load(f),
pickle.load(f).__dict__,
) # TODO: because we need to align with init function, we need a less hacky way to do this
def dump(self) -> None:
if self.path is not None:
self.path.parent.mkdir(parents=True, exist_ok=True)
pickle.dump(self.__dict__, self.path.open("wb"))
pickle.dump(self, self.path.open("wb"))
else:
logger.warning("KnowledgeBase path is not set, dump failed.")