* docs: prepare Vendoo 1.41.2 git-ignore boundary hotfix * fix: track native source modules with root-anchored runtime ignores
35 lines
949 B
JavaScript
35 lines
949 B
JavaScript
import manifest from './module.json' with { type: 'json' };
|
|
|
|
let runtime = null;
|
|
let started = false;
|
|
|
|
export function configureAiModule(deps = {}) {
|
|
runtime = {
|
|
startModelJobs: deps.startModelJobs || (() => {}),
|
|
stopModelJobs: deps.stopModelJobs || (() => {}),
|
|
startBatchJobs: deps.startBatchJobs || (() => {}),
|
|
stopBatchJobs: deps.stopBatchJobs || (() => {}),
|
|
};
|
|
}
|
|
|
|
export function createAiModule() {
|
|
return {
|
|
manifest,
|
|
source: 'builtin',
|
|
lifecycle: {
|
|
async start() {
|
|
if (!runtime) throw new Error('AI-Modul ist nicht konfiguriert.');
|
|
runtime.startModelJobs();
|
|
runtime.startBatchJobs();
|
|
started = true;
|
|
},
|
|
async stop() {
|
|
runtime?.stopModelJobs();
|
|
runtime?.stopBatchJobs();
|
|
started = false;
|
|
},
|
|
async health() { return { ok: Boolean(runtime && started), native: true, workers: ['model-photos', 'image-batch'] }; },
|
|
},
|
|
};
|
|
}
|