mirror of
https://git.mirrors.martin98.com/https://github.com/bytedance/deer-flow
synced 2025-08-17 23:35:53 +08:00
feat: pass params from HTTP post body
This commit is contained in:
parent
b96e47746e
commit
4d33aeed6a
@ -16,7 +16,12 @@ from langgraph.types import Command
|
||||
|
||||
from src.graph.builder import build_graph
|
||||
from src.podcast.graph.builder import build_graph as build_podcast_graph
|
||||
from src.server.chat_request import ChatMessage, ChatRequest, TTSRequest
|
||||
from src.server.chat_request import (
|
||||
ChatMessage,
|
||||
ChatRequest,
|
||||
GeneratePodcastRequest,
|
||||
TTSRequest,
|
||||
)
|
||||
from src.tools import VolcengineTTS
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -199,10 +204,11 @@ async def text_to_speech(request: TTSRequest):
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@app.get("/api/podcast/generate")
|
||||
async def generate_podcast():
|
||||
@app.post("/api/podcast/generate")
|
||||
async def generate_podcast(request: GeneratePodcastRequest):
|
||||
try:
|
||||
report_content = open("examples/nanjing_tangbao.md").read()
|
||||
report_content = request.content
|
||||
print(report_content)
|
||||
workflow = build_podcast_graph()
|
||||
final_state = workflow.invoke({"input": report_content})
|
||||
audio_bytes = final_state["output"]
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
from typing import List, Optional, Union, Dict, Any
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
@ -60,3 +60,7 @@ class TTSRequest(BaseModel):
|
||||
1, description="Whether to use frontend processing"
|
||||
)
|
||||
frontend_type: Optional[str] = Field("unitTson", description="Frontend type")
|
||||
|
||||
|
||||
class GeneratePodcastRequest(BaseModel):
|
||||
content: str = Field(..., description="The content of the podcast")
|
||||
|
Loading…
x
Reference in New Issue
Block a user