Commit a326a9c
committed
fix(skills): extract first JSON object instead of last from multi-object LLM output
_extract_json_object() always paired each { with the last } in the
string. When the LLM emitted multiple JSON objects in one response,
the first valid object was silently skipped and the later one was
persisted as the skill.
Use brace-counting to find the matching } for each {, returning the
first complete JSON object.
Fixes #39651 parent 2a4bba2 commit a326a9c
1 file changed
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| |||
0 commit comments