mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 12:24:46 +08:00
feat: ignore more bad cases
This commit is contained in:
@@ -7,7 +7,10 @@ export function parseJSON<T>(json: string | null | undefined, fallback: T) {
|
|||||||
try {
|
try {
|
||||||
const raw = json
|
const raw = json
|
||||||
.trim()
|
.trim()
|
||||||
|
.replace(/^```js\s*/, "")
|
||||||
.replace(/^```json\s*/, "")
|
.replace(/^```json\s*/, "")
|
||||||
|
.replace(/^```ts\s*/, "")
|
||||||
|
.replace(/^```plaintext\s*/, "")
|
||||||
.replace(/^```\s*/, "")
|
.replace(/^```\s*/, "")
|
||||||
.replace(/\s*```$/, "");
|
.replace(/\s*```$/, "");
|
||||||
return parse(raw) as T;
|
return parse(raw) as T;
|
||||||
|
|||||||
Reference in New Issue
Block a user