mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-16 19:34:44 +08:00
feat: implement basic web app
This commit is contained in:
10
frontend/src/core/utils/json.ts
Normal file
10
frontend/src/core/utils/json.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { parse } from "best-effort-json-parser";
|
||||
|
||||
export function tryParseJSON(json: string) {
|
||||
try {
|
||||
const object = parse(json);
|
||||
return object;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
10
frontend/src/core/utils/markdown.ts
Normal file
10
frontend/src/core/utils/markdown.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export function extractTitleFromMarkdown(markdown: string) {
|
||||
if (markdown.startsWith("# ")) {
|
||||
let title = markdown.split("\n")[0]!.trim();
|
||||
if (title.startsWith("# ")) {
|
||||
title = title.slice(2).trim();
|
||||
}
|
||||
return title;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
1
frontend/src/core/utils/uuid.ts
Normal file
1
frontend/src/core/utils/uuid.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { v4 as uuid } from "uuid";
|
||||
Reference in New Issue
Block a user