(projectIds: string[])
| 423 | } |
| 424 | |
| 425 | async function refreshSessionsForProjects(projectIds: string[]) { |
| 426 | const uniqueProjectIds = [...new Set(projectIds.filter(Boolean))]; |
| 427 | if (uniqueProjectIds.length === 0) { |
| 428 | setSessionsByProjectId({}); |
| 429 | return; |
| 430 | } |
| 431 | try { |
| 432 | const entries = await Promise.all(uniqueProjectIds.map(async (projectId) => { |
| 433 | const response = await api.listMcpSessions(projectId); |
| 434 | return [projectId, response.sessions] as const; |
| 435 | })); |
| 436 | setSessionsByProjectId((current) => { |
| 437 | const next = { ...current }; |
| 438 | for (const [projectId, projectSessions] of entries) { |
| 439 | next[projectId] = projectSessions; |
| 440 | } |
| 441 | return next; |
| 442 | }); |
| 443 | } catch (err) { |
| 444 | setError(getErrorMessage(err)); |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | async function clearModelLogs() { |
| 449 | try { |
no test coverage detected