feat: 添加 ccw-litellm 安装和卸载后的缓存失效处理,确保数据更新

This commit is contained in:
catlog22
2026-01-12 14:39:37 +08:00
parent 96f0d2a8f1
commit 5ec9ad01a3
2 changed files with 110 additions and 20 deletions

View File

@@ -415,6 +415,11 @@ function handleNotification(data) {
'CodexLens'
);
}
// Invalidate CodexLens page cache to ensure fresh data on next visit
if (typeof window.invalidateCodexLensCache === 'function') {
window.invalidateCodexLensCache();
console.log('[CodexLens] Cache invalidated after installation');
}
// Refresh CLI status if active
if (typeof loadCodexLensStatus === 'function') {
loadCodexLensStatus().then(() => {
@@ -438,6 +443,11 @@ function handleNotification(data) {
'CodexLens'
);
}
// Invalidate CodexLens page cache to ensure fresh data on next visit
if (typeof window.invalidateCodexLensCache === 'function') {
window.invalidateCodexLensCache();
console.log('[CodexLens] Cache invalidated after uninstallation');
}
// Refresh CLI status if active
if (typeof loadCodexLensStatus === 'function') {
loadCodexLensStatus().then(() => {
@@ -531,6 +541,48 @@ function handleNotification(data) {
console.log('[CodexLens] Index complete:', payload.result?.files_indexed, 'files indexed');
break;
case 'CCW_LITELLM_INSTALLED':
// Handle ccw-litellm installation completion
if (typeof addGlobalNotification === 'function') {
addGlobalNotification(
'success',
`ccw-litellm installed successfully`,
{
'Time': new Date(payload.timestamp).toLocaleTimeString()
},
'LiteLLM'
);
}
// Invalidate ccw-litellm status cache
if (typeof window.checkCcwLitellmStatus === 'function') {
window.checkCcwLitellmStatus(true);
}
console.log('[ccw-litellm] Installation completed:', payload);
break;
case 'CCW_LITELLM_UNINSTALLED':
// Handle ccw-litellm uninstallation completion
if (typeof addGlobalNotification === 'function') {
addGlobalNotification(
'success',
`ccw-litellm uninstalled successfully`,
{
'Time': new Date(payload.timestamp).toLocaleTimeString()
},
'LiteLLM'
);
}
// Invalidate ccw-litellm status cache and refresh UI
if (typeof window.checkCcwLitellmStatus === 'function') {
window.checkCcwLitellmStatus(true).then(function() {
if (typeof window.renderCcwLitellmStatusCard === 'function') {
window.renderCcwLitellmStatusCard();
}
});
}
console.log('[ccw-litellm] Uninstallation completed:', payload);
break;
default:
console.log('[WS] Unknown notification type:', type);
}