fix(heal): restore inpaint-web MI-GAN neural model to resolve grey blob bug

This commit is contained in:
2026-10-16 07:36:25 +07:00
parent 5650fe8888
commit 64e6ff2608
6 changed files with 463 additions and 100 deletions
+8
View File
@@ -31,6 +31,7 @@ import { clearSession, forgetPhoto, loadPhoto, loadState, savePhoto, saveState,
import { analyzeCustomFrame, clearCustomFrame, loadCustomFrame, saveCustomFrame, type CustomFrameData } from './engine/customFrame';
import { keep } from './remember';
import { preloadSuperRes, upscaleJpeg } from './engine/superRes';
import { preloadInpaint, clearInpaintCache } from './engine/inpaint';
import { api, type Photo, type SavedRecipe } from './api';
import { refreshAuth, useAuth } from './auth';
import { TIERS } from './config/tiers';
@@ -1568,6 +1569,7 @@ export function Workspace() {
);
const clearHealSpots = useCallback(() => {
remember();
clearInpaintCache();
// The field is what "this photo was healed" means, so CLEAR drops it rather
// than leaving an empty list behind.
setAdjustment({ heal: undefined });
@@ -1616,6 +1618,7 @@ export function Workspace() {
const editBrushSpots = useCallback(
(spots: (HealSpot | MosaicSpot)[], undo: boolean) => {
if (undo) remember();
clearInpaintCache();
const list = spots.length ? spots : undefined;
if (brushTool === 'mosaic') setAdjustment({ mosaic: list as MosaicSpot[] | undefined });
else setAdjustment({ heal: list as HealSpot[] | undefined });
@@ -3707,6 +3710,11 @@ export function Workspace() {
setBrushTool(null);
} else {
setBrushTool('heal');
// The 27MB of model behind the brush, fetched while the visitor aims.
// Turning the tool on is not the repair, but it is the moment the
// repair becomes certain enough to spend the download on — see
// engine/inpaint.ts on why preloading is bytes and not the runtime.
preloadInpaint();
}
},
},