https://perchance.org/8swe0svvsk#edit

The same exact call in a code block vs a script tag behaves differently. The values seem to arrive to the plugin okay, but then get funky at some point–no idea why.

  • wthit56@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    Oh labels! Yeah that would do it. Very head-scratching, that one 😅

    (In case you’re confused as to why I’m even using that code in the first place, [before : after : 0.9] is a StableDiffusion thing.)

    Makes sense that code blocks might evaluateItem. But calling evaluateItem when setting innerHTML doesn’t fix it.

    And the way in which it is different is what is so confusing to me. In both cases I’m sending a string to the plugin, and logging out the value through each step of the process.

    • In the script case after running it through createPerchanceTree() it becomes 0.5, which is how that label issue happens. Even though I escape it beforehand so that it won’t be read as a [code block]. You can see it just sends 0.5, through the image generated by it.

    • In the code block case after running the same escaped string through createPerchanceTree() it stays as the normal string. You can see it gets the full [cat : statue : 0.5] prompt, through that other generated image that actually looks like a cat.

    I can’t see any reason why internally my function behaves differently, before it’s got anywhere near back to the page or evaluateItem etc.

    I’ll work on making a simplified case to get closer to the cause…