fix(local-llm): wrap @mlc-ai/web-llm in dynamic import for Docker builds

Move hasModelInCache to local-llm package with dynamic import wrapper
so the browser-only dependency doesn't break server-side builds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-02 12:22:20 +02:00
parent d574dda6a4
commit 919cb4bf35
3 changed files with 17 additions and 1 deletions

View file

@ -10,6 +10,7 @@
MODELS,
type ModelKey,
} from '@manacore/local-llm';
import { hasModelInCache } from '@manacore/local-llm';
import { marked } from 'marked';
import { Robot, Trash, PaperPlaneRight, ClockCounterClockwise } from '@manacore/shared-icons';
@ -29,7 +30,6 @@
if (typeof caches === 'undefined') return;
for (const [key, config] of Object.entries(MODELS)) {
try {
const { hasModelInCache } = await import('@mlc-ai/web-llm');
modelCacheStatus[key] = await hasModelInCache(config.modelId);
} catch {
modelCacheStatus[key] = false;