diff --git a/web/widgets.js b/web/widgets.js index bdfb386..f0b9e92 100644 --- a/web/widgets.js +++ b/web/widgets.js @@ -1,8 +1,20 @@ import { app } from "../../scripts/app.js"; import { setCallback } from "./dynamicInputs.js"; -const teaCacheVersions = ["svd_i2v", "Video", "wan", "flux1", "wan_v2.1_1.3b"]; -const numFramesVersions = ["svd_i2v", "Video", "wan", "wan_v2.1_1.3b"]; +/** + * A list of versions can be found here: + * https://github.com/drawthingsai/draw-things-community/blob/6f03f7d4a200ffeb6fdc6022a6ee579e4e534831/Libraries/SwiftDiffusion/Sources/Samplers/Sampler.swift#L4 + * "v1", "v2", "kandinsky2.1", "sdxl_base_v0.9", "sdxl_refiner_v0.9", "ssd_1b", "svd_i2v", + * "wurstchen_v3.0_stage_c", "wurstchen_v3.0_stage_b", "sd3", "pixart", "auraflow", "flux1", + * "sd3_large", "hunyuan_video", "wan_v2.1_1.3b", "wan_v2.1_14b", "hidream_i1" + */ + +// enables tea_cache widget +const teaCacheVersions = ["wan", "flux1", "wan_v2.1_1.3b", "wan_v2.1_14b", "hunyuan_video"]; + +// enables num_frames +// todo: enable fps, guiding_frame_noise, motion_scale, start_frame_guidance +const videoVersions = ["svd_i2v", "Video" /* ? */, "wan" /* ? */, "wan_v2.1_1.3b", "wan_v2.1_14b", "hunyuan_video"]; const allWidgets = [ "settings", @@ -128,6 +140,7 @@ function widgetLogic(node, widget) { break; } break; + case "model": const selectedModel = widget.value; const version = selectedModel?.value?.version; @@ -135,34 +148,15 @@ function widgetLogic(node, widget) { let isSD3 = version === "sd3"; let isFlux = version === "flux1"; - let isVideo = ["svdI2v", "Video", "wan"].includes(version); - let supportTeaCache = teaCacheVersions.includes(version); + const supportTeaCache = teaCacheVersions.includes(version); showWidget(node, "tea_cache", supportTeaCache); - let teaCacheEnabled = supportTeaCache && findWidgetByName(node, "tea_cache")?.value; + const teaCacheEnabled = supportTeaCache && findWidgetByName(node, "tea_cache")?.value; showWidget(node, "tea_cache_start", teaCacheEnabled); showWidget(node, "tea_cache_end", teaCacheEnabled); showWidget(node, "tea_cache_threshold", teaCacheEnabled); - // if (isFlux === false && isVideo === false) { - // showWidget(node, "tea_cache", false); - // showWidget(node, "tea_cache_start", false); - // showWidget(node, "tea_cache_end", false); - // showWidget(node, "tea_cache_threshold", false); - // } else { - // showWidget(node, "tea_cache", true); - // if (findWidgetByName(node, "tea_cache").value === false) { - // showWidget(node, "tea_cache_start", false); - // showWidget(node, "tea_cache_end", false); - // showWidget(node, "tea_cache_threshold", false); - // } else { - // showWidget(node, "tea_cache_start", true); - // showWidget(node, "tea_cache_end", true); - // showWidget(node, "tea_cache_threshold", true); - // } - // } - if (isSD3 === false && isFlux === false) { showWidget(node, "res_dpt_shift", false); } else { @@ -170,7 +164,12 @@ function widgetLogic(node, widget) { } showWidget(node, "speed_up", isFlux); - showWidget(node, "num_frames", numFramesVersions.includes(version)); + + // video options + const isVideo = videoVersions.includes(version); + showWidget(node, "num_frames", isVideo); + // todo: fps, guiding_frame_noise, motion_scale, start_frame_guidance + break; case "high_res_fix":