diff --git a/internal/captcha/handler.go b/internal/captcha/handler.go index eb7461b..46bf0e1 100644 --- a/internal/captcha/handler.go +++ b/internal/captcha/handler.go @@ -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("模型输出为空")