Skip to content

Commit 26d1b9f

Browse files
committed
feat(chat): more compatibility
1 parent 395d424 commit 26d1b9f

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

chat/init.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package chat
22

33
import (
44
"github.com/fumiama/deepinfra"
5+
"github.com/fumiama/deepinfra/model"
56

67
zero "github.com/wdvxdr1123/ZeroBot"
78
)
@@ -22,18 +23,10 @@ func init() {
2223
})
2324
}
2425

25-
func Reply(ctx *zero.Ctx, txt string) {
26-
gid := ctx.Event.GroupID
27-
if gid == 0 {
28-
gid = -ctx.Event.UserID
29-
}
30-
lst.add(gid, "", txt, true)
26+
func Reply(grp int64, txt string) {
27+
lst.add(grp, "", txt, true)
3128
}
3229

33-
func Ask(ctx *zero.Ctx, temp float32, mn, sysp, sepstr string) deepinfra.Model {
34-
gid := ctx.Event.GroupID
35-
if gid == 0 {
36-
gid = -ctx.Event.UserID
37-
}
38-
return lst.modelize(temp, gid, mn, sysp, sepstr)
30+
func Ask(p model.Protocol, grp int64, sysp string) deepinfra.Model {
31+
return lst.modelize(p, grp, sysp)
3932
}

chat/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func (l *list) add(grp int64, usr, txt string, isme bool) {
4949
l.m[grp] = msgs[:len(msgs)-1]
5050
}
5151

52-
func (l *list) modelize(temp float32, grp int64, mn, sysp, sepstr string) deepinfra.Model {
53-
m := model.NewCustom(mn, sepstr, temp, 0.9, 1024).System(sysp)
52+
func (l *list) modelize(p model.Protocol, grp int64, sysp string) deepinfra.Model {
53+
m := p.System(sysp)
5454
l.mu.RLock()
5555
defer l.mu.RUnlock()
5656
sz := len(l.m[grp])

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
1313
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5
1414
github.com/fumiama/cron v1.3.0
15-
github.com/fumiama/deepinfra v0.0.0-20250214082557-71569e85d503
15+
github.com/fumiama/deepinfra v0.0.0-20250221160812-ed1290950d32
1616
github.com/fumiama/go-base16384 v1.7.0
1717
github.com/gin-gonic/gin v1.8.2
1818
github.com/go-playground/assert/v2 v2.2.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 h1:BBade+Jl
3939
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4/go.mod h1:H7chHJglrhPPzetLdzBleF8d22WYOv7UM/lEKYiwlKM=
4040
github.com/fumiama/cron v1.3.0 h1:ZWlwuexF+HQHl3cYytEE5HNwD99q+3vNZF1GrEiXCFo=
4141
github.com/fumiama/cron v1.3.0/go.mod h1:bz5Izvgi/xEUI8tlBN8BI2jr9Moo8N4or0KV8xXuPDY=
42-
github.com/fumiama/deepinfra v0.0.0-20250214082557-71569e85d503 h1:ToU4IyLhSW0QXeBcshd9ARAA/bGt3PGTBcyxUzqaJwg=
43-
github.com/fumiama/deepinfra v0.0.0-20250214082557-71569e85d503/go.mod h1:wW05PQSn8mo1mZIoa6LBUE+3xIBjkoONvnfPTV5ZOhY=
42+
github.com/fumiama/deepinfra v0.0.0-20250221160812-ed1290950d32 h1:loqzJ8AK5R/ayUoFbiVr02rvwqIhcwgeKSvOuv20Q1U=
43+
github.com/fumiama/deepinfra v0.0.0-20250221160812-ed1290950d32/go.mod h1:wW05PQSn8mo1mZIoa6LBUE+3xIBjkoONvnfPTV5ZOhY=
4444
github.com/fumiama/go-base16384 v1.7.0 h1:6fep7XPQWxRlh4Hu+KsdH+6+YdUp+w6CwRXtMWSsXCA=
4545
github.com/fumiama/go-base16384 v1.7.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
4646
github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs=

0 commit comments

Comments
 (0)