Skip to content

Commit

Permalink
feat(chat): more compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Feb 21, 2025
1 parent 395d424 commit 26d1b9f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
17 changes: 5 additions & 12 deletions chat/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chat

import (
"github.com/fumiama/deepinfra"
"github.com/fumiama/deepinfra/model"

zero "github.com/wdvxdr1123/ZeroBot"
)
Expand All @@ -22,18 +23,10 @@ func init() {
})
}

func Reply(ctx *zero.Ctx, txt string) {
gid := ctx.Event.GroupID
if gid == 0 {
gid = -ctx.Event.UserID
}
lst.add(gid, "", txt, true)
func Reply(grp int64, txt string) {

Check failure on line 26 in chat/init.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported function Reply should have comment or be unexported (revive)
lst.add(grp, "", txt, true)
}

func Ask(ctx *zero.Ctx, temp float32, mn, sysp, sepstr string) deepinfra.Model {
gid := ctx.Event.GroupID
if gid == 0 {
gid = -ctx.Event.UserID
}
return lst.modelize(temp, gid, mn, sysp, sepstr)
func Ask(p model.Protocol, grp int64, sysp string) deepinfra.Model {

Check failure on line 30 in chat/init.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported function Ask should have comment or be unexported (revive)
return lst.modelize(p, grp, sysp)
}
4 changes: 2 additions & 2 deletions chat/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func (l *list) add(grp int64, usr, txt string, isme bool) {
l.m[grp] = msgs[:len(msgs)-1]
}

func (l *list) modelize(temp float32, grp int64, mn, sysp, sepstr string) deepinfra.Model {
m := model.NewCustom(mn, sepstr, temp, 0.9, 1024).System(sysp)
func (l *list) modelize(p model.Protocol, grp int64, sysp string) deepinfra.Model {
m := p.System(sysp)
l.mu.RLock()
defer l.mu.RUnlock()
sz := len(l.m[grp])
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5
github.com/fumiama/cron v1.3.0
github.com/fumiama/deepinfra v0.0.0-20250214082557-71569e85d503
github.com/fumiama/deepinfra v0.0.0-20250221160812-ed1290950d32
github.com/fumiama/go-base16384 v1.7.0
github.com/gin-gonic/gin v1.8.2
github.com/go-playground/assert/v2 v2.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 h1:BBade+Jl
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4/go.mod h1:H7chHJglrhPPzetLdzBleF8d22WYOv7UM/lEKYiwlKM=
github.com/fumiama/cron v1.3.0 h1:ZWlwuexF+HQHl3cYytEE5HNwD99q+3vNZF1GrEiXCFo=
github.com/fumiama/cron v1.3.0/go.mod h1:bz5Izvgi/xEUI8tlBN8BI2jr9Moo8N4or0KV8xXuPDY=
github.com/fumiama/deepinfra v0.0.0-20250214082557-71569e85d503 h1:ToU4IyLhSW0QXeBcshd9ARAA/bGt3PGTBcyxUzqaJwg=
github.com/fumiama/deepinfra v0.0.0-20250214082557-71569e85d503/go.mod h1:wW05PQSn8mo1mZIoa6LBUE+3xIBjkoONvnfPTV5ZOhY=
github.com/fumiama/deepinfra v0.0.0-20250221160812-ed1290950d32 h1:loqzJ8AK5R/ayUoFbiVr02rvwqIhcwgeKSvOuv20Q1U=
github.com/fumiama/deepinfra v0.0.0-20250221160812-ed1290950d32/go.mod h1:wW05PQSn8mo1mZIoa6LBUE+3xIBjkoONvnfPTV5ZOhY=
github.com/fumiama/go-base16384 v1.7.0 h1:6fep7XPQWxRlh4Hu+KsdH+6+YdUp+w6CwRXtMWSsXCA=
github.com/fumiama/go-base16384 v1.7.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs=
Expand Down

0 comments on commit 26d1b9f

Please sign in to comment.