mirror of
https://github.com/fumiama/go-onebot-agent.git
synced 2026-06-05 02:00:23 +08:00
chore: remove useless param
This commit is contained in:
7
agent.go
7
agent.go
@@ -46,7 +46,6 @@ type Agent struct {
|
||||
perm *Perm
|
||||
imgpcache *ttl.Cache[uint64, string]
|
||||
mem MemoryStorage
|
||||
manualaddreq bool
|
||||
manualaddmem bool
|
||||
hasimageapi bool
|
||||
}
|
||||
@@ -60,13 +59,13 @@ type Agent struct {
|
||||
func NewAgent(
|
||||
id int64, batchcap, itemscap int, imgpcachettl time.Duration,
|
||||
nickname, sex, characteristics, defaultprompt string, mem MemoryStorage,
|
||||
manualaddreq, manualaddmem bool,
|
||||
manualaddmem bool,
|
||||
) (ag Agent) {
|
||||
ag = Agent{
|
||||
id: id, nickname: nickname, sex: sex, chars: characteristics,
|
||||
imgpcache: ttl.NewCache[uint64, string](imgpcachettl),
|
||||
log: chat.NewLog[fmt.Stringer](batchcap, itemscap, "\n", defaultprompt),
|
||||
mem: mem, manualaddreq: manualaddreq, manualaddmem: manualaddmem,
|
||||
mem: mem, manualaddmem: manualaddmem,
|
||||
}
|
||||
_ = ag.LoadPermTable()
|
||||
return
|
||||
@@ -254,7 +253,7 @@ func (ag *Agent) GetAction(api deepinfra.API, p model.Protocol, grp int64, role
|
||||
case !ag.perm.allow(role, r.Action):
|
||||
err = errors.Wrap(ErrPermissionDenied, r.Action)
|
||||
return
|
||||
case !ag.manualaddreq:
|
||||
default:
|
||||
ag.AddRequest(grp, &r)
|
||||
if !ag.manualaddmem && r.Action == SVM {
|
||||
txt, err := extractMemory(&r)
|
||||
|
||||
@@ -511,7 +511,7 @@ func (fakemem) Load(grp int64) []string {
|
||||
func TestAgent_system(t *testing.T) {
|
||||
ag := NewAgent(
|
||||
12345, 10, 10, time.Minute, "testname", "testsex", "testchar",
|
||||
"testd", &fakemem{}, false, false,
|
||||
"testd", &fakemem{}, false,
|
||||
)
|
||||
p, err := ag.system(PermRoleAdmin, 123)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user