39 lines
764 B
Go
39 lines
764 B
Go
//go:build ignore
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
f := "internal/biz/advice_chat.go"
|
|
b, _ := os.ReadFile(f)
|
|
s := string(b)
|
|
|
|
// Add diagnostic log at the start of formatPersonaPrompt, after the nil check
|
|
old := ` if v == nil || len(v) == 0 {
|
|
return ""
|
|
}
|
|
var b strings.Builder`
|
|
|
|
new := ` if v == nil || len(v) == 0 {
|
|
return ""
|
|
}
|
|
// 诊断:打印每个维度的实际类型
|
|
for k, val := range v {
|
|
log.Infof("[人设诊断] key=%q type=%T val=%v", k, val, fmt.Sprintf("%.80v", val))
|
|
}
|
|
var b strings.Builder`
|
|
|
|
if strings.Contains(s, old) {
|
|
s = strings.Replace(s, old, new, 1)
|
|
os.WriteFile(f, []byte(s), 0644)
|
|
println("done - added persona diagnostic log")
|
|
} else {
|
|
println("ERROR: block not found")
|
|
}
|
|
}
|