Merge pull request #1377 from danielaskdd/main

Fix: disable LLM cache recording while enable_llm_cache is disabled
This commit is contained in:
Daniel.y
2025-04-15 21:06:14 +08:00
committed by GitHub
4 changed files with 43 additions and 31 deletions

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@
<link rel="icon" type="image/svg+xml" href="logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lightrag</title>
<script type="module" crossorigin src="/webui/assets/index-DV9z38_m.js"></script>
<script type="module" crossorigin src="/webui/assets/index-Du5ct2zA.js"></script>
<link rel="stylesheet" crossorigin href="/webui/assets/index-CWu3545z.css">
</head>
<body>

View File

@@ -731,6 +731,9 @@ async def save_to_cache(hashing_kv, cache_data: CacheData):
hashing_kv: The key-value storage for caching
cache_data: The cache data to save
"""
if not hashing_kv.global_config.get("enable_llm_cache"):
return
# Skip if storage is None or content is a streaming response
if hashing_kv is None or not cache_data.content:
return

View File

@@ -25,6 +25,7 @@ function App() {
const [apiKeyAlertOpen, setApiKeyAlertOpen] = useState(false)
const [initializing, setInitializing] = useState(true) // Add initializing state
const versionCheckRef = useRef(false); // Prevent duplicate calls in Vite dev mode
const healthCheckInitializedRef = useRef(false); // Prevent duplicate health checks in Vite dev mode
const handleApiKeyAlertOpenChange = useCallback((open: boolean) => {
setApiKeyAlertOpen(open)
@@ -70,6 +71,14 @@ function App() {
}
};
// On first mount or when enableHealthCheck becomes true and apiKeyAlertOpen is false,
// perform an immediate health check
if (!healthCheckInitializedRef.current) {
healthCheckInitializedRef.current = true;
// Immediate health check on first load
// performHealthCheck();
}
// Set interval for periodic execution
const interval = setInterval(performHealthCheck, healthCheckInterval * 1000);
return () => clearInterval(interval);