Daniel.y commited on
Commit
ed4a52b
·
unverified ·
2 Parent(s): 310568a faa2e4c

Merge pull request #1377 from danielaskdd/main

Browse files

Fix: disable LLM cache recording while enable_llm_cache is disabled

lightrag/api/webui/assets/{index-DV9z38_m.js → index-Du5ct2zA.js} RENAMED
Binary files a/lightrag/api/webui/assets/index-DV9z38_m.js and b/lightrag/api/webui/assets/index-Du5ct2zA.js differ
 
lightrag/api/webui/index.html CHANGED
Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ
 
lightrag/utils.py CHANGED
@@ -731,6 +731,9 @@ async def save_to_cache(hashing_kv, cache_data: CacheData):
731
  hashing_kv: The key-value storage for caching
732
  cache_data: The cache data to save
733
  """
 
 
 
734
  # Skip if storage is None or content is a streaming response
735
  if hashing_kv is None or not cache_data.content:
736
  return
 
731
  hashing_kv: The key-value storage for caching
732
  cache_data: The cache data to save
733
  """
734
+ if not hashing_kv.global_config.get("enable_llm_cache"):
735
+ return
736
+
737
  # Skip if storage is None or content is a streaming response
738
  if hashing_kv is None or not cache_data.content:
739
  return
lightrag_webui/src/App.tsx CHANGED
@@ -25,6 +25,7 @@ function App() {
25
  const [apiKeyAlertOpen, setApiKeyAlertOpen] = useState(false)
26
  const [initializing, setInitializing] = useState(true) // Add initializing state
27
  const versionCheckRef = useRef(false); // Prevent duplicate calls in Vite dev mode
 
28
 
29
  const handleApiKeyAlertOpenChange = useCallback((open: boolean) => {
30
  setApiKeyAlertOpen(open)
@@ -70,6 +71,14 @@ function App() {
70
  }
71
  };
72
 
 
 
 
 
 
 
 
 
73
  // Set interval for periodic execution
74
  const interval = setInterval(performHealthCheck, healthCheckInterval * 1000);
75
  return () => clearInterval(interval);
 
25
  const [apiKeyAlertOpen, setApiKeyAlertOpen] = useState(false)
26
  const [initializing, setInitializing] = useState(true) // Add initializing state
27
  const versionCheckRef = useRef(false); // Prevent duplicate calls in Vite dev mode
28
+ const healthCheckInitializedRef = useRef(false); // Prevent duplicate health checks in Vite dev mode
29
 
30
  const handleApiKeyAlertOpenChange = useCallback((open: boolean) => {
31
  setApiKeyAlertOpen(open)
 
71
  }
72
  };
73
 
74
+ // On first mount or when enableHealthCheck becomes true and apiKeyAlertOpen is false,
75
+ // perform an immediate health check
76
+ if (!healthCheckInitializedRef.current) {
77
+ healthCheckInitializedRef.current = true;
78
+ // Immediate health check on first load
79
+ // performHealthCheck();
80
+ }
81
+
82
  // Set interval for periodic execution
83
  const interval = setInterval(performHealthCheck, healthCheckInterval * 1000);
84
  return () => clearInterval(interval);