mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-07 07:40:21 +00:00
Compare commits
6 Commits
v1.10.7
...
create-pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b56f361dc8 | ||
|
|
5283e6de61 | ||
|
|
caa66d6715 | ||
|
|
f77d9b3509 | ||
|
|
afc1e034e0 | ||
|
|
67c36aab29 |
@@ -1633,6 +1633,10 @@ print("run[CQ:image,file="+j["img"]+"]")
|
||||
- [x] 设置AI聊天最大长度4096
|
||||
- [x] 设置AI聊天TopP 0.9
|
||||
- [x] 设置AI聊天(不)以AI语音输出
|
||||
- [x] 设置AI聊天Agent性格
|
||||
- [x] 查看AI聊天Agent性格
|
||||
- [x] 重置AI聊天Agent性格
|
||||
- [x] 重置AI聊天Agent
|
||||
- [x] 查看AI聊天配置
|
||||
- [x] 重置AI聊天
|
||||
|
||||
|
||||
4
go.mod
4
go.mod
@@ -12,7 +12,7 @@ require (
|
||||
github.com/FloatTech/sqlite v1.7.2
|
||||
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
|
||||
github.com/FloatTech/zbpctrl v1.7.1
|
||||
github.com/FloatTech/zbputils v1.7.2-0.20260103151557-34c60f3591d5
|
||||
github.com/FloatTech/zbputils v1.7.2-0.20260106131604-3ff237cdb792
|
||||
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
|
||||
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
|
||||
github.com/Tnze/go-mc v1.20.2
|
||||
@@ -24,7 +24,7 @@ require (
|
||||
github.com/fumiama/cron v1.3.0
|
||||
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a
|
||||
github.com/fumiama/go-base16384 v1.7.1
|
||||
github.com/fumiama/go-onebot-agent v0.0.0-20260103153303-915960b3a069
|
||||
github.com/fumiama/go-onebot-agent v0.0.0-20260106123931-a0c81601f2d7
|
||||
github.com/fumiama/go-registry v0.2.7
|
||||
github.com/fumiama/gotracemoe v0.0.3
|
||||
github.com/fumiama/imgsz v0.0.4
|
||||
|
||||
8
go.sum
8
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/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
|
||||
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
|
||||
github.com/FloatTech/zbputils v1.7.2-0.20260103151557-34c60f3591d5 h1:kN8EtrKmcK1g+WMb2czOLpiNyagljO7f9BqdK6KcAaY=
|
||||
github.com/FloatTech/zbputils v1.7.2-0.20260103151557-34c60f3591d5/go.mod h1:1qUet9ztj6DMabvtCNl4vVwb6mVSYUHeAbpkY3CBMvk=
|
||||
github.com/FloatTech/zbputils v1.7.2-0.20260106131604-3ff237cdb792 h1:LHJ75vp0gizrO1ko/2t8/98mPHD1bQSXkonn02VRB4A=
|
||||
github.com/FloatTech/zbputils v1.7.2-0.20260106131604-3ff237cdb792/go.mod h1:TKnvn/rgLBlcizp8XtseduIkAw1Mq3cwpvT5GAG69fA=
|
||||
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/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/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-onebot-agent v0.0.0-20260103153303-915960b3a069 h1:s+0YH5thC576Lggf7v3SBN3RQYDMytS5ZtKCMMtuY1E=
|
||||
github.com/fumiama/go-onebot-agent v0.0.0-20260103153303-915960b3a069/go.mod h1:rTrS23rvTYuZcSngENJTvcBFTz1nGsImSv+bW7yfhqs=
|
||||
github.com/fumiama/go-onebot-agent v0.0.0-20260106123931-a0c81601f2d7 h1:QYlLOAWxH3PU/vFiTmhI+TnsA4i+ahk+UxSbqBxkEOU=
|
||||
github.com/fumiama/go-onebot-agent v0.0.0-20260106123931-a0c81601f2d7/go.mod h1:rTrS23rvTYuZcSngENJTvcBFTz1nGsImSv+bW7yfhqs=
|
||||
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-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o=
|
||||
|
||||
@@ -29,8 +29,8 @@ schema = 3
|
||||
version = "v1.7.1"
|
||||
hash = "sha256-wkeiaUTpPVbpH7fcXeoLtG+aGIMJbvoc/9sbi2IXK0I="
|
||||
[mod."github.com/FloatTech/zbputils"]
|
||||
version = "v1.7.2-0.20260103151557-34c60f3591d5"
|
||||
hash = "sha256-kcGgD6boOTkZ+x0lXwgkuNY3zJfh+L867gK9SkhyKk4="
|
||||
version = "v1.7.2-0.20260106131604-3ff237cdb792"
|
||||
hash = "sha256-gI8wWI5hjyhYLnj85egm4ARhEnsX16DixW20W6PXYQk="
|
||||
[mod."github.com/PuerkitoBio/goquery"]
|
||||
version = "v1.8.0"
|
||||
hash = "sha256-I3QaPWATvBOL/F26fIiYWKS13yBUYo+9o3tcsGIu8tY="
|
||||
@@ -92,8 +92,8 @@ schema = 3
|
||||
version = "v1.7.1"
|
||||
hash = "sha256-Fd1QaeYx+3q4C3XQXlPFnDmKPsoZH6837fN/7rn8i9s="
|
||||
[mod."github.com/fumiama/go-onebot-agent"]
|
||||
version = "v0.0.0-20260103153303-915960b3a069"
|
||||
hash = "sha256-hJHJXk9axVTKl4IwkIx+0jxZfTXRX1NcFzugfepSCbM="
|
||||
version = "v0.0.0-20260106123931-a0c81601f2d7"
|
||||
hash = "sha256-YqG/SnqOIkWDEKHPL79mbccHY8iwW4acVdTiWIdKeVM="
|
||||
[mod."github.com/fumiama/go-registry"]
|
||||
version = "v0.2.7"
|
||||
hash = "sha256-Rjl+z0Hlp2LMi8+pnFe5HrxctyHMi7UPiK33g/OgLdA="
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
package banner
|
||||
|
||||
// Version ...
|
||||
var Version = "v1.10.7"
|
||||
var Version = "v1.10.8"
|
||||
|
||||
// Copyright ...
|
||||
var Copyright = "© 2020 - 2026 FloatTech"
|
||||
|
||||
// Banner ...
|
||||
var Banner = "* OneBot + ZeroBot + Golang\n" +
|
||||
"* Version " + Version + " - 2026-01-03 23:41:53 +0800 CST\n" +
|
||||
"* Version " + Version + " - 2026-01-05 00:50:21 +0800 CST\n" +
|
||||
"* Copyright " + Copyright + ". All Rights Reserved.\n" +
|
||||
"* Project: https://github.com/FloatTech/ZeroBot-Plugin"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package aichat
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"math/rand"
|
||||
"strings"
|
||||
|
||||
@@ -122,15 +121,7 @@ func init() {
|
||||
if req.Action == goba.SVM { // is a fake action
|
||||
continue
|
||||
}
|
||||
resp := ctx.CallAction(req.Action, req.Params)
|
||||
logrus.Infoln("[aichat] agent get resp:", reqs)
|
||||
ag.AddResponse(gid, &goba.APIResponse{
|
||||
Status: resp.Status,
|
||||
Data: json.RawMessage(resp.Data.Raw),
|
||||
Message: resp.Message,
|
||||
Wording: resp.Wording,
|
||||
RetCode: resp.RetCode,
|
||||
})
|
||||
_ = ctx.CallAction(req.Action, req.Params)
|
||||
}
|
||||
}
|
||||
if hasresp {
|
||||
|
||||
@@ -29,18 +29,32 @@ var (
|
||||
"- 查看AI聊天系统提示词\n" +
|
||||
"- 重置AI聊天系统提示词\n" +
|
||||
"- 设置AI聊天系统提示词xxx\n" +
|
||||
"- 设置AI聊天Agent性格" +
|
||||
"- 查看AI聊天Agent性格xxx" +
|
||||
"- 重置AI聊天Agent性格\n" +
|
||||
"- 设置AI聊天分隔符</think>(留空则清除)\n" +
|
||||
"- 设置AI聊天(不)响应AT\n" +
|
||||
"- 设置AI聊天最大长度4096\n" +
|
||||
"- 设置AI聊天TopP 0.9\n" +
|
||||
"- 设置AI聊天(不)以AI语音输出\n" +
|
||||
"- 查看AI聊天配置\n" +
|
||||
"- 重置AI聊天Agent\n" +
|
||||
"- 重置AI聊天\n",
|
||||
})
|
||||
)
|
||||
|
||||
func init() {
|
||||
en.UsePreHandler(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__"
|
||||
if _, ok := ctx.State[k]; ok {
|
||||
return true
|
||||
}
|
||||
gid := ctx.Event.GroupID
|
||||
if gid == 0 {
|
||||
gid = -ctx.Event.UserID
|
||||
@@ -50,7 +64,7 @@ func init() {
|
||||
logrus.Warnln("ERROR: ", err)
|
||||
return false
|
||||
}
|
||||
ctx.State[zero.StateKeyPrefixKeep+"aichatcfg_stor__"] = stor
|
||||
ctx.State[k] = stor
|
||||
return true
|
||||
})
|
||||
en.OnPrefix("设置AI聊天触发概率", zero.AdminPermission).SetBlock(true).
|
||||
@@ -83,9 +97,14 @@ func init() {
|
||||
Handle(chat.NewExtraSetStr(&chat.AC.AgentModelName))
|
||||
en.OnPrefix("设置AI聊天系统提示词", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
||||
Handle(chat.NewExtraSetStr(&chat.AC.SystemP))
|
||||
en.OnPrefix("设置AI聊天Agent性格", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
||||
Handle(chat.NewExtraSetStr(&chat.AC.AgentChar))
|
||||
en.OnFullMatch("查看AI聊天系统提示词", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text(chat.AC.SystemP))
|
||||
})
|
||||
en.OnFullMatch("查看AI聊天Agent性格", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
ctx.SendChain(message.Text(chat.AC.AgentChar))
|
||||
})
|
||||
en.OnFullMatch("重置AI聊天系统提示词", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
c, ok := ctx.State["manager"].(*ctrl.Control[*zero.Ctx])
|
||||
if !ok {
|
||||
@@ -100,6 +119,20 @@ func init() {
|
||||
}
|
||||
ctx.SendChain(message.Text("成功"))
|
||||
})
|
||||
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])
|
||||
if !ok {
|
||||
ctx.SendChain(message.Text("ERROR: no such plugin"))
|
||||
return
|
||||
}
|
||||
chat.AC.AgentChar = ""
|
||||
err := c.SetExtra(&chat.AC)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR: set extra err: ", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Text("成功, 请重置AI聊天Agent"))
|
||||
})
|
||||
en.OnPrefix("设置AI聊天分隔符", chat.EnsureConfig, zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).
|
||||
Handle(chat.NewExtraSetStr(&chat.AC.Separator))
|
||||
en.OnRegex("^设置AI聊天(不)?响应AT$", chat.EnsureConfig, zero.SuperUserPermission).SetBlock(true).
|
||||
@@ -137,6 +170,10 @@ func init() {
|
||||
message.Text("【当前AI聊天全局配置】\n", &chat.AC),
|
||||
)
|
||||
})
|
||||
en.OnFullMatch("重置AI聊天Agent", chat.EnsureConfig, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
chat.ResetAgents()
|
||||
ctx.SendChain(message.Text("成功"))
|
||||
})
|
||||
en.OnFullMatch("重置AI聊天", chat.EnsureConfig, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
chat.ResetChat()
|
||||
ctx.SendChain(message.Text("成功"))
|
||||
|
||||
@@ -4,7 +4,6 @@ package wife
|
||||
import (
|
||||
"bytes"
|
||||
"image"
|
||||
"image/color"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -15,7 +14,6 @@ import (
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
|
||||
zbmath "github.com/FloatTech/floatbox/math"
|
||||
"github.com/FloatTech/imgfactory"
|
||||
)
|
||||
|
||||
@@ -134,24 +132,8 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
// 马赛克生成
|
||||
// 高斯模糊生成
|
||||
func mosaic(dst *imgfactory.Factory, level int) ([]byte, error) {
|
||||
b := dst.Image().Bounds()
|
||||
p := imgfactory.NewFactoryBG(dst.W(), dst.H(), color.NRGBA{255, 255, 255, 255})
|
||||
markSize := zbmath.Max(b.Max.X, b.Max.Y) * sizeList[level] / 200
|
||||
|
||||
for yOfMarknum := 0; yOfMarknum <= zbmath.Ceil(b.Max.Y, markSize); yOfMarknum++ {
|
||||
for xOfMarknum := 0; xOfMarknum <= zbmath.Ceil(b.Max.X, markSize); xOfMarknum++ {
|
||||
a := dst.Image().At(xOfMarknum*markSize+markSize/2, yOfMarknum*markSize+markSize/2)
|
||||
cc := color.NRGBAModel.Convert(a).(color.NRGBA)
|
||||
for y := 0; y < markSize; y++ {
|
||||
for x := 0; x < markSize; x++ {
|
||||
xOfPic := xOfMarknum*markSize + x
|
||||
yOfPic := yOfMarknum*markSize + y
|
||||
p.Image().Set(xOfPic, yOfPic, cc)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return imgfactory.ToBytes(p.Blur(3).Image())
|
||||
blurRadius := float64(sizeList[level] * 3)
|
||||
return imgfactory.ToBytes(dst.Blur(blurRadius).Image())
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"0409": {
|
||||
"identity": {
|
||||
"name": "ZeroBot-Plugin",
|
||||
"version": "1.10.7.2332"
|
||||
"version": "1.10.8.2334"
|
||||
},
|
||||
"description": "",
|
||||
"minimum-os": "vista",
|
||||
@@ -36,23 +36,23 @@
|
||||
"#1": {
|
||||
"0000": {
|
||||
"fixed": {
|
||||
"file_version": "1.10.7.2332",
|
||||
"product_version": "v1.10.7",
|
||||
"timestamp": "2026-01-03T23:42:04+08:00"
|
||||
"file_version": "1.10.8.2334",
|
||||
"product_version": "v1.10.8",
|
||||
"timestamp": "2026-01-05T00:50:29+08:00"
|
||||
},
|
||||
"info": {
|
||||
"0409": {
|
||||
"Comments": "OneBot plugins based on ZeroBot",
|
||||
"CompanyName": "FloatTech",
|
||||
"FileDescription": "https://github.com/FloatTech/ZeroBot-Plugin",
|
||||
"FileVersion": "1.10.7.2332",
|
||||
"FileVersion": "1.10.8.2334",
|
||||
"InternalName": "",
|
||||
"LegalCopyright": "© 2020 - 2026 FloatTech. All Rights Reserved.",
|
||||
"LegalTrademarks": "",
|
||||
"OriginalFilename": "ZBP.EXE",
|
||||
"PrivateBuild": "",
|
||||
"ProductName": "ZeroBot-Plugin",
|
||||
"ProductVersion": "v1.10.7",
|
||||
"ProductVersion": "v1.10.8",
|
||||
"SpecialBuild": ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user