mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-22 09:58:06 +00:00
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:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user