From 9b66ed556abef48d159a7c6dc535b359f7c86fc4 Mon Sep 17 00:00:00 2001 From: senpai-a Date: Thu, 25 Jun 2026 23:52:30 +0900 Subject: [PATCH] allow string placeholder insertion insead of whole string replacement --- src/comfy.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/comfy.js b/src/comfy.js index 9bf58a5..c4bc98f 100644 --- a/src/comfy.js +++ b/src/comfy.js @@ -39,10 +39,17 @@ async function loadWorkflow() { */ function fillWorkflow(workflow, values) { let workflowStr = JSON.stringify(workflow); - for (const [key, value] of Object.entries(values)) { - const placeholder = `"{{${key}}}"`; - const replacement = JSON.stringify(value); + let placeholder; + let replacement; + if (typeof value === "string") { + placeholder = `{{${key}}}`; + replacement = JSON.stringify(value).slice(1, -1); + } + else { + placeholder = `"{{${key}}}"`; + replacement = JSON.stringify(value); + } while (workflowStr.includes(placeholder)) { workflowStr = workflowStr.replace(placeholder, replacement); }