this post was submitted on 04 Apr 2025
3 points (100.0% liked)

Perchance - Create a Random Text Generator

823 readers
8 users here now

⚄︎ Perchance

This is a Lemmy Community for perchance.org, a platform for sharing and creating random text generators.

Feel free to ask for help, share your generators, and start friendly discussions at your leisure :)

This community is mainly for discussions between those who are building generators. For discussions about using generators, especially the popular AI ones, the community-led Casual Perchance forum is likely a more appropriate venue.

See this post for the Complete Guide to Posting Here on the Community!

Rules

1. Please follow the Lemmy.World instance rules.

2. Be kind and friendly.

  • Please be kind to others on this community (and also in general), and remember that for many people Perchance is their first experience with coding. We have members for whom English is not their first language, so please be take that into account too :)

3. Be thankful to those who try to help you.

  • If you ask a question and someone has made a effort to help you out, please remember to be thankful! Even if they don't manage to help you solve your problem - remember that they're spending time out of their day to try to help a stranger :)

4. Only post about stuff related to perchance.

  • Please only post about perchance related stuff like generators on it, bugs, and the site.

5. Refrain from requesting Prompts for the AI Tools.

  • We would like to ask to refrain from posting here needing help specifically with prompting/achieving certain results with the AI plugins (text-to-image-plugin and ai-text-plugin) e.g. "What is the good prompt for X?", "How to achieve X with Y generator?"
  • See Perchance AI FAQ for FAQ about the AI tools.
  • You can ask for help with prompting at the 'sister' community Casual Perchance, which is for more casual discussions.
  • We will still be helping/answering questions about the plugins as long as it is related to building generators with them.

6. Search through the Community Before Posting.

  • Please Search through the Community Posts here (and on Reddit) before posting to see if what you will post has similar post/already been posted.

founded 2 years ago
MODERATORS
 

I know what the $meta list does, like the title and description, and also the image and the tags parameters, I also know what the header param and sub-params do, but what does the 'dynamic' parameter do? Does it have something to do with changing how the perchance APIs work?

top 5 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 2 months ago

Like, I assume it's for some type of list, like a hierarchial list, because that's all I found on the web.

[–] [email protected] 1 points 2 months ago (1 children)

Where did you find that dynamic parameter?

[–] [email protected] 1 points 2 months ago (1 children)

I saw it when I mistyped "title", and the "This page has errors (click here)" pop-up said

"Looks like you've got some invalid properties in your $meta list? The only valid properties are 'title', 'description', 'image', 'tags', 'header', and 'dynamic'."

As I've said, I know what all of them except for the 'dynamic' one(s) do(es).

[–] [email protected] 1 points 2 months ago* (last edited 2 months ago)

Ah, I think I saw one implemented on the $meta of ai-character-chat here's the code.

$meta
  async dynamic(inputs) => // note that $meta.dynamic function *cannot reference/use any variables/lists/etc. that are outside of itself*. In other words, its code must be *fully* self-contained (i.e. only use `inputs.urlParams`). It must also use pure JavaScript (i.e. no Perchance-specific features like `foo.selectOne`, `foo.titleCase`, etc.).
    let defaults = {
      title: `AI Character Chat (online, free, no sign-up, unlimited)`,   
      description: `Perchance AI Chat - completely free, online, no login, unlimited messages, unlimited AI-generated images. Chat with AI characters via this Character.AI (C.AI) chat alternative. Custom AI character creation. Chat to the default Chloe character, or make your own AI character and talk to them freely - no limits, and no freemium gimicks that lure you to sign up. Completely unlimited, no filter. You can create characters that can send pictures/images/photos, roleplay chatbots, AI RPGs/D&D experiences, an AI Dungeon alternative, anime AI chat, and basically anything else you can think of. No restrictions on daily usage. Like ChatGPT, but for fictional character RPs and AI characters, with image generation in chat.`,
    };
    let fileName;
    if(inputs.urlParams.data && inputs.urlParams.data.endsWith(".gz")) {
      fileName = inputs.urlParams.data.split("~").slice(-1)[0];
    } else if(inputs.urlParams.char) {
      if(inputs.urlParams.char === "assistant") {
        return {
          title: `AI Character Chat (online, free, no sign-up, unlimited)`,   
          description: `AI Chat with characters for roleplaying or to get help with writing, language practice, creative tasks, coding questions, and lots more. Completely free, online, no login, unlimited messages, unlimited AI-generated images. Basically a more creative (and unfiltered/uncensored) ChatGPT alternative. Chat to the Chloe or make an AI assistant/character and talk to them freely - no limits on credits, and no freemium gimicks that lure you to sign up. Completely unlimited, no filter. You can create characters that can send pictures/images/photos, roleplay chatbots, AI RPGs/D&D game masters. Like ChatGPT, but better at fictional character RPs and AI characters, with image generation in chat.`,
        };
      }
      let urlNamedCharacters = {
        "ai-adventure": "6c2f68e41de41e75a51971487c97b2d9.gz",
        "coding-assistant": "570b3c67b8ed9ed8f83ef652be549b1c.gz",
        "story-writer": "76b20593b117ab083d746312df4df296.gz",
        "world-war-simulator": "e1cf5213432a7eb9e310ec269fe38672.gz",
        "psychologist": "615fdef95fa7e75cbbaf943dc44d72be.gz",
        "therapist": "5cdaa39f9aabc7424c3b2e1b780a1e29.gz",
      };
      fileName = urlNamedCharacters[inputs.urlParams.char];
    }
    if(fileName) {
      try {   
        let fileUrl = "https://user-uploads.perchance.org/file/" +  fileName;
        let blob = await fetch(fileUrl, {signal:AbortSignal.timeout ? AbortSignal.timeout(8000) : null}).then(res => res.blob());
        const ds = new DecompressionStream("gzip");
        const decompressedStream = blob.stream().pipeThrough(ds);
        let decompressedBlob = await new Response(decompressedStream).blob();
        let text = await decompressedBlob.text();
        let data = JSON.parse(text);
        let character = data.addCharacter;
        return {
          title: character.metaTitle ? character.metaTitle : `${character.name.slice(0, 40)} - AI Character Chat (free, no sign-up, unlimited)`,
          description: character.metaDescription ? character.metaDescription : `Chat with the ${character.name} AI character. Here's this character's description: ${character.roleInstruction.slice(0, 450).replace(/\s+/g, " ")}`,
          image: character.metaImage ? character.metaImage : character.avatarUrl,
        };
      } catch(e) {
        console.error(e);
        return defaults;
      }
    } else {
      return defaults;   
    }

It essentially takes the URL parameters, then uses it to build the metadata of the page i.e. dynamic images, title, description based on the url parameters.

[–] [email protected] 1 points 2 months ago

I think, though it doesn't work, is if you hover over the link, on a computer, in a list of generators With the image, it will pop up.