@@ -11,8 +11,7 @@ import (
1111
1212// putting hugging face api here...
1313
14- func aiPaint (args []string , source * command.MessageSource ) error {
15-
14+ func generateHuggingFaceImage (model string , args []string , source * command.MessageSource ) error {
1615 reply := qq .CreateReply (source .Message )
1716
1817 if len (args ) == 0 {
@@ -25,7 +24,7 @@ func aiPaint(args []string, source *command.MessageSource) error {
2524
2625 inputs := strings .Join (args , " " )
2726
28- b , err := huggingface .GetResultImage ("Nilaier/Waifu-Diffusers" ,
27+ b , err := huggingface .GetResultImage (model ,
2928 huggingface .NewParam (
3029 huggingface .Input (inputs ),
3130 ),
@@ -46,12 +45,28 @@ func aiPaint(args []string, source *command.MessageSource) error {
4645 return qq .SendGroupMessage (msg )
4746}
4847
48+ func aiWaifu (args []string , source * command.MessageSource ) error {
49+ return generateHuggingFaceImage ("Nilaier/Waifu-Diffusers" , args , source )
50+ }
51+
52+ func aiWaifu2 (args []string , source * command.MessageSource ) error {
53+ return generateHuggingFaceImage ("hakurei/waifu-diffusion" , args , source )
54+ }
55+
56+ func aiMadoka (args []string , source * command.MessageSource ) error {
57+ return generateHuggingFaceImage ("yuk/madoka-waifu-diffusion" , args , source )
58+ }
59+
4960var (
50- aiPaintCommand = command .NewNode ([]string {"paint" , "画图" , "画画" , "画" }, "文字生成图像" , false , aiPaint , "<文字>" )
61+ aiWaifuCommand = command .NewNode ([]string {"waifu" }, "文字生成图像(waifu)" , false , aiWaifu , "<文字>" )
62+ aiWaifu2Command = command .NewNode ([]string {"waifu2" }, "文字生成图像(waifu2)" , false , aiWaifu2 , "<文字>" )
63+ aiMadokaCommand = command .NewNode ([]string {"madoka" , "円香" , "画円香" }, "文字生成图像(円香)" , false , aiMadoka , "<文字>" )
5164)
5265
5366var aiCommand = command .NewParent ([]string {"ai" , "人工智能" }, "AI相关指令" ,
54- aiPaintCommand ,
67+ aiWaifuCommand ,
68+ aiWaifu2Command ,
69+ aiMadokaCommand ,
5570)
5671
5772func init () {
0 commit comments