Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
import type { QueueActivity } from '@features/queue/contracts';
import { getDeterminateProgressFraction } from '@features/queue/contracts';
export interface QueueStatusChip {
count: number;
labelKey: 'idle' | 'loadingModel' | 'offline' | 'paused' | 'queued';
tone: 'neutral' | 'offline' | 'paused' | 'running';
}
export const getQueueStatusChip = (summary: { remaining: number }, activity: QueueActivity): QueueStatusChip => {
switch (activity) {
case 'idle':
return { count: 0, labelKey: 'idle', tone: 'neutral' };
// Work waiting on a lost connection must not read as running: it is neither progressing nor done.
case 'offline':
return { count: summary.remaining, labelKey: 'offline', tone: 'offline' };
case 'paused':
return { count: summary.remaining, labelKey: 'paused', tone: 'paused' };
case 'loading-model':
return { count: summary.remaining, labelKey: 'loadingModel', tone: 'running' };
case 'running':
return { count: summary.remaining, labelKey: 'queued', tone: 'running' };
}
};
/** Progress hairline only while running; paused or offline bars look stalled. */
export const getQueueStatusProgress = (
chip: QueueStatusChip,
percentage: number | null | undefined
): { value: number | null } | undefined =>
chip.tone === 'running' ? { value: getDeterminateProgressFraction(percentage) } : undefined;