mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-03 06:12:14 +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 {
|
||||
const raw = json
|
||||
.trim()
|
||||
.replace(/^```js\s*/, "")
|
||||
.replace(/^```json\s*/, "")
|
||||
.replace(/^```ts\s*/, "")
|
||||
.replace(/^```plaintext\s*/, "")
|
||||
.replace(/^```\s*/, "")
|
||||
.replace(/\s*```$/, "");
|
||||
return parse(raw) as T;
|
||||
|
||||
Reference in New Issue
Block a user