mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-01-18 06:10:31 +00:00
feat(aichat): agent +more configs & fix too long log evs
This commit is contained in:
parent
ec8c402593
commit
f27e603e39
@ -1635,7 +1635,9 @@ print("run[CQ:image,file="+j["img"]+"]")
|
|||||||
- [x] 设置AI聊天(不)以AI语音输出
|
- [x] 设置AI聊天(不)以AI语音输出
|
||||||
- [x] 设置AI聊天Agent性格
|
- [x] 设置AI聊天Agent性格
|
||||||
- [x] 查看AI聊天Agent性格
|
- [x] 查看AI聊天Agent性格
|
||||||
- [x] 重置AI聊天Agent性格
|
- [x] 设置AI聊天Agent性别
|
||||||
|
- [x] 查看AI聊天Agent性别
|
||||||
|
- [x] 重置AI聊天Agent性格性别
|
||||||
- [x] 重置AI聊天Agent
|
- [x] 重置AI聊天Agent
|
||||||
- [x] 查看AI聊天配置
|
- [x] 查看AI聊天配置
|
||||||
- [x] 重置AI聊天
|
- [x] 重置AI聊天
|
||||||
|
|||||||
10
go.mod
10
go.mod
@ -12,7 +12,7 @@ require (
|
|||||||
github.com/FloatTech/sqlite v1.7.2
|
github.com/FloatTech/sqlite v1.7.2
|
||||||
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
|
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
|
||||||
github.com/FloatTech/zbpctrl v1.7.1
|
github.com/FloatTech/zbpctrl v1.7.1
|
||||||
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c
|
github.com/FloatTech/zbputils v1.7.2-0.20260117102821-810378820dcc
|
||||||
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
|
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
|
||||||
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
|
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
|
||||||
github.com/Tnze/go-mc v1.20.2
|
github.com/Tnze/go-mc v1.20.2
|
||||||
@ -24,10 +24,9 @@ require (
|
|||||||
github.com/fumiama/cron v1.3.0
|
github.com/fumiama/cron v1.3.0
|
||||||
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a
|
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a
|
||||||
github.com/fumiama/go-base16384 v1.7.1
|
github.com/fumiama/go-base16384 v1.7.1
|
||||||
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c
|
github.com/fumiama/go-onebot-agent v0.0.0-20260117094018-cd93ccfd6e04
|
||||||
github.com/fumiama/go-registry v0.2.7
|
github.com/fumiama/go-registry v0.2.7
|
||||||
github.com/fumiama/gotracemoe v0.0.3
|
github.com/fumiama/gotracemoe v0.0.3
|
||||||
github.com/fumiama/imgsz v0.0.4
|
|
||||||
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
|
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
|
||||||
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4
|
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4
|
||||||
github.com/fumiama/terasu v1.0.2
|
github.com/fumiama/terasu v1.0.2
|
||||||
@ -44,10 +43,10 @@ require (
|
|||||||
github.com/notnil/chess v1.10.0
|
github.com/notnil/chess v1.10.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/shirou/gopsutil/v4 v4.25.12
|
github.com/shirou/gopsutil/v4 v4.25.12
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.4
|
||||||
github.com/tidwall/gjson v1.18.0
|
github.com/tidwall/gjson v1.18.0
|
||||||
github.com/wcharczuk/go-chart/v2 v2.1.2
|
github.com/wcharczuk/go-chart/v2 v2.1.2
|
||||||
github.com/wdvxdr1123/ZeroBot v1.8.3-0.20260108153355-cbf2ab0dd527
|
github.com/wdvxdr1123/ZeroBot v1.8.3-0.20260117102541-393033a35adb
|
||||||
gitlab.com/gomidi/midi/v2 v2.3.18
|
gitlab.com/gomidi/midi/v2 v2.3.18
|
||||||
golang.org/x/image v0.34.0
|
golang.org/x/image v0.34.0
|
||||||
golang.org/x/sys v0.39.0
|
golang.org/x/sys v0.39.0
|
||||||
@ -66,6 +65,7 @@ require (
|
|||||||
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
|
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
|
||||||
github.com/fumiama/go-simple-protobuf v0.2.0 // indirect
|
github.com/fumiama/go-simple-protobuf v0.2.0 // indirect
|
||||||
github.com/fumiama/gofastTEA v0.1.3 // indirect
|
github.com/fumiama/gofastTEA v0.1.3 // indirect
|
||||||
|
github.com/fumiama/imgsz v0.0.4 // indirect
|
||||||
github.com/fumiama/orbyte v0.0.0-20251002065953-3bb358367eb5 // indirect
|
github.com/fumiama/orbyte v0.0.0-20251002065953-3bb358367eb5 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||||
|
|||||||
18
go.sum
18
go.sum
@ -16,8 +16,8 @@ github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d h1:mUQ/c3wXKsUGa4Sg9
|
|||||||
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
|
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
|
||||||
github.com/FloatTech/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
|
github.com/FloatTech/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
|
||||||
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
|
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
|
||||||
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c h1:GD96NoftxCVPBs0yewZFb1ynMCF4SmEu9CjrwmZFSbU=
|
github.com/FloatTech/zbputils v1.7.2-0.20260117102821-810378820dcc h1:csX6rK1Zjn0fahnNpBaHVFXM4GMOpnf/ZLoyqMbPckI=
|
||||||
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c/go.mod h1:yLJvsQJssgQIB4+/uVRNseN4sgFqyfGQLcrKUuXL454=
|
github.com/FloatTech/zbputils v1.7.2-0.20260117102821-810378820dcc/go.mod h1:uX5JHIADt9/vSIriLZTRwkeVvOVwxOGiDyS5O1lTPGE=
|
||||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||||
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
|
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
|
||||||
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
|
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
|
||||||
@ -67,8 +67,8 @@ github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a h1:a0+2vaXajfxsN
|
|||||||
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a/go.mod h1:uqsWK/GM9OvKV0pXZOQB63rWugBbiXInY8E1JoRKhkg=
|
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a/go.mod h1:uqsWK/GM9OvKV0pXZOQB63rWugBbiXInY8E1JoRKhkg=
|
||||||
github.com/fumiama/go-base16384 v1.7.1 h1:1P1x6FWRvd7PtbH4idDAGWAjKKcVxggxlROYKRXbw58=
|
github.com/fumiama/go-base16384 v1.7.1 h1:1P1x6FWRvd7PtbH4idDAGWAjKKcVxggxlROYKRXbw58=
|
||||||
github.com/fumiama/go-base16384 v1.7.1/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
|
github.com/fumiama/go-base16384 v1.7.1/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
|
||||||
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c h1:kCAFF41GkJklKvftchjuEpo4Mp/qUSiEGBeChs4QJdk=
|
github.com/fumiama/go-onebot-agent v0.0.0-20260117094018-cd93ccfd6e04 h1:TAvkyECK+lSVh+AnVSPNfCmeCiYiJCd+z9QQwfjHSuw=
|
||||||
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c/go.mod h1:rTrS23rvTYuZcSngENJTvcBFTz1nGsImSv+bW7yfhqs=
|
github.com/fumiama/go-onebot-agent v0.0.0-20260117094018-cd93ccfd6e04/go.mod h1:rTrS23rvTYuZcSngENJTvcBFTz1nGsImSv+bW7yfhqs=
|
||||||
github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs=
|
github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs=
|
||||||
github.com/fumiama/go-registry v0.2.7/go.mod h1:m+wp5fF8dYgVoFkBPZl+vlK90loymaJE0JCtocVQLEs=
|
github.com/fumiama/go-registry v0.2.7/go.mod h1:m+wp5fF8dYgVoFkBPZl+vlK90loymaJE0JCtocVQLEs=
|
||||||
github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o=
|
github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o=
|
||||||
@ -182,11 +182,10 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
|
|||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.12 h1:e7PvW/0RmJ8p8vPGJH4jvNkOyLmbkXgXW4m6ZPic6CY=
|
github.com/shirou/gopsutil/v4 v4.25.12 h1:e7PvW/0RmJ8p8vPGJH4jvNkOyLmbkXgXW4m6ZPic6CY=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.12/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU=
|
github.com/shirou/gopsutil/v4 v4.25.12/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU=
|
||||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
|
||||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
@ -206,8 +205,8 @@ github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9R
|
|||||||
github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ=
|
github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ=
|
||||||
github.com/wcharczuk/go-chart/v2 v2.1.2 h1:Y17/oYNuXwZg6TFag06qe8sBajwwsuvPiJJXcUcLL6E=
|
github.com/wcharczuk/go-chart/v2 v2.1.2 h1:Y17/oYNuXwZg6TFag06qe8sBajwwsuvPiJJXcUcLL6E=
|
||||||
github.com/wcharczuk/go-chart/v2 v2.1.2/go.mod h1:Zi4hbaqlWpYajnXB2K22IUYVXRXaLfSGNNR7P4ukyyQ=
|
github.com/wcharczuk/go-chart/v2 v2.1.2/go.mod h1:Zi4hbaqlWpYajnXB2K22IUYVXRXaLfSGNNR7P4ukyyQ=
|
||||||
github.com/wdvxdr1123/ZeroBot v1.8.3-0.20260108153355-cbf2ab0dd527 h1:QQAAftj7MvP+Ebxfs1MV5d6fswYi6YJ2YFkoicFpcEY=
|
github.com/wdvxdr1123/ZeroBot v1.8.3-0.20260117102541-393033a35adb h1:pwmyrnnMzb0WygAwUgXoZckzJkusK4WSaXxXqsIJYmU=
|
||||||
github.com/wdvxdr1123/ZeroBot v1.8.3-0.20260108153355-cbf2ab0dd527/go.mod h1:trueIIVRywKJa3ov4QphzVvzYzgCNrlXdf9JvPJOFW8=
|
github.com/wdvxdr1123/ZeroBot v1.8.3-0.20260117102541-393033a35adb/go.mod h1:kCLja2sXXgbBTsEOyBNCuT4z9tI+URQ2y0q/GGXprzU=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||||
@ -268,7 +267,6 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
|||||||
@ -52,8 +52,8 @@ func init() {
|
|||||||
logrus.Warnln("ERROR: cannot get stor")
|
logrus.Warnln("ERROR: cannot get stor")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if _, ok := ctx.State[zero.StateKeyPrefixKeep+"_chat_ag_hooked__"]; !ok {
|
if _, ok := ctx.State[zero.StateKeyPrefixKeep+"_chat_ag_hooked__"]; !ok && !stor.NoAgent() {
|
||||||
logrus.Warnln("ERROR: ctx has not been hooked by agent")
|
logrus.Infoln("[aichat] skip agent for ctx has not been hooked by agent")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !(ctx.ExtractPlainText() != "" &&
|
if !(ctx.ExtractPlainText() != "" &&
|
||||||
@ -64,10 +64,6 @@ func init() {
|
|||||||
if !ctx.Event.IsToMe && rand.Intn(100) >= int(rate) {
|
if !ctx.Event.IsToMe && rand.Intn(100) >= int(rate) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if chat.AC.Key == "" {
|
|
||||||
logrus.Warnln("ERROR: get extra err: empty key")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if ctx.Event.IsToMe {
|
if ctx.Event.IsToMe {
|
||||||
ctx.Block()
|
ctx.Block()
|
||||||
}
|
}
|
||||||
@ -82,7 +78,7 @@ func init() {
|
|||||||
topp, maxn := chat.AC.MParams()
|
topp, maxn := chat.AC.MParams()
|
||||||
|
|
||||||
logrus.Debugln("[aichat] agent mode test: noagent", stor.NoAgent(), "hasapi", chat.AC.AgentAPI != "", "hasmodel", chat.AC.AgentModelName != "")
|
logrus.Debugln("[aichat] agent mode test: noagent", stor.NoAgent(), "hasapi", chat.AC.AgentAPI != "", "hasmodel", chat.AC.AgentModelName != "")
|
||||||
if !stor.NoAgent() && chat.AC.AgentAPI != "" && chat.AC.AgentModelName != "" {
|
if !stor.NoAgent() && chat.AC.AgentAPI != "" && chat.AC.AgentModelName != "" && chat.AC.Key != "" {
|
||||||
logrus.Debugln("[aichat] enter agent mode")
|
logrus.Debugln("[aichat] enter agent mode")
|
||||||
x := deepinfra.NewAPI(chat.AC.AgentAPI, string(chat.AC.AgentKey))
|
x := deepinfra.NewAPI(chat.AC.AgentAPI, string(chat.AC.AgentKey))
|
||||||
mod, err := chat.AC.Type.Protocol(chat.AC.AgentModelName, temperature, topp, maxn)
|
mod, err := chat.AC.Type.Protocol(chat.AC.AgentModelName, temperature, topp, maxn)
|
||||||
|
|||||||
@ -29,9 +29,11 @@ var (
|
|||||||
"- 查看AI聊天系统提示词\n" +
|
"- 查看AI聊天系统提示词\n" +
|
||||||
"- 重置AI聊天系统提示词\n" +
|
"- 重置AI聊天系统提示词\n" +
|
||||||
"- 设置AI聊天系统提示词xxx\n" +
|
"- 设置AI聊天系统提示词xxx\n" +
|
||||||
"- 设置AI聊天Agent性格" +
|
"- 设置AI聊天Agent性格xxx" +
|
||||||
"- 查看AI聊天Agent性格xxx" +
|
"- 查看AI聊天Agent性格" +
|
||||||
"- 重置AI聊天Agent性格\n" +
|
"- 设置AI聊天Agent性别xxx" +
|
||||||
|
"- 查看AI聊天Agent性别" +
|
||||||
|
"- 重置AI聊天Agent性格性别\n" +
|
||||||
"- 设置AI聊天分隔符</think>(留空则清除)\n" +
|
"- 设置AI聊天分隔符</think>(留空则清除)\n" +
|
||||||
"- 设置AI聊天(不)响应AT\n" +
|
"- 设置AI聊天(不)响应AT\n" +
|
||||||
"- 设置AI聊天最大长度4096\n" +
|
"- 设置AI聊天最大长度4096\n" +
|
||||||
@ -45,12 +47,6 @@ var (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
en.UsePreHandler(chat.EnsureConfig, func(ctx *zero.Ctx) bool {
|
en.UsePreHandler(chat.EnsureConfig, func(ctx *zero.Ctx) bool {
|
||||||
if !chat.IsAgentCharReady {
|
|
||||||
if chat.AC.AgentChar != "" {
|
|
||||||
chat.AgentChar = []byte(chat.AC.AgentChar)
|
|
||||||
}
|
|
||||||
chat.IsAgentCharReady = true
|
|
||||||
}
|
|
||||||
k := zero.StateKeyPrefixKeep + "aichatcfg_stor__"
|
k := zero.StateKeyPrefixKeep + "aichatcfg_stor__"
|
||||||
if _, ok := ctx.State[k]; ok {
|
if _, ok := ctx.State[k]; ok {
|
||||||
return true
|
return true
|
||||||
@ -98,7 +94,13 @@ func init() {
|
|||||||
en.OnPrefix("设置AI聊天系统提示词", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
en.OnPrefix("设置AI聊天系统提示词", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
||||||
Handle(chat.NewExtraSetStr(&chat.AC.SystemP))
|
Handle(chat.NewExtraSetStr(&chat.AC.SystemP))
|
||||||
en.OnPrefix("设置AI聊天Agent性格", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
en.OnPrefix("设置AI聊天Agent性格", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
||||||
Handle(chat.NewExtraSetStr(&chat.AC.AgentChar))
|
Handle(chat.NewExtraSetStr(&chat.AC.AgentChar), func(ctx *zero.Ctx) {
|
||||||
|
chat.AgentCharConfig.Chars = chat.AC.AgentChar
|
||||||
|
})
|
||||||
|
en.OnPrefix("设置AI聊天Agent性别", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
||||||
|
Handle(chat.NewExtraSetStr(&chat.AC.AgentSex), func(ctx *zero.Ctx) {
|
||||||
|
chat.AgentCharConfig.Sex = chat.AC.AgentSex
|
||||||
|
})
|
||||||
en.OnFullMatch("查看AI聊天系统提示词", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
en.OnFullMatch("查看AI聊天系统提示词", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
ctx.SendChain(message.Text(chat.AC.SystemP))
|
ctx.SendChain(message.Text(chat.AC.SystemP))
|
||||||
})
|
})
|
||||||
@ -119,13 +121,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
ctx.SendChain(message.Text("成功"))
|
ctx.SendChain(message.Text("成功"))
|
||||||
})
|
})
|
||||||
en.OnFullMatch("重置AI聊天Agent性格", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
en.OnFullMatch("重置AI聊天Agent性格性别", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx])
|
c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx])
|
||||||
if !ok {
|
if !ok {
|
||||||
ctx.SendChain(message.Text("ERROR: no such plugin"))
|
ctx.SendChain(message.Text("ERROR: no such plugin"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
chat.AC.AgentChar = ""
|
chat.ResetAgentCharConfig()
|
||||||
err := c.SetExtra(&chat.AC)
|
err := c.SetExtra(&chat.AC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.SendChain(message.Text("ERROR: set extra err: ", err))
|
ctx.SendChain(message.Text("ERROR: set extra err: ", err))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user