Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Feature: (soft) editable Default Settings #17

Merged
merged 11 commits into from
Oct 29, 2022

Conversation

Pyrotuna
Copy link
Contributor

Default Settings can now be edited by using Slash Commands!

  • Bot now uses per-server settings file under core/generated/
  • Default settings file is built if necessary with default values
  • Default values can be customized per-server for the following defaults:
    • Number of Steps used
    • Negative Prompts (very useful for Nai and WD where a set of negative prompts consistently improve results)
    • Max Number of Steps (limits the value that can be used in either Steps or Default Steps (see above) to a set amount)
    • Default Sampler

@Kilvoctu
Copy link
Owner

I took a quick glance, and there are a lot of changes here. Going to have to take a thorough look at it later.

Generally, I want stablecog.py to only contain the /draw slash command. It's where the magic happens so I want to try to keep it as focused and easy to understand what's going on in there.

If you can, move these slash commands to their own file, like defaultscog.py or something (I'm not great with names). You can see tipscog.py on how I have a self-contained slash command.
In regards to how the two files would interact, you can do all the user defaults stuff in the defaultscog.py, then do from core import defaultscog in stablecog and pull what you need.

I think it also could be condensed down to 1 slash command. I think slash commands need at least 1 required argument which could be the function to view the current options, then the optional arguments are what user wants to update with.

Sorry, I know I'm asking a lot, probably; I really like neat and tidy. The feature is great. It's definitely a pain sometimes to repeatedly put in negative prompts. 😅 Also, yeah idunno how to dynamically get the sampler methods yet too lol

@Pyrotuna
Copy link
Contributor Author

Alright, I'll get to it, hopefully pycord will have mercy on my soul now

@Pyrotuna Pyrotuna closed this Oct 27, 2022
@Pyrotuna Pyrotuna reopened this Oct 27, 2022
@Pyrotuna Pyrotuna marked this pull request as draft October 27, 2022 23:12
@Kilvoctu
Copy link
Owner

Alright, I'll get to it, hopefully pycord will have mercy on my soul now

lol that's me like every day I work on this bot. But in ~1 month I went from zero Python experience, to kinda understanding what I'm looking at. You can keep the PR open and I'll try to help where I can.

@Pyrotuna Pyrotuna marked this pull request as ready for review October 28, 2022 02:55
@Pyrotuna
Copy link
Contributor Author

Pyrotuna commented Oct 28, 2022

Note: I considered merging settings and settingscog but I think it's more organized this way

@Kilvoctu
Copy link
Owner

This is done and ready for review now? 🤔 I see it's set as ready, but there's some commits afterward.

@Pyrotuna
Copy link
Contributor Author

should be ready now (?)

@Kilvoctu
Copy link
Owner

Nice, I'll look at it in-depth later today or tomorrow. Seems to work mostly, there are some minor bugs and mostly cosmetic things which I can handle, but looks good overall. I'll post an update later with any changes I may do.

@Kilvoctu
Copy link
Owner

Kilvoctu commented Oct 29, 2022

All right, I went through the PR and tested it as extensively as I could. I'll have to make a fairly large amount of changes.
As I see the PR is made from your main branch, I'll merge it as is, then apply the changes afterward (and probably break new things) so you can have your main branch if you like your implementation better. I'll go through the changes in no particular order.

  • core/generated folder is not in the PR and there seems to be no check to create it, but I have the resources folder anyway so I'll send the per server jsons there.
  • There's a limitation with slash commands in which they're basically only defined once, and I couldn't find any way around it. So changing defaults causes a few fundamental issues, like if max steps are set to 100, /draw->steps still only shows 5 - 50. While there's error handling to ensure it doesn't break, I want to minimize possibility of a UI blatantly giving user misinformation. The steps choice now requires manual # input instead of providing list of numbers. If the user goes over the maximum, steps will be set to maximum instead, and bot will complain as a way to inform user of the max steps.
  • I like settings.py. I decided to move my startup files check and variables check into it. Some console logs are added for confirmation.
  • Speaking of startup check, the bot will check the servers it's in on startup, and create the jsons as needed (it will also do check again if it enters a new server)
  • The slash command is renamed to /settings, because I want /draw to be at the top of the list. All the options are in that command.
  • settingscog will be refactored to conform with how stablecog looks for consistency in readability. All the json error handling was removed, because it's done now on startup and server join. Instead of sending a message for each option, bot will wait for the user to finish changing their defaults then provide a summary.
  • I generally don't like something like /settings being available to everyone in a server, so updating readme to remind people about integration management permissions.
  • Aside from that, cosmetic things like bot replies and the like.

edit: Want to add, I appreciate the new feature and that you made a PR. I know I change a lot to fit the idea of the "aiya style", but going in and making PRs is a huge help. 👍👍

@Kilvoctu Kilvoctu merged commit 2968bd8 into Kilvoctu:main Oct 29, 2022
Kilvoctu added a commit that referenced this pull request Oct 29, 2022
described in #17 (comment)

also make code a bit more "pythonic"
@Pyrotuna
Copy link
Contributor Author

Wow, that's quite a lot.
Hope I didn't give you more work with the pr 😆

@Kilvoctu
Copy link
Owner

It did take a little while, but in the end it was mostly cosmetics and shuffling some stuff around. You did the heavy lifting by creating the code in the first place 👍

@sadboys2001
Copy link

Would it be possible to add batch count and face restoration to the settings? I like the new settings command by the way.

@philpax
Copy link
Contributor

philpax commented Oct 30, 2022

I've added batch count in #25. Face restoration is part of #24, so needs to be done.

@Kilvoctu
Copy link
Owner

Would it be possible to add batch count and face restoration to the settings? I like the new settings command by the way.

Face restoration, I think is part of the standard payload so it should be as simple as putting "restore_faces": true into the payload.
I would have added it already, but a concern I've been keeping in the back of my mind is the /draw command becoming hugely bloated with options. In addition to what's there now, I still plan to add at least 4-5 more: model selector, styles, face fix, high res fix, and init_url if I can't extend functionality of init_img.
Well, It's probably no big deal. I don't think we'll hit the slash command option limit.

Since it seems simple to add, I'll play around with adding an additional option for face restoration soon and see how I feel about it.

@Pyrotuna
Copy link
Contributor Author

Most boolean choices could perhaps be turned into discord buttons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants