Skip to content

Commit e1bd330

Browse files
committed
feat(aichat): support config reasoning effort
1 parent cd4090c commit e1bd330

9 files changed

Lines changed: 26 additions & 25 deletions

File tree

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ go 1.26.1
44

55
require (
66
github.com/Baidu-AIP/golang-sdk v1.1.1
7-
github.com/FloatTech/AnimeAPI v1.7.1-0.20251028071248-0c948e3db65c
8-
github.com/FloatTech/floatbox v0.0.0-20251002074805-f95cbc7edb31
7+
github.com/FloatTech/AnimeAPI v1.7.1-0.20260408142737-1e9f2594e3cd
8+
github.com/FloatTech/floatbox v0.0.0-20260408141530-dc0fdf584f62
99
github.com/FloatTech/gg v1.1.4-0.20260404155637-671db2feeebb
1010
github.com/FloatTech/rendercard v0.2.4-0.20260404155919-1fede0bcd22b
1111
github.com/FloatTech/sqlite v1.7.2
1212
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
1313
github.com/FloatTech/zbpctrl v1.7.1
14-
github.com/FloatTech/zbputils v1.7.2-0.20260425100012-1470ceff54d5
14+
github.com/FloatTech/zbputils v1.7.2-0.20260510095247-3e9f8cf88d2d
1515
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
1616
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
1717
github.com/Tnze/go-mc v1.20.2
@@ -29,7 +29,6 @@ require (
2929
github.com/fumiama/imgsz v0.0.4
3030
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
3131
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4
32-
github.com/fumiama/terasu v1.0.2
3332
github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6
3433
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
3534
github.com/google/uuid v1.6.0
@@ -68,6 +67,7 @@ require (
6867
github.com/fumiama/gofastTEA v0.1.3 // indirect
6968
github.com/fumiama/gozel v0.0.0-20260329105205-a95fde52433a // indirect
7069
github.com/fumiama/orbyte v0.0.0-20251002065953-3bb358367eb5 // indirect
70+
github.com/fumiama/terasu v1.0.2 // indirect
7171
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
7272
github.com/go-ole/go-ole v1.2.6 // indirect
7373
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
github.com/Baidu-AIP/golang-sdk v1.1.1 h1:RQsAmgDSAkiq22I6n7XJ2t3afgzFeqjY46FGhvrx4cw=
22
github.com/Baidu-AIP/golang-sdk v1.1.1/go.mod h1:bXnGw7xPeKt8aF7UCELKrV6UZ/46spItONK1RQBQj1Y=
3-
github.com/FloatTech/AnimeAPI v1.7.1-0.20251028071248-0c948e3db65c h1:fmvlRUzwoK6KdoRSW+XeTQ9myKHimd0pV6GbmRJLNRo=
4-
github.com/FloatTech/AnimeAPI v1.7.1-0.20251028071248-0c948e3db65c/go.mod h1:cuDd67B23xmICSmFBhWzXN51blod2BlM1liN9Ux0pSc=
5-
github.com/FloatTech/floatbox v0.0.0-20251002074805-f95cbc7edb31 h1:2K+/M64ixD1Pg5hr00Nbxr7GoWQOgahvpmp1pAMnrYc=
6-
github.com/FloatTech/floatbox v0.0.0-20251002074805-f95cbc7edb31/go.mod h1:kf+Ywc2lk8PLdg3RX0vrUmFLPO6k+23MFmt4GviV8C0=
3+
github.com/FloatTech/AnimeAPI v1.7.1-0.20260408142737-1e9f2594e3cd h1:1L91nA4W2FNCFlvxAT5UfIvmW40zeH3ho4KkHrlAt0c=
4+
github.com/FloatTech/AnimeAPI v1.7.1-0.20260408142737-1e9f2594e3cd/go.mod h1:OrsOAZ8dFDWAExDTyFimoCskDHowjCU2J7zbbjxx9KU=
5+
github.com/FloatTech/floatbox v0.0.0-20260408141530-dc0fdf584f62 h1:w9KO9/zSwnh7+68HOmvIC9gt7Kgy6EPYrMnPh20HeBA=
6+
github.com/FloatTech/floatbox v0.0.0-20260408141530-dc0fdf584f62/go.mod h1:Cpt6REv4OE5VrO5uA/hdVEofnfyUB2BVJEwYACubLOc=
77
github.com/FloatTech/gg v1.1.4-0.20260404155637-671db2feeebb h1:9CxMctre5XIsFHNQTzZvdg5kLub5QZEsrV6E5rSKKfs=
88
github.com/FloatTech/gg v1.1.4-0.20260404155637-671db2feeebb/go.mod h1:nweVlCnDkEXFVRq6t8gkzoUgD5uVI/5yAjBFfQDdE3Y=
99
github.com/FloatTech/rendercard v0.2.4-0.20260404155919-1fede0bcd22b h1:xo68n707/B8tdsqQz3FB5YaBXd/X5FUeQqUgXKdtOPU=
@@ -14,8 +14,8 @@ github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d h1:mUQ/c3wXKsUGa4Sg9
1414
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
1515
github.com/FloatTech/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
1616
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
17-
github.com/FloatTech/zbputils v1.7.2-0.20260425100012-1470ceff54d5 h1:gg8JjL1BEdDN2tmpL/lBcWn8EHHqfu+LaXC/dRbzuOU=
18-
github.com/FloatTech/zbputils v1.7.2-0.20260425100012-1470ceff54d5/go.mod h1:DavniRwuFvJcHCkK6kt4Y257TPg63k/jvXRmdIKQFo4=
17+
github.com/FloatTech/zbputils v1.7.2-0.20260510095247-3e9f8cf88d2d h1:V4ZS5ER8TkE6SypmaT1h8Nrsf6QZkyMAsbiWueoqIQU=
18+
github.com/FloatTech/zbputils v1.7.2-0.20260510095247-3e9f8cf88d2d/go.mod h1:DavniRwuFvJcHCkK6kt4Y257TPg63k/jvXRmdIKQFo4=
1919
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
2020
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
2121
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=

plugin/aichat/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func init() {
8484
if !stor.NoAgent() && chat.AC.AgentAPI != "" && chat.AC.AgentModelName != "" && chat.AC.Key != "" {
8585
logrus.Debugln("[aichat] enter agent mode")
8686
x := deepinfra.NewAPI(chat.AC.AgentAPI, string(chat.AC.AgentKey))
87-
mod, err := chat.AC.Type.Protocol(chat.AC.AgentModelName, temperature, topp, maxn)
87+
mod, err := chat.AC.Type.Protocol(chat.AC.AgentModelName, temperature, topp, maxn, chat.AC.ReasoningEffort)
8888
if err != nil {
8989
logrus.Warnln("ERROR: ", err)
9090
return
@@ -103,7 +103,7 @@ func init() {
103103
ag := chat.AgentOf(ctx.Event.SelfID, c.Service)
104104
logrus.Debugln("[aichat] got agent")
105105
if chat.AC.ImageAPI != "" && !ag.CanViewImage() {
106-
mod, err := chat.AC.ImageType.Protocol(chat.AC.ImageModelName, temperature, topp, maxn)
106+
mod, err := chat.AC.ImageType.Protocol(chat.AC.ImageModelName, temperature, topp, maxn, chat.AC.ReasoningEffort)
107107
if err != nil {
108108
logrus.Warnln("ERROR: ", err)
109109
return
@@ -147,7 +147,7 @@ func init() {
147147
}
148148

149149
x := deepinfra.NewAPI(chat.AC.API, string(chat.AC.Key))
150-
mod, err := chat.AC.Type.Protocol(chat.AC.ModelName, temperature, topp, maxn)
150+
mod, err := chat.AC.Type.Protocol(chat.AC.ModelName, temperature, topp, maxn, chat.AC.ReasoningEffort)
151151
if err != nil {
152152
logrus.Warnln("ERROR: ", err)
153153
return

plugin/aichatcfg/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var (
3939
"- 设置AI聊天最大长度4096\n" +
4040
"- 设置AI聊天TopP 0.9\n" +
4141
"- 设置AI聊天(不)以AI语音输出\n" +
42+
"- 设置AI聊天努力度none(留空则清除)\n" +
4243
"- 查看AI聊天配置\n" +
4344
"- 重置AI聊天Agent\n" +
4445
"- 重置AI聊天\n",
@@ -149,6 +150,8 @@ func init() {
149150
Handle(chat.NewExtraSetFloat32(&chat.AC.TopP))
150151
en.OnRegex("^设置AI聊天(不)?以AI语音输出$", zero.AdminPermission).SetBlock(true).
151152
Handle(ctxext.NewStorageSaveBoolHandler(chat.BitmapNrec))
153+
en.OnPrefix("设置AI聊天努力度", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
154+
Handle(chat.NewExtraSetStr(&chat.AC.ReasoningEffort))
152155
en.OnFullMatch("查看AI聊天配置", chat.EnsureConfig, zero.SuperUserPermission).SetBlock(true).
153156
Handle(func(ctx *zero.Ctx) {
154157
gid := ctx.Event.GroupID

plugin/github/repo_searcher.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/FloatTech/floatbox/web"
1010
ctrl "github.com/FloatTech/zbpctrl"
1111
"github.com/FloatTech/zbputils/control"
12-
"github.com/fumiama/terasu/http2"
1312
zero "github.com/wdvxdr1123/ZeroBot"
1413
"github.com/wdvxdr1123/ZeroBot/message"
1514

@@ -29,7 +28,11 @@ func init() { // 插件主体
2928
api.RawQuery = url.Values{
3029
"q": []string{ctx.State["regex_matched"].([]string)[2]},
3130
}.Encode()
32-
body, err := web.RequestDataWithHeaders(&http2.DefaultClient, api.String(), "GET", func(r *http.Request) error {
31+
body, err := web.RequestDataWithHeaders(&http.Client{
32+
Transport: &http.Transport{
33+
Proxy: http.ProxyFromEnvironment,
34+
},
35+
}, api.String(), "GET", func(r *http.Request) error {
3336
r.Header.Set("User-Agent", web.RandUA())
3437
return nil
3538
}, nil)

plugin/llm/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func llmchat(prompt string, temp float32) (string, error) {
232232

233233
x := deepinfra.NewAPI(chat.AC.API, string(chat.AC.Key))
234234

235-
mod, err := chat.AC.Type.Protocol(chat.AC.ModelName, temp, topp, maxn)
235+
mod, err := chat.AC.Type.Protocol(chat.AC.ModelName, temp, topp, maxn, chat.AC.ReasoningEffort)
236236
if err != nil {
237237
return "", nil
238238
}

plugin/qzone/qzone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func renderForwardMsg(qq int64, raw string) (base64Bytes []byte, err error) {
314314
if qq != 0 {
315315
face, err = web.GetData(fmt.Sprintf(faceURL, qq))
316316
} else {
317-
face, err = web.RequestDataWith(web.NewTLS12Client(), fmt.Sprintf(anonymousURL, rand.Intn(4)+1), "GET", "gitcode.net", web.RandUA(), nil)
317+
face, err = web.RequestDataWith(web.NewDefaultClient(), fmt.Sprintf(anonymousURL, rand.Intn(4)+1), "GET", "gitcode.net", web.RandUA(), nil)
318318
}
319319
if err != nil {
320320
return

plugin/saucenao/searcher.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"reflect"
99
"strconv"
1010

11-
"github.com/fumiama/terasu/http2"
1211
"github.com/sirupsen/logrus"
1312
zero "github.com/wdvxdr1123/ZeroBot"
1413
"github.com/wdvxdr1123/ZeroBot/message"
@@ -134,7 +133,7 @@ func init() { // 插件主体
134133
}
135134
}
136135
})
137-
resp, err := http2.Head(result.Header.Thumbnail)
136+
resp, err := http.Head(result.Header.Thumbnail)
138137
msg := make(message.Message, 0, 3)
139138
if s > 80.0 {
140139
msg = append(msg, message.Text("我有把握是这个!"))

plugin/score/sign_in.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"strings"
1313
"time"
1414

15-
"github.com/FloatTech/AnimeAPI/bilibili"
1615
"github.com/FloatTech/AnimeAPI/wallet"
1716
"github.com/FloatTech/floatbox/file"
1817
"github.com/FloatTech/floatbox/process"
@@ -332,12 +331,9 @@ func initPic(picFile string, uid int64) (avatar []byte, err error) {
332331
if file.IsExist(picFile) {
333332
return
334333
}
335-
url, err := bilibili.GetRealURL(backgroundURL)
334+
data, err := web.RequestDataWith(web.NewDefaultClient(), backgroundURL, "GET", referer, web.RandUA(), nil)
336335
if err == nil {
337-
data, err := web.RequestDataWith(web.NewDefaultClient(), url, "", referer, "", nil)
338-
if err == nil {
339-
return avatar, os.WriteFile(picFile, data, 0644)
340-
}
336+
return avatar, os.WriteFile(picFile, data, 0644)
341337
}
342338
// 获取网络图片失败,使用本地已有的图片
343339
log.Error("[score:get online img error]:", err)

0 commit comments

Comments
 (0)