fix: AI feature install failures — missing rembg session and Fastify 415 (#102, #103)

Register custom BiRefNet-matting ONNX session in install_feature.py so
rembg.new_session("birefnet-matting") no longer raises ValueError during
on-demand installs. The session was already registered in remove_bg.py
(runtime) and download_models.py (build-time) but was missed in the
install path, causing background-removal bundle installs to always fail.

Send JSON body on install/uninstall POST requests to avoid Fastify 5's
strict content-type parser rejecting body-less POSTs with 415.

Fix error message extraction to preserve structured {"error": ...} JSON
from the Python script and filter out pthread_setaffinity_np noise.
This commit is contained in:
SnapOtter
2026-04-27 02:38:17 +08:00
parent 02a84b8741
commit 4f81b29fbc
4 changed files with 75 additions and 9 deletions
+5 -2
View File
@@ -191,7 +191,10 @@ export const useFeaturesStore = create<FeaturesState>((set, get) => {
});
try {
const result = await apiPost<{ jobId: string }>(`/v1/admin/features/${bundleId}/install`);
const result = await apiPost<{ jobId: string }>(
`/v1/admin/features/${bundleId}/install`,
{},
);
listenToProgress(bundleId, result.jobId);
} catch (err) {
const installing = { ...get().installing };
@@ -209,7 +212,7 @@ export const useFeaturesStore = create<FeaturesState>((set, get) => {
uninstallBundle: async (bundleId: string) => {
try {
await apiPost(`/v1/admin/features/${bundleId}/uninstall`);
await apiPost(`/v1/admin/features/${bundleId}/uninstall`, {});
await refreshBundles();
} catch (err) {
set({