66 "math/rand"
77 "strings"
88
9+ "github.com/RomiChan/syncx"
910 "github.com/fumiama/deepinfra"
1011 goba "github.com/fumiama/go-onebot-agent"
1112 "github.com/sirupsen/logrus"
@@ -52,7 +53,8 @@ func init() {
5253 logrus .Warnln ("ERROR: cannot get stor" )
5354 return false
5455 }
55- if _ , ok := ctx .State [zero .StateKeyPrefixKeep + "_chat_ag_hooked__" ]; ! ok && ! stor .NoAgent () {
56+ mp := ctx .State [control .StateKeySyncxState ].(* syncx.Map [string , any ])
57+ if _ , ok := mp .Load (chat .StateKeyAgentHooked ); ! ok && ! stor .NoAgent () {
5658 logrus .Infoln ("[aichat] skip agent for ctx has not been hooked by agent" )
5759 return false
5860 }
@@ -76,6 +78,7 @@ func init() {
7678 stor := ctx .State [zero .StateKeyPrefixKeep + "aichatcfg_stor__" ].(chat.Storage )
7779 temperature := stor .Temp ()
7880 topp , maxn := chat .AC .MParams ()
81+ mp := ctx .State [control .StateKeySyncxState ].(* syncx.Map [string , any ])
7982
8083 logrus .Debugln ("[aichat] agent mode test: noagent" , stor .NoAgent (), "hasapi" , chat .AC .AgentAPI != "" , "hasmodel" , chat .AC .AgentModelName != "" )
8184 if ! stor .NoAgent () && chat .AC .AgentAPI != "" && chat .AC .AgentModelName != "" && chat .AC .Key != "" {
@@ -120,7 +123,7 @@ func init() {
120123 break
121124 }
122125 hasresp = true
123- ctx . State [ zero . StateKeyPrefixKeep + "_chat_ag_triggered__" ] = struct {}{}
126+ mp . Store ( chat . StateKeyAgentTriggered , struct {}{})
124127 for _ , req := range reqs {
125128 if req .Action == goba .SVM { // is a fake action
126129 /*if hassavemem {
0 commit comments