Hello all! I’ve been using the AI Character Chat : https://perchance.org/ai-character-chat and I really like it, kudos to the creator(s).

Recently I’ve been trying to generate photos of the character I’m interacting with. I have a few question regarding the ai character chat and how to utilize text-to-image to it’s fullest. I’ve looked over as many posts and questions as I could find but couldn’t find much of anything regarding this. If there are any resources you think I may have missed please feel free to send them over.

1: Is there any way to have the ai remember the description of the character you’re talking to so that I can generate an image with them in it. For example lets say I’ve created a character named Bob and I say that he is a man, brown hair and eyes, wears a cowboy hat, in anime art style. Is there any way to do a

/image [Bob] riding a tractor, looking happy and have it pull in the descriptors I have of Bob on top of whatever additional things I include? /image man, brown hair and eyes, wears a cowboy hat, in anime art style, riding a tractor, looking happy The main reason I want to be able to do this or something similar is just so that I have an easy way of generating images with a recurring character I’ll want to see to go with whatever story I’m currently playing through. Maybe seeding is somehow usable here?

2: If the above would be rather time consuming then my next question is, is it possible to include negative prompts in the /image command or <image> </image> tags?

I won’t mind having to copy paste the original description of the character each time and just adding whatever scenario. Unfortunately I’ve been unable to set negative prompts. If I try /image man riding tractor, brown hair, in the rain (negativePrompt:::sun, bright, blurry) it will ignore the negativePrompt, it all just goes into the main prompt. Same with <image> man riding tractor, brown hair, in the rain (negativePrompt:::sun, bright, blurry) </image>

If anyone has any suggestions on how I can easily generate what will be fairly specific images in the text prompt for this generator that would be amazing. All I want is to RP alone and gen images of wholesome adventures with my companions.

Oh also if anyone has any idea how to stop the AI / Character from responding to the images I generate that would be great (I wouldn’t want to have to toggle on/off auto-reply every time)

Thanks in advance!

  • VioneT@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    edit-2
    2 years ago
    1. You can create a custom command to set a ‘custom data’, then probably use the ‘render’ function to replace [Bob] to the data that is set.

    2. Looking at the current code at the ai-character-chat it seems to not parse correctly the (negativePrompt::: ... ) syntax @perchance@lemmy.world pinging dev :) .

    For the mean time, in this ai-character-chat Google Docs there are characters there that you can use to create images with functioning negative prompt.

    There is also a custom code there that generates an expression of your character based on the their reply. If you need the a ‘custom code’ to set a ‘custom data’ for your character to use (and the parsing) please let me know and I’ll try to code it.

    EDIT: Here is a custom code to remove the auto-reply if you are using the image commands:

    oc.thread.on("MessageAdded", async function () {
      let lastMessage = oc.thread.messages.at(-1);
      if (lastMessage.author === "user") {
        if (/^\/image/.test(lastMessage.content) || /^\<image\>/.test(lastMessage.content)) {
          lastMessage.expectsReply = false;
        }
      };
    })
    
    • perchance@lemmy.worldM
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      Thanks! The (negativePrompt::: ... ) thing was actually a ~bug with the text-to-image plugin. Should be fixed now. Let me know if you see any bugginess, since I did end up cleaning up the code a little - i.e. not completely trivial changes, but all seems fine in my quick tests.

    • Overhorde@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      2 years ago

      Thank you for the reply VioneT! I’ve look at that google document and noticed the AI Artist V2 Generator.

      It looked like there was some potentially usable HTML and JS there to be repurposed for what I am hoping to achieve. In the case of the ‘Custom JavaScript code’ instead of using the the t2i-styles it could be character styles such as i.e Bob’s style, Megan’s style. And of course instead of being a menu I’d like it to dynamically pick up keywords such as [Bob] to fill in those styles during image gen.

      So for example.

      /image [Bob], running through corn field, sweating

      Would somehow trigger a function call to get character styles

      let styles = { “[Bob]”: { prompt: “[input.description], brown hair, grey eyes, shoulder length hair, etc”, negative: “[input.negative], (worst quality, low quality, blurry:1.3), black and white, etc”, }, “[Megan]”: { prompt: “[input.description], green hair, blue eyes, short, long hair, etc”, negative: “[input.negative], (worst quality, low quality, blurry:1.3), black and white, etc”, }

      And based on whatever character keyword was in the /image prompt include the related character style filters. So it would become : /image brown hair, grey eyes, shoulder length hair, running through corn field, sweating

      However after playing around with that generator it seems the negativePrompt there doesn’t work either.

      Unfortunately a lot of this goes over my head as I’m not the most well versed when it comes to JavaScript or Perchance in general. If you would be willing to help make this I would really appreciate it. I’m sure others would love the ability to do what I’m hoping to be able to achieve. Of course please don’t feel obligated to help if you wouldn’t be doing this for fun, there’s no rush.

      Also thank you so much for that auto reply for image gen removal code!

      • VioneT@lemmy.worldM
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        1
        ·
        2 years ago

        Yeah, I just tested the ‘AI Artist V2’ and since the parsing doesn’t work, it also doesn’t work lmao. You could check out the ‘T2I Bot’ Characters, they use the custom code text to image which adds the negative prompt successfully, but you need to re-run the command to generate a new image since it returns only a static image.

        • Overhorde@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 years ago

          Thanks for the reply, RIP ‘AI Artist V2’ I guess haha. I’ll look into repurposing that code in the ‘T2I Bot’ Character. It looked like it should be relatively easy to make the tweaks to achieve what I’m looking for. With the desired goal of being able to easily generate images of specific characters performing different actions when specified in the /image prompt (may even embed image seeds into those prompts to really make the characters gen similarly).

          Any idea how to make it not return static images VioneT? I can probably figure it out but any pointers would be appreciated.

          I’m a bit lazy so idk when I’ll get this done but probably by end of week. I’m not sure what the policy on posting other peoples modified code is (ik this site is big on open source) but I’ll refrain from that for now until I look it up. If anyone else is interested I can send it over. It’ll be mainly for personal use so I don’t plan to add any sort of UI, the only thing you’d really have to do yourself is go into the ‘custom javascript code’, find the styles ‘let’ variable and add one for your character.

          It would be nice if negativePrompts worked with the other input methods but this will have to do for now!

          • VioneT@lemmy.worldM
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            1
            ·
            2 years ago

            Just made this custom code to create a window with text-to-image interface to modify the settings on your generation.

            It still returns a static image, but it would not be constantly adding images on your thread but instead will generate the images on the window. There is also a add image button there to add the image to your thread (for saving).

  • perchance@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    2 years ago

    @Overhorde@lemmy.world @VioneT@lemmy.world As mentioned earlier the negativePrompt stuff is fixed now, but just now I’ve also added an extra few options to the character editor. I’ve added the ability to define a default prefix for all image prompts (i.e. automatically gets added at the start of all image prompts), a default suffix (i.e. added to end), and also an unlimited number of “trigger phrases” which trigger some extra custom text to get added to the prompt. So, for example, you can write:

    Katie: Katie has brown hair, green eyes and a bob haircut. She [...]
    Fruiford: Fruiford is a city with large stone walls and [...]
    Carrot Boy: Carrot Boy is a supervillain who [...]
    /your.?regex.*pattern/: Here's a regex-triggered {example|demo} with Perchance syntax.
    Blah: @prepend This text will be added to the *start* of the prompt when the AI writes 'Blah' in an image generation prompt in your chat.
    

    So, as you can see, this allows you to pull in descriptors during image generation automatically based on character names, etc. Current image gen models kind of see the prompt as a “word soup” so it won’t work awesomely, but upgrade to next-gen is not too far away, so the text-to-image model will be able to interpret complex prompts better - which is important for a feature like this.

    Check the character editor (click “show more settings” at the bottom) to see the input boxes for these. Let me know if you run into any problems! It’s possible I introduced bugs while adding this feature, as always.

    (Also, Vionet, I’m running behind on notifications, but I’ve got some fun stuff in the works, so it’s worth it [though it could take a while]. But if there is anything critical feel free to keep pinging me in case I missed it on my skims of this forum, which I’ve been trying to do ~daily.)

    • BluePower@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      You’re back again! I’ve just noticed this post and your comment recently after having fun and struggle playing and tweaking with the DIY Perchance API and some other Glitch projects. (Yes, I do have a Glitch account now.)

    • VioneT@lemmy.worldM
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      I would mention that having parenthesis as emphasis on the negative prompts still seems to mess it up. Probably a different grouping syntax? E.g. ###negativePrompt::: … ###, and the like that doesn’t use any parenthesis, brackets, or curly brackets.

      • perchance@lemmy.worldM
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        Ohhh, I didn’t think of that! Sorry if I missed that point in an earlier comment. I’ve fixed that now by adding a bracket-depth-counting function. Seems to work well in my tests - let me know if you spot any issues. Thanks!