@ian2018cs/agenthub 0.1.83 → 0.1.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -7,11 +7,14 @@ const MAX_PER_USER = 10;
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 剥离参数字符串两端的引号(支持直引号和 curly quotes)并解析 JSON
|
|
10
|
+
* 同时将 AI 错误写入的 \' 还原为单引号(\' 在 JSON 中非法,但单引号本身在 JSON 字符串值里合法)
|
|
10
11
|
*/
|
|
11
12
|
function parseJsonArg(raw) {
|
|
12
13
|
let s = raw.trim();
|
|
13
14
|
// 直引号 ' " 和 curly quotes \u2018\u2019\u201C\u201D
|
|
14
15
|
s = s.replace(/^[\s\u2018\u201C'"]|[\s\u2019\u201D'"]+$/g, '').trim();
|
|
16
|
+
// 修复 AI 错误转义:\' → '(JSON 不支持 \',但单引号本身合法)
|
|
17
|
+
s = s.replace(/\\'/g, "'");
|
|
15
18
|
return JSON.parse(s);
|
|
16
19
|
}
|
|
17
20
|
|