mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-22 05:34:45 +08:00
feat: enable podcast
This commit is contained in:
@@ -64,9 +64,9 @@ async function* chatStreamMock(
|
||||
const [, event] = eventRaw.split("event: ", 2) as [string, string];
|
||||
const [, data] = dataRaw.split("data: ", 2) as [string, string];
|
||||
if (event === "message_chunk") {
|
||||
await sleep(100);
|
||||
await sleep(0);
|
||||
} else if (event === "tool_call_result") {
|
||||
await sleep(2000);
|
||||
await sleep(0);
|
||||
}
|
||||
try {
|
||||
yield {
|
||||
|
||||
19
web/src/core/api/podcast.ts
Normal file
19
web/src/core/api/podcast.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export async function generatePodcast(content: string) {
|
||||
const response = await fetch("/api/podcast/generate", {
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ content }),
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
const blob = new Blob([arrayBuffer], { type: "audio/mp3" });
|
||||
const audioUrl = URL.createObjectURL(blob);
|
||||
return audioUrl;
|
||||
}
|
||||
Reference in New Issue
Block a user