Moved file ext to a var.

This commit is contained in:
Marc-Andre Ferland 2022-11-01 04:52:42 -04:00
parent 93b3419737
commit c0350e5be7

View File

@ -117,8 +117,9 @@ const TASK_MAPPING = {
if (pathIdx >= 0) { if (pathIdx >= 0) {
use_stable_diffusion_model = use_stable_diffusion_model.slice(pathIdx + 1) use_stable_diffusion_model = use_stable_diffusion_model.slice(pathIdx + 1)
} }
if (use_stable_diffusion_model.endsWith('.ckpt')) { const modelExt = '.ckpt'
use_stable_diffusion_model = use_stable_diffusion_model.slice(0, use_stable_diffusion_model.length - 5) if (use_stable_diffusion_model.endsWith(modelExt)) {
use_stable_diffusion_model = use_stable_diffusion_model.slice(0, use_stable_diffusion_model.length - modelExt.length)
} }
stableDiffusionModelField.value = use_stable_diffusion_model stableDiffusionModelField.value = use_stable_diffusion_model