wthit56

joined 4 months ago
[โ€“] wthit56 1 points 2 months ago

There isn't an app. But it sounds like you want to bookmark them? You can have bookmark folders just using your browser.

[โ€“] wthit56 2 points 2 months ago

Awesome ๐Ÿ‘

[โ€“] wthit56 1 points 2 months ago* (last edited 2 months ago)

Oh, well it sounds like there's an issue with that browser. I've not heard of that browser before. But I know everyone else using it isn't having their entire browser shut down by using perchance, so I'm guessing the more common browsers don't have that issue--which suggests it's a problem with your browser rather than the site itself.

So I guess maybe ask people who work on/use that browser about this problem?

[โ€“] wthit56 1 points 2 months ago

Presumably this will be related to whatever inputs you're copy/pasting, right?

[โ€“] wthit56 1 points 2 months ago (3 children)

Oh wow--no idea why that would ever happen. A web page can't directly make that happen, and browsers are built to not just "disappear" or crash from something a web page does. So it must be a crazy perfect storm kind of situation.

Does it say anything about a crash, offer to report the crash, something like that? Does it offer to restore the pages you had open, next time you open the browser? Does it close all tabs and windows of that browser or just the one with perchance in it?

Is it a specific generator page that does this or just when using anything on perchance?

To be clear, I'm fairly certain I cannot do anything to help or fix any of this, nor anyone else apart from whoever made the browser. But still... if there's anything that you can be helped with on this, those questions are how it would start.

[โ€“] wthit56 1 points 2 months ago

Update: I've now made a plugin to do these things for people who don't know the ins-and-outs of what needs to be done to manually manipulate properties/values on a node. https://perchance.org/list-management-plugin

If you spot anything I've missed or messed up I'd be happy to fix it so it's a more "complete" or "correct" implementation. @[email protected]

[โ€“] wthit56 1 points 2 months ago

First step is to look on line 104. And figure out what it's referring to there.

Without seeing the code there's no way of me helping with this. You could share a link to the generator you are working on, if you like.

[โ€“] wthit56 1 points 2 months ago

No. There's a set back-end that we have access to in our generator pages, that's all. It uses a somewhat older Stable Diffusion model. (Or perhaps three models: one for photos, anime, and the "furry" character style.)

The dev has mentioned that they're planning on an image generator update to the back-end soon. Perhaps including image-to-image or other features. But nothing about LoRA or using our own models or however you'd put it, so I doubt those will come to Perchance for now.

If you want those things, I'd recommend using other sites dedicated to AI image generation. This is just an added feature to Perchance, not the focus of the platform, so the dev is not focused on expanding those features.

[โ€“] wthit56 2 points 2 months ago* (last edited 2 months ago)

I'm not sure that's really possible. I don't think you can import from another page in character stuff. (Unless @[email protected] knows different?)

But I think you can literally tell it any prompt to use to generate an image. So maybe include the text from one of those styles in the prompt you give it or something?

[โ€“] wthit56 1 points 2 months ago

Oooooh, unfortunate. Yeah I'll keep an ear out and just let people know to try again in a few days.

[โ€“] wthit56 2 points 2 months ago

Yeah, looks like what you did by commenting that out of the prompt is about right. ๐Ÿ‘

3
Engine study, part 1 (self.perchance)
submitted 3 months ago by wthit56 to c/perchance
 

I've just been through the whole engine, all the code, and learned a lot about how this stuff works! I'm planning on writing my own engine that works the same way but hopefully with a number of efficiencies. Just for fun, mind you. I enjoy a challenge...

I took a load of notes along the way for my own learning, but also have many suggestions and ideas for how things can be optimised, improved, potential bugs quashed, etc. Partly for when I come to code my version and explore that side of things. But I thought @perchance may find it useful.

This is just part 1 of what I learned and my "feedback" about various aspects of the engine code.

Easy Wins

Prototypes

Currently it seems all nodes have all those special properties added to them. Instead, (at least most of) those special properties could be part of some perchance_prototype somewhere. And then use Object.setPrototypeOf() to set the node's prototype to it, or make it in the first place with Object.create() to use the prototype.

That way you don't have definitions and functions on all those objects, just once on the prototype. But they'll all work the same. For a lot less memory, and processing time setting it all up.

String-to-number conversion

+string will convert it to a number, just like that.

Currently try-catch blocks and eval are used, but this doesn't seem necessary in particular. And, at least in theory, is less safe than simply telling JS you want it to be a number primitive.

Also means you don't need to do Number(string), which creates a new full Number object. (Different to a number primitive.) And so uses more memory, which will have to be garbage-collected as a lot of these are only temporary values anyway.

Checking if a string can convert to a number

Speaking of which, you can use isNaN(string) will be true if it is a string of a number, and false if it is not.

The code String(Number(string)) === string creates 2 new temporary objects in memory to be collected, and goes through a lot more processing than using the built-in function for this.

Converting to string

And on the other side, ""+val or val+"" will convert anything to a string, and automatically call its .toString() when available. (I think I saw this used a couple of times in the engine.)

Commonly String(string) is used, which again uses more memory than a simple string primitive.

Function nodes getter

(I'm talking about a fn_name() => for an inline or multiline function.)

Seems that a getter is used to build a new function every time it is accessed. Could be that I misunderstood the code, but it's how it appeared to me. If that's how it's working, it uses more memory for each call and wastes processing time making the function again.

Caching it somehow, even just making the function at load-time would save on all of that.

.replaceText()

Currently it splits and joins, creating a new array each time, so that it replaces all instances found instead of just the first one.

There is a built-in method on strings that does this already: string.replaceAll(find, replace), which doesn't create an array, so should be cheaper on memory. And (likely) quicker on processing too. And accepts a regex as well.

//- keep regexes/simple functions out of functions where they are called, // otherwise it creates a new one every time the function is called, // using more memory every time

Storing reusable objects out of functions

The kind of thing I'm talking about are regexes, for example /^\/\/.*$/.test(line).

And functions, for example array.map((value) => value.toLowerCase()).

In both those cases, the regex or function is recreated every time their parent function is called, using more memory. And when we're talking about some of the complex functions that are used everywhere this can really mount up.

Simply keeping them outside the function they are used in means that object (regex/function) is reused every time instead. And may potentially be reused by multiple different functions too.

//- reuse overriden selectMany (etc.) array.join function override, // to not create a new function every time it is processed.

Reusing overriding methods

A good example of the previous heading is, when an array is created and then has its own .join() or .toString() method added as a simple property. Currently that method is created each time such an array is made--using memory.

When these could all use the same exact function as their methods instead.

...

These are all just thoughts on easy low-hanging fruit that could be plucked for the benefit of how the engine runs. I'm not saying "do as I say" or anything like that, just putting these ideas out there.

Thanks for creating the platform in the first place, it's really fun ๐Ÿ‘

 

Seems the use of // comments, whitespace, ordering things, all break things for reasons that I can't make sense of. Perhaps just part of the way it is checked for errors? Not sure.

Anyway, I've made a generator here: https://perchance.org/1jt36ldioy#edit demonstrating. All the error-producing code is commented out so it doesn't raise an error. Just uncomment one and you'll see the error for that particular one.

 

HTML editor

If you're mainly working on the HTML for a time--or the whole generator is HTML only--working in a smaller box that's underneath the preview (so you can either see a lot of the preview or a lot of the HTML) is a little annoying. A button to swap the editors so you can have the HTML on the left would be cool.

Alternatively (may be more work, I don't know)... Put the preview and REPL ("Tester"?) on the right side, as they're both "live." And put the code editors on the left side, as they're both "code." Then you could make either as big or small as you wanted. And if you don't use the REPL much (like me) you can make that real small still.

Code text size

Personally I'd love the ability to make the text larger, independently of the whole page. I can use ctrl+up/down to make the whole page's size larger or smaller, but I don't want the preview to be larger, or the top buttons to be larger, etc. Just the code itself.

Could be a nice accessibility feature.

1
[text-to-image] Ideas (self.perchance)
submitted 3 months ago by wthit56 to c/perchance
 

promptOptions.context Send in a JS object or a list as a context the prompt has access to. Perhaps options to overload the window (falls through to the window if a name isn't found within the context), or completely contained (only things within the context can be accessed: avoids any name clashing issues).

image({ plain_object }) Allow a normal JS object to be used. Currently the plugin relies on list properties here and there, which means it breaks when a simple JS object is sent even if it has the same exact used properties.

As JS is used to create these images in a lot of generators, this would cut out the need for the engine to get involved and generate the promptOptions object at all. And the creator doesn't have to worry about how the lists work to be able to use the image generator.

promptOptions.select() When a button is clicked to "select" a particular generated image's settings... if there's a .select() function available, call it with everything to do with that generation: prompt object, etc. Maybe if there is no such function, don't show that button.

This could be used to set up the generator's textarea and other options in whatever way the creator sees fit. Or even to use this function for any other thing.

We can sort of half do this by giving each generation an id, and adding our own button next to it. And I think we can get some sort of info about a generation from its iframe? Maybe? Not sure.

But anyway, this would be a simple way of reaching in and out of the generation iframes.

Show prompt while loading: and just an idea to show the text prompt/negative prompt while the image is loading. It's useful as a creator/user to see what the prompt is that's actually generated--and nip it in the bud if we can see it's malformed or bugged in some way. Just an idea.

 

This would allow things like linking to a specific heading in the tutorial, for example.

You could also make the hash accessible to the generator app. (I don't know if the url is already available.)

1
submitted 4 months ago by wthit56 to c/perchance
 

If I'm working on more UI-type stuff, things can fail silently in quite confusing ways... because I don't have dev tools open, because I'm essentially already using an IDE. But that IDE isn't showing me some errors--I think because they are happening in event handlers and such, and so aren't directly run by the engine.

So I was thinking if window.onerror was monitored those could be caught too.

...

On a related note, I noticed that if you throw "a message" (I'm lazy and it's usually absolutely fine with dev tools)... instead of throw new Error("a message"), the engine itself errors-out and doesn't even show that actual message.

I think this is because it assumes it is an Error object, when it may not be. A check for that, and handling of any thrown value would just make it more rock-solid when it comes to showing users their errors.

...

On another related note, I saw this in the code:

// The following line is a hack to make it so "pause on caught errors" works for perchance errors in devtools.
// Click the function names in the "call stack" to go "back in time" and find more details about your error (ask for help on the forum if needed)

And I feel seen! ๐Ÿ˜œ

 

Does this actually do anything? I notice that no one uses this feature but it's there in text-to-image-plugin.

I've set up a little test, and... it generates images. Here. Unclear if they are affected by the referenceImage I've given it though. Perhaps there is a particular kind of test I could try to see it in action? Or if you could let me know what I'm doing wrong?

 

I know there's some code in there about default values if it's just a string... but it doesn't seem to be working right. When I use that, it's super tall and skinny on the page.

3
submitted 4 months ago* (last edited 4 months ago) by wthit56 to c/perchance
 

(Sorry if this wasn't the right way of posting this bug. Just let me know how it should be done and I'll remember for next time.)

It appears that it interprets a prompt that is a number as being a number value. I have no idea why. This breaks because it's trying to do some .replace() on the prompt to make a tooltip it seems.

This doesn't just happen in my own app. If you use No Style on AI Image Generator, it errors too.

Numbers this happens for are integers 123, floats 1.23, with or without a negative sign -123. If it's got anything but the above in the prompt, even a space, or a leading zero, it does not bug out. But of course ideally, people wouldn't have to find this workaround to make sure their generator doesn't error-out. (Though I'm sure most people haven't found this problem, so the problem likely would happen to most or all image generators.)

 

Seeing this appear on your page with no actual error message has got to be the bane of perchance users across the world ๐Ÿ˜…

It's really opaque, and gives you nothing to go on. So you resort to commenting out whole sections of code trying to get any clue as to what the problem is.

It would really improve the experience of developing apps if there was a real message somewhere for us to see.

 

Currently to go through each match, I have to use ctrl+f, enter over and over which is awkward and tedious. Would be great if that line at the top stayed and let us press enter over and over to get to the next match. Perhaps shift+enter to go to the previous match. And little buttons in there to do the same.

Right now, finding stuff in my code is a pretty annoying process.

3
[Request] Logging (self.perchance)
submitted 4 months ago* (last edited 4 months ago) by wthit56 to c/perchance
 

Logging is a key thing to have for simpler debugging of code. Normally console.log would be used for this, when developing with JS.

It seems we cannot use console.log within code--at least I have not been able to get it to work. Even if it worked, it would be a bit messy having the whole dev tools pane open on top of all the existing frames in the editor.

So some sort of logging out functionality and view would be useful I think--just the stuff logged by the user's code. Even in the little REPL in the corner maybe? Or a tab within that? Whatever is fine.

Just something to help people debug with this simple method. For now, I've made my own which just logs to the page itself.

log(msg) => document.body.appendChild(document.createElement("div")).innerText = msg;
view more: โ€น prev next โ€บ