rvion / CushyStudio

🛋 The AI and Generative Art platform for everyone
https://docs.cushystudio.com/
GNU Affero General Public License v3.0
662 stars 48 forks source link

Feature Request: Inline Run Button #86

Closed ricklove closed 9 months ago

ricklove commented 9 months ago

I am using a toggle to run a prompt up a specific point:

// ui
previewCrop: form.bool({}),

// run
if (form.previewCrop) {
    graph.PreviewImage({ images: cropped_image });
    await runtime.PROMPT();
    return;
}

This pattern works well, but it requires managing the toggles to ensure only one preview is enabled (or the one you want).

An InlineRun button would have this behavior:

i.e. It would be true only when the button is hit

I would gladly give a try at implementing this if you accept PRs, I'll have to dig around in the code a bit to figure it out.

Let me know if the code architecture would allow for this type of control (that can change the form state, run a prompt, and then change it back) or if it would require major code changes.

ricklove commented 9 months ago

Ok, found that this is possible with useDraft(). I'll try to put a PR together.

ricklove commented 9 months ago

Here is the PR: https://github.com/rvion/CushyStudio/pull/88

ricklove commented 9 months ago

done