fix: Force refresh ccw-litellm status on first page load

- Add isFirstApiSettingsRender flag to track first load
- Force refresh ccw-litellm status on first page load
- Add ?refresh=true query param support to backend API
- Frontend passes refresh param to bypass backend cache
- Subsequent tab switches still use cache for performance

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-25 17:18:23 +08:00
parent 145d38c9bd
commit c5f379ba01
2 changed files with 18 additions and 5 deletions

View File

@@ -554,9 +554,12 @@ export async function handleLiteLLMApiRoutes(ctx: RouteContext): Promise<boolean
// ===========================
// GET /api/litellm-api/ccw-litellm/status - Check ccw-litellm installation status
// Supports ?refresh=true to bypass cache
if (pathname === '/api/litellm-api/ccw-litellm/status' && req.method === 'GET') {
// Check cache first
if (ccwLitellmStatusCache.data &&
const forceRefresh = url.searchParams.get('refresh') === 'true';
// Check cache first (unless force refresh)
if (!forceRefresh && ccwLitellmStatusCache.data &&
Date.now() - ccwLitellmStatusCache.timestamp < ccwLitellmStatusCache.ttl) {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(ccwLitellmStatusCache.data));