mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 18:20:27 +00:00
feat: add set sep
This commit is contained in:
@@ -27,7 +27,7 @@ var (
|
||||
DisableOnDefault: false,
|
||||
Extra: control.ExtraFromString("aichat"),
|
||||
Brief: "OpenAI聊天",
|
||||
Help: "- 设置AI聊天触发概率10\n- 设置AI聊天温度80\n- 设置AI聊天密钥xxx\n- 设置AI聊天模型名xxx\n- 设置AI聊天系统提示词xxx",
|
||||
Help: "- 设置AI聊天触发概率10\n- 设置AI聊天温度80\n- 设置AI聊天密钥xxx\n- 设置AI聊天模型名xxx\n- 设置AI聊天系统提示词xxx\n- 设置AI聊天分隔符</think>",
|
||||
PrivateDataFolder: "aichat",
|
||||
})
|
||||
lst = newlist()
|
||||
@@ -35,12 +35,14 @@ var (
|
||||
|
||||
var (
|
||||
modelname = "deepseek-ai/DeepSeek-R1"
|
||||
systemprompt = "你正在QQ群与用户聊天,用户发送了消息。按自己的心情简短思考后,条理清晰地回应**一句话**,禁止回应多句。"
|
||||
systemprompt = "你正在QQ群与用户聊天,用户发送了消息。按自己的心情简短思考后条理清晰地回复。"
|
||||
sepstr = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
mf := en.DataFolder() + "model.txt"
|
||||
sf := en.DataFolder() + "system.txt"
|
||||
pf := en.DataFolder() + "sep.txt"
|
||||
if file.IsExist(mf) {
|
||||
data, err := os.ReadFile(mf)
|
||||
if err != nil {
|
||||
@@ -57,6 +59,14 @@ func init() {
|
||||
systemprompt = string(data)
|
||||
}
|
||||
}
|
||||
if file.IsExist(pf) {
|
||||
data, err := os.ReadFile(pf)
|
||||
if err != nil {
|
||||
logrus.Warnln("read sep", err)
|
||||
} else {
|
||||
sepstr = string(data)
|
||||
}
|
||||
}
|
||||
|
||||
en.OnMessage(func(ctx *zero.Ctx) bool {
|
||||
txt := ctx.ExtractPlainText()
|
||||
@@ -242,4 +252,18 @@ func init() {
|
||||
}
|
||||
ctx.SendChain(message.Text("成功"))
|
||||
})
|
||||
en.OnPrefix("设置AI聊天分隔符", zero.OnlyPrivate, zero.SuperUserPermission).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||
args := strings.TrimSpace(ctx.State["args"].(string))
|
||||
if args == "" {
|
||||
ctx.SendChain(message.Text("ERROR: empty args"))
|
||||
return
|
||||
}
|
||||
sepstr = args
|
||||
err := os.WriteFile(pf, []byte(args), 0644)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("ERROR: ", err))
|
||||
return
|
||||
}
|
||||
ctx.SendChain(message.Text("成功"))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user