fix linting

This commit is contained in:
zrguo
2025-03-01 18:35:12 +08:00
parent a8f4385c05
commit 9aa438cf79

View File

@@ -1593,17 +1593,17 @@ class LightRAG:
"""Clear cache data from the LLM response cache storage. """Clear cache data from the LLM response cache storage.
Args: Args:
modes (list[str] | None): Modes of cache to clear. Options: ["default", "naive", "local", "global", "hybrid", "mix"]. modes (list[str] | None): Modes of cache to clear. Options: ["default", "naive", "local", "global", "hybrid", "mix"].
"default" represents extraction cache. "default" represents extraction cache.
If None, clears all cache. If None, clears all cache.
Example: Example:
# Clear all cache # Clear all cache
await rag.aclear_cache() await rag.aclear_cache()
# Clear local mode cache # Clear local mode cache
await rag.aclear_cache(modes=["local"]) await rag.aclear_cache(modes=["local"])
# Clear extraction cache # Clear extraction cache
await rag.aclear_cache(modes=["default"]) await rag.aclear_cache(modes=["default"])
""" """
@@ -1620,8 +1620,8 @@ class LightRAG:
try: try:
# Reset the cache storage for specified mode # Reset the cache storage for specified mode
if modes: if modes:
await self.llm_response_cache.delete(modes) await self.llm_response_cache.delete(modes)
logger.info(f"Cleared cache for modes: {modes}") logger.info(f"Cleared cache for modes: {modes}")
else: else:
# Clear all modes # Clear all modes
await self.llm_response_cache.delete(valid_modes) await self.llm_response_cache.delete(valid_modes)
@@ -1634,6 +1634,4 @@ class LightRAG:
def clear_cache(self, modes: list[str] | None = None) -> None: def clear_cache(self, modes: list[str] | None = None) -> None:
"""Synchronous version of aclear_cache.""" """Synchronous version of aclear_cache."""
return always_get_an_event_loop().run_until_complete( return always_get_an_event_loop().run_until_complete(self.aclear_cache(modes))
self.aclear_cache(modes)
)