add logger.debug for mongo_impl get_by_mode_and_id()

This commit is contained in:
bingo
2025-01-13 07:27:30 +00:00
parent f28b90b2b3
commit 1984da0fd6
2 changed files with 12 additions and 6 deletions

View File

@@ -45,7 +45,9 @@ class MongoKVStorage(BaseKVStorage):
for mode, items in data.items(): for mode, items in data.items():
for k, v in tqdm_async(items.items(), desc="Upserting"): for k, v in tqdm_async(items.items(), desc="Upserting"):
key = f"{mode}_{k}" key = f"{mode}_{k}"
result = self._data.update_one({"_id": key}, {"$setOnInsert": v}, upsert=True) result = self._data.update_one(
{"_id": key}, {"$setOnInsert": v}, upsert=True
)
if result.upserted_id: if result.upserted_id:
logger.debug(f"\nInserted new document with key: {key}") logger.debug(f"\nInserted new document with key: {key}")
data[mode][k]["_id"] = key data[mode][k]["_id"] = key
@@ -61,7 +63,7 @@ class MongoKVStorage(BaseKVStorage):
v = self._data.find_one({"_id": mode + "_" + id}) v = self._data.find_one({"_id": mode + "_" + id})
if v: if v:
res[id] = v res[id] = v
print(f"find one by:{id}") logger.debug(f"llm_response_cache find one by:{id}")
return res return res
else: else:
return None return None

View File

@@ -48,7 +48,11 @@ class Neo4JStorage(BaseGraphStorage):
URI, auth=(USERNAME, PASSWORD) URI, auth=(USERNAME, PASSWORD)
) )
_database_name = "home database" if DATABASE is None else f"database {DATABASE}" _database_name = "home database" if DATABASE is None else f"database {DATABASE}"
with GraphDatabase.driver(URI, auth=(USERNAME, PASSWORD), max_connection_pool_size=MAX_CONNECTION_POOL_SIZE) as _sync_driver: with GraphDatabase.driver(
URI,
auth=(USERNAME, PASSWORD),
max_connection_pool_size=MAX_CONNECTION_POOL_SIZE,
) as _sync_driver:
try: try:
with _sync_driver.session(database=DATABASE) as session: with _sync_driver.session(database=DATABASE) as session:
try: try: