Commit e6e8b8e
fix(tool-parser): auto-repair truncated JSON from web models
Web models (especially DeepSeek) sometimes return tool_call JSON
with missing closing braces due to SSE stream truncation.
Added fuzzy repair:
- Count open/close braces, append missing "}" automatically
- Regex fallback for partial matches
- All 5 truncation patterns now parse correctly
Verified: DeepSeek "帮我看看桌面上有什么文件" → exec ls ~/Desktop → file list
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent a269cd6 commit e6e8b8e
1 file changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
48 | 61 | | |
49 | 62 | | |
50 | 63 | | |
51 | 64 | | |
52 | 65 | | |
53 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
54 | 73 | | |
55 | 74 | | |
56 | 75 | | |
| |||
0 commit comments