fix: another UTF-8 string index bug in debug output
This commit is contained in:
@@ -327,7 +327,11 @@ func (h *Handler) Math(imageBase64 string) (result string, err error) {
|
||||
maxIdx = c
|
||||
}
|
||||
}
|
||||
fmt.Printf("DEBUG: Position 0 argmax = %d (char: %s)\n", maxIdx, string("0123456789+-*/÷×=?."[maxIdx-1]))
|
||||
// 【注意】这里用 string 索引访问多字节字符可能有问题,仅用于调试
|
||||
debugChars := []string{"", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", "*", "/", "÷", "×", "=", "?"}
|
||||
if maxIdx >= 0 && maxIdx < len(debugChars) {
|
||||
fmt.Printf("DEBUG: Position 0 argmax = %d (char: %s)\n", maxIdx, debugChars[maxIdx])
|
||||
}
|
||||
|
||||
if len(output) == 0 {
|
||||
return "", fmt.Errorf("模型输出为空")
|
||||
|
||||
Reference in New Issue
Block a user