1
0
mirror of https://github.com/fumiama/go-onebot-agent.git synced 2026-06-05 02:00:23 +08:00

fix: image cannot clear

This commit is contained in:
源文雨
2025-12-22 00:37:50 +08:00
parent 39bf5588f4
commit c11c679e46
3 changed files with 6 additions and 4 deletions

View File

@@ -145,10 +145,11 @@ func (ag *Agent) SetViewImageAPI(api deepinfra.API, p model.Protocol) {
}
return nil
})
logrus.Debugln("[goba] SetViewImageAPI calculated min d:", d)
if d < 8 { // very similar (>87.5%)
msgs[i].Data["__agent_desc__"] = desc
hasset = true
logrus.Debugln("[goba] SetViewImageAPI hit cache with d:", d)
logrus.Debugln("[goba] SetViewImageAPI hit cache.")
continue
}
@@ -163,6 +164,7 @@ func (ag *Agent) SetViewImageAPI(api deepinfra.API, p model.Protocol) {
logrus.Debugln("[goba] SetViewImageAPI conv b64 err:", err)
continue
}
p = p.Clone() // clear protocol content
m := p.User(
model.NewContentImageURL(imgs),
model.NewContentText("使用简洁清晰明确的一段中文纯文本描述图片"),

2
go.mod
View File

@@ -7,7 +7,7 @@ require (
github.com/FloatTech/ttl v0.0.0-20240716161252-965925764562
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
github.com/corona10/goimagehash v1.1.1-0.20240121134706-d8115886f360
github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/wdvxdr1123/ZeroBot v1.8.2-0.20250921063512-13752a73d444

4
go.sum
View File

@@ -15,8 +15,8 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 h1:BBade+JlV/f7JstZ4pitd4tHhpN+w+6I+LyOS7B4fyU=
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4/go.mod h1:H7chHJglrhPPzetLdzBleF8d22WYOv7UM/lEKYiwlKM=
github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa h1:UMMNejpPp8dn92GPaVSZ2XKNSgp7+CVneOkZfExUilk=
github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa/go.mod h1:uqsWK/GM9OvKV0pXZOQB63rWugBbiXInY8E1JoRKhkg=
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a h1:a0+2vaXajfxsNcIaYG7A/cAb2e4+M3s5J6oyIiPsL3c=
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a/go.mod h1:uqsWK/GM9OvKV0pXZOQB63rWugBbiXInY8E1JoRKhkg=
github.com/fumiama/imgsz v0.0.4 h1:Lsasu2hdSSFS+vnD+nvR1UkiRMK7hcpyYCC0FzgSMFI=
github.com/fumiama/imgsz v0.0.4/go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=