fix: WebUI 配置数字科学计数法 + 增强输出通道引导提示词

- webui settings PUT: 整数型 float64(如 QQ 号)规范化为 int64 存储,
  避免 fmt.Sprint 以科学计数法(2.198972886e+09)存库导致读取解析失败
- 系统提示词【输出规则】重写: 明确消息不会自动路由,
  区分同步通道(直接返回文本)与异步通道(必须调用 output_send__{通道}),
  引导模型优先回复当前输入通道并带正确 meta(user_id/group_id)
This commit is contained in:
JianFeeeee
2026-08-15 17:24:14 +08:00
parent 014870a0e0
commit 1bc2bf5d8d
2 changed files with 14 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import (
"fmt"
"io"
"log"
"math"
"net/http"
"sort"
"strconv"
@ -1410,6 +1411,11 @@ func (h *Handler) handleSettings(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusBadRequest, map[string]string{"error": "invalid request"})
return
}
// 整数型 float64如 QQ 号 2.198972886e+09规范化为 int64
// 避免被 fmt.Sprint 以科学计数法存库导致后续读取/解析失败。
if f, ok := body.Value.(float64); ok && f == math.Trunc(f) && math.Abs(f) < 1e15 {
body.Value = int64(f)
}
deleting := body.Value == nil
if strings.HasPrefix(body.Key, "plugin.") {
parts := strings.SplitN(body.Key, ".", 3)