From a290c2bffe1089000f7c9b00d848a4796eb693eb Mon Sep 17 00:00:00 2001 From: ZhouYongyou <128128010+zhouyongyou@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:11:08 +0800 Subject: [PATCH] fix(decision): add CJK punctuation support in fixMissingQuotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Critical discovery: AI can output different types of "fullwidth" brackets: - Fullwidth: []{}(U+FF3B/FF3D/FF5B/FF5D) ← Already handled - CJK: 【】〔〕(U+3010/3011/3014/3015) ← Was missing! Root cause of persistent errors: User reported: "JSON 必须以【{开头" The 【 character (U+3010) is NOT the same as [ (U+FF3B)! Added CJK punctuation replacements: - 【 → [ (U+3010 Left Black Lenticular Bracket) - 】 → ] (U+3011 Right Black Lenticular Bracket) - 〔 → [ (U+3014 Left Tortoise Shell Bracket) - 〕 → ] (U+3015 Right Tortoise Shell Bracket) - 、 → , (U+3001 Ideographic Comma) Why this was missed: AI uses different characters in different contexts. CJK brackets (U+3010-3017) are distinct from Fullwidth Forms (U+FF00-FFEF) in Unicode. Test case: Input: 【{"symbol":"BTCUSDT"】 Output: [{"symbol":"BTCUSDT"}] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- decision/engine.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/decision/engine.go b/decision/engine.go index 9619cc61..d8decef9 100644 --- a/decision/engine.go +++ b/decision/engine.go @@ -480,6 +480,13 @@ func fixMissingQuotes(jsonStr string) string { jsonStr = strings.ReplaceAll(jsonStr, ":", ":") // U+FF1A 全角冒号 jsonStr = strings.ReplaceAll(jsonStr, ",", ",") // U+FF0C 全角逗号 + // ⚠️ 替换CJK标点符号(AI在中文上下文中也可能输出这些) + jsonStr = strings.ReplaceAll(jsonStr, "【", "[") // CJK左方头括号 U+3010 + jsonStr = strings.ReplaceAll(jsonStr, "】", "]") // CJK右方头括号 U+3011 + jsonStr = strings.ReplaceAll(jsonStr, "〔", "[") // CJK左龟壳括号 U+3014 + jsonStr = strings.ReplaceAll(jsonStr, "〕", "]") // CJK右龟壳括号 U+3015 + jsonStr = strings.ReplaceAll(jsonStr, "、", ",") // CJK顿号 U+3001 + return jsonStr }