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

fix: aireply: 修复文字回复模式 #991

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/Baidu-AIP/golang-sdk v1.1.1
github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8
github.com/FloatTech/AnimeAPI v1.7.1-0.20240826120833-9bf54389aadb
github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14
github.com/FloatTech/gg v1.1.3
github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/Baidu-AIP/golang-sdk v1.1.1 h1:RQsAmgDSAkiq22I6n7XJ2t3afgzFeqjY46FGhvrx4cw=
github.com/Baidu-AIP/golang-sdk v1.1.1/go.mod h1:bXnGw7xPeKt8aF7UCELKrV6UZ/46spItONK1RQBQj1Y=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8 h1:2i36tl5VlBWxWxv4WyfWmCA23NaV1fB5/smJtdORHf4=
github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8/go.mod h1:Ru6q5pZUnfMg1iu0M1Hp73q9N3LNIbDr16kjkzyG6Xk=
github.com/FloatTech/AnimeAPI v1.7.1-0.20240826120833-9bf54389aadb h1:j7m84zwcDWLoMLjgG4MDnvanGQoDNnG8A7/aNCnYMIk=
github.com/FloatTech/AnimeAPI v1.7.1-0.20240826120833-9bf54389aadb/go.mod h1:Ru6q5pZUnfMg1iu0M1Hp73q9N3LNIbDr16kjkzyG6Xk=
github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 h1:8O0Iq9MnKsKowltY9txhOqcJdmGTjxHPQ4gEYzbJc9A=
github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14/go.mod h1:OzGLhvmtz1TKIdGaJDd8pQumvD36UqK+dWsiCISmzQQ=
github.com/FloatTech/gg v1.1.3 h1:+GlL02lTKsxJQr4WCuNwVxC1/eBZrCvypCIBtxuOFb4=
Expand Down
15 changes: 8 additions & 7 deletions plugin/aireply/ai_tts.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var (
原 = newapikeystore("./data/tts/o.txt")
ཆཏ = newapikeystore("./data/tts/c.txt")
百 = newapikeystore("./data/tts/b.txt")
桑 = newapikeystore("./data/tts/s.txt")
)

type replymode []string
Expand Down Expand Up @@ -89,6 +90,7 @@ func (r replymode) setReplyMode(ctx *zero.Ctx, name string) error {
}

func (r replymode) getReplyMode(ctx *zero.Ctx) aireply.AIReply {
k := 桑.k
gid := ctx.Event.GroupID
if gid == 0 {
gid = -ctx.Event.UserID
Expand All @@ -97,22 +99,21 @@ func (r replymode) getReplyMode(ctx *zero.Ctx) aireply.AIReply {
if ok {
switch m.GetData(gid) & 0xff {
case 0:
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName)
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName, k, false, 0)
case 1:
return aireply.NewLolimiAi(aireply.MomoURL, aireply.MomoBotName)
return aireply.NewLolimiAi(aireply.MomoURL, aireply.MomoBotName, k, false, 0)
case 2:
return aireply.NewQYK(aireply.QYKURL, aireply.QYKBotName)
case 3:
return aireply.NewXiaoAi(aireply.XiaoAiURL, aireply.XiaoAiBotName)
case 4:
k := ཆཏ.k
if k != "" {
return aireply.NewChatGPT(aireply.ChatGPTURL, k)
if ཆཏ.k != "" {
return aireply.NewChatGPT(aireply.ChatGPTURL, ཆཏ.k)
}
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName)
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName, k, false, 0)
}
}
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName)
return aireply.NewLolimiAi(aireply.JingfengURL, aireply.JingfengBotName, k, false, 0)
}

var ttsins = func() map[string]tts.TTS {
Expand Down
8 changes: 8 additions & 0 deletions plugin/aireply/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ func init() { // 插件主体
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("成功"))
}
enr.OnPrefix("设置文字回复模式", zero.AdminPermission).SetBlock(true).Handle(setReplyMode)
enr.OnRegex(`^设置\s*桑帛云\s*api\s*key\s*(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
err := 桑.set(ctx.State["regex_matched"].([]string)[1])
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
}
ctx.SendChain(message.Text("设置成功"))
})
enr.OnRegex(`^设置\s*ChatGPT\s*api\s*key\s*(.*)$`, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
err := ཆཏ.set(ctx.State["regex_matched"].([]string)[1])
if err != nil {
Expand Down
Loading