fix: allow reinstall of AI bundles with broken model files (#214)

This commit is contained in:
SnapOtter
2026-06-09 23:07:38 +08:00
parent 3196ba63d5
commit 27a56c774b
2 changed files with 43 additions and 2 deletions
+8 -2
View File
@@ -27,6 +27,7 @@ import {
acquireInstallLock,
getAiDir,
getFeatureStates,
getInstallScriptPath,
getManifestPath,
getModelsDir,
invalidateCache,
@@ -35,6 +36,7 @@ import {
markUninstalled,
releaseInstallLock,
setInstallProgress,
verifyBundleModels,
} from "../lib/feature-status.js";
import { requirePermission } from "../permissions.js";
import { requireAuth } from "../plugins/auth.js";
@@ -137,7 +139,11 @@ export async function registerFeatureRoutes(app: FastifyInstance): Promise<void>
}
if (isFeatureInstalled(bundleId)) {
return reply.status(409).send({ error: `Bundle "${bundleId}" is already installed` });
const modelError = verifyBundleModels(bundleId);
if (!modelError) {
return reply.status(409).send({ error: `Bundle "${bundleId}" is already installed` });
}
markUninstalled(bundleId);
}
if (!acquireInstallLock(bundleId)) {
@@ -145,7 +151,7 @@ export async function registerFeatureRoutes(app: FastifyInstance): Promise<void>
}
const jobId = crypto.randomUUID();
const scriptPath = "/app/packages/ai/python/install_feature.py";
const scriptPath = getInstallScriptPath();
const manifestPath = getManifestPath();
const modelsDir = getModelsDir();