diff --git a/sidekick/memory.py b/sidekick/memory.py index e23b299..c241399 100644 --- a/sidekick/memory.py +++ b/sidekick/memory.py @@ -61,9 +61,10 @@ def save_context(self, info: str, extract_context: bool = True) -> Dict: if extract_context: # Update context.json file for tracking entities content_file_path = f"{self.path}/var/lib/tmp/data/context.json" + context_dict = extracted_entity if Path(content_file_path).exists(): context_dict = json.load(open(content_file_path, "r")) context_dict.update(extracted_entity) - with open(content_file_path, "w") as outfile: - json.dump(context_dict, outfile, indent=4, sort_keys=False) + with open(content_file_path, "w") as outfile: + json.dump(context_dict, outfile, indent=4, sort_keys=False) return res diff --git a/sidekick/prompter.py b/sidekick/prompter.py index 0c235ce..2715f9f 100644 --- a/sidekick/prompter.py +++ b/sidekick/prompter.py @@ -112,6 +112,7 @@ def update_context(): context_dict = """{\n"": ""\n} """ content_file_path = f"{base_path}/var/lib/tmp/data/context.json" + context_str = context_dict if Path(f"{base_path}/var/lib/tmp/data/context.json").exists(): context_dict = json.load(open(content_file_path, "r")) context_dict[""] = "