Skip to content

Commit

Permalink
update sampler choice
Browse files Browse the repository at this point in the history
  • Loading branch information
SpenserCai committed Aug 31, 2023
1 parent d7658ac commit 089928b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion dbot/slash_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Date: 2023-08-16 22:10:00
* @version:
* @LastEditors: SpenserCai
* @LastEditTime: 2023-08-31 15:31:11
* @LastEditTime: 2023-08-31 23:29:27
* @Description: file content
*/
package dbot
Expand Down Expand Up @@ -57,4 +57,5 @@ func (dbot *DiscordBot) SetLongChoice() {
global.LongDBotChoice["control_net_module"] = slash_handler.SlashHandler{}.ControlnetModuleChoice()
global.LongDBotChoice["control_net_model"] = slash_handler.SlashHandler{}.ControlnetModelChoice()
global.LongDBotChoice["sd_model_checkpoint"] = slash_handler.SlashHandler{}.SdModelChoice()
global.LongDBotChoice["sampler"] = slash_handler.SlashHandler{}.SamplerChoice()
}
18 changes: 11 additions & 7 deletions dbot/slash_handler/txt2img.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Date: 2023-08-22 17:13:19
* @version:
* @LastEditors: SpenserCai
* @LastEditTime: 2023-08-31 18:22:35
* @LastEditTime: 2023-08-31 23:29:25
* @Description: file content
*/
package slash_handler
Expand All @@ -21,7 +21,7 @@ import (
"github.com/bwmarrin/discordgo"
)

func (shdl SlashHandler) samplerChoice() []*discordgo.ApplicationCommandOptionChoice {
func (shdl SlashHandler) SamplerChoice() []*discordgo.ApplicationCommandOptionChoice {
choices := []*discordgo.ApplicationCommandOptionChoice{}
modesvc := &intersvc.SdapiV1Samplers{}
modesvc.Action(global.ClusterManager.GetNodeAuto().StableClient)
Expand Down Expand Up @@ -91,11 +91,11 @@ func (shdl SlashHandler) Txt2imgOptions() *discordgo.ApplicationCommand {
Required: false,
},
{
Type: discordgo.ApplicationCommandOptionString,
Name: "sampler",
Description: "Sampler of the generated image. Default: Euler",
Required: false,
Choices: shdl.samplerChoice(),
Type: discordgo.ApplicationCommandOptionString,
Name: "sampler",
Description: "Sampler of the generated image. Default: Euler",
Required: false,
Autocomplete: true,
},
{
Type: discordgo.ApplicationCommandOptionInteger,
Expand Down Expand Up @@ -272,6 +272,10 @@ func (shdl SlashHandler) Txt2imgCommandHandler(s *discordgo.Session, i *discordg
repChoices = shdl.FilterChoice(global.LongDBotChoice["sd_model_checkpoint"], opt)
continue
}
if opt.Name == "sampler" && opt.Focused {
repChoices = shdl.FilterChoice(shdl.SamplerChoice(), opt)
continue
}
}
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionApplicationCommandAutocompleteResult,
Expand Down

0 comments on commit 089928b

Please sign in to comment.