@@ -27,20 +27,22 @@ var (
2727 DisableOnDefault : false ,
2828 Extra : control .ExtraFromString ("aichat" ),
2929 Brief : "OpenAI聊天" ,
30- Help : "- 设置AI聊天触发概率10\n - 设置AI聊天温度80\n - 设置AI聊天密钥xxx\n - 设置AI聊天模型名xxx\n - 设置AI聊天系统提示词xxx" ,
30+ Help : "- 设置AI聊天触发概率10\n - 设置AI聊天温度80\n - 设置AI聊天密钥xxx\n - 设置AI聊天模型名xxx\n - 设置AI聊天系统提示词xxx\n - 设置AI聊天分隔符</think> " ,
3131 PrivateDataFolder : "aichat" ,
3232 })
3333 lst = newlist ()
3434)
3535
3636var (
3737 modelname = "deepseek-ai/DeepSeek-R1"
38- systemprompt = "你正在QQ群与用户聊天,用户发送了消息。按自己的心情简短思考后,条理清晰地回应**一句话**,禁止回应多句。"
38+ systemprompt = "你正在QQ群与用户聊天,用户发送了消息。按自己的心情简短思考后条理清晰地回复。"
39+ sepstr = ""
3940)
4041
4142func init () {
4243 mf := en .DataFolder () + "model.txt"
4344 sf := en .DataFolder () + "system.txt"
45+ pf := en .DataFolder () + "sep.txt"
4446 if file .IsExist (mf ) {
4547 data , err := os .ReadFile (mf )
4648 if err != nil {
@@ -57,6 +59,14 @@ func init() {
5759 systemprompt = string (data )
5860 }
5961 }
62+ if file .IsExist (pf ) {
63+ data , err := os .ReadFile (pf )
64+ if err != nil {
65+ logrus .Warnln ("read sep" , err )
66+ } else {
67+ sepstr = string (data )
68+ }
69+ }
6070
6171 en .OnMessage (func (ctx * zero.Ctx ) bool {
6272 txt := ctx .ExtractPlainText ()
@@ -242,4 +252,18 @@ func init() {
242252 }
243253 ctx .SendChain (message .Text ("成功" ))
244254 })
255+ en .OnPrefix ("设置AI聊天分隔符" , zero .OnlyPrivate , zero .SuperUserPermission ).SetBlock (true ).Handle (func (ctx * zero.Ctx ) {
256+ args := strings .TrimSpace (ctx .State ["args" ].(string ))
257+ if args == "" {
258+ ctx .SendChain (message .Text ("ERROR: empty args" ))
259+ return
260+ }
261+ sepstr = args
262+ err := os .WriteFile (pf , []byte (args ), 0644 )
263+ if err != nil {
264+ ctx .SendChain (message .Text ("ERROR: " , err ))
265+ return
266+ }
267+ ctx .SendChain (message .Text ("成功" ))
268+ })
245269}
0 commit comments