feat: Update MemoryScope context initialization and Elasticsearch sync operations

This commit is contained in:
fuqingxu.fqx 2024-08-19 17:19:26 +08:00 • committed by jinli.yl
parent bfdc2c7564
commit 8f7fdb7c60
2 changed files with 9 additions and 2 deletions

View file

@ -33,10 +33,10 @@ class MemoryScope(ConfigManager):
self.logger.warning("If a semantic ranking model is not available, MemoryScope will use cosine similarity "
"scoring as a substitute. However, the ranking effectiveness will be somewhat "
"compromised.")
self.context.memory_scope_uuid = datetime.now().strftime(global_conf["logger_name_time_suffix"])
self._context.memory_scope_uuid = datetime.now().strftime(global_conf["logger_name_time_suffix"])
# set context_initialized
self.context.context_initialized = True
self._context.context_initialized = True
# init memory_chat
memory_chat_conf_dict = self.config["memory_chat"]

View file

@ -619,6 +619,13 @@ class SyncElasticsearchStore(BasePydanticVectorStore):
})
return self.sync_query(query, custom_query, es_filter, **kwargs)
def sync_delete_all(self):
self._store.client.delete_by_query(index=[self.index_name], body={"query": {"match_all": {}}})
def sync_search_all(self):
search_res = self._store.client.search(index=[self.index_name], body={"query": {"match_all": {}}})
raise search_res
def sync_query(
self,
query: VectorStoreQuery,