{t('media.generate.empty')}
) : ( @@ -1239,6 +1279,16 @@ export function MediaExplorer({ {t('media.generate.action')}{t('media.samples.empty')}
) : ( diff --git a/frontend/src/models/LoraLibrary.test.tsx b/frontend/src/models/LoraLibrary.test.tsx new file mode 100644 index 0000000..d61d467 --- /dev/null +++ b/frontend/src/models/LoraLibrary.test.tsx @@ -0,0 +1,202 @@ +import { act, fireEvent, render, screen, waitFor } from '@testing-library/react' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +import type { ModelProgress, ModelStatus } from '../audio/nativeEngine' + +// Capture the subscriber callbacks so tests can fire watcher / progress events. +let changedCb: (() => void) | null = null +let progressCb: ((event: ModelProgress) => void) | null = null +const modelStatus = vi.fn<() => Promise{t('modelManager.loading')}
+ } + + const snapshot = status.installing + const isInstalling = inflight !== null || snapshot !== null + // The in-flight import's label — live event (detailed) or status snapshot. + const label = + inflight?.family === 'lora' + ? (() => { + const stage = t(`modelManager.stage.${inflight.stage}`, { + defaultValue: inflight.stage, + }) + // The keyed stage carries the wording; only the file (data) rides along. + return inflight.file ? `${stage} ${inflight.file}` : stage + })() + : snapshot?.family === 'lora' + ? t('modelManager.installing') + : null + const repoDraft = normalizeHfRepo(repo) + + return ( ++ {t('modelManager.errorPrefix', { message: error })} +
+ )} + +{t('modelManager.loraNone')}
+ )} + {status.loras.map((adapter) => ( +