mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-21 21:24:46 +08:00
feat: add ppt generation feat
This commit is contained in:
@@ -16,10 +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.ppt.graph.builder import build_graph as build_ppt_graph
|
||||
from src.server.chat_request import (
|
||||
ChatMessage,
|
||||
ChatRequest,
|
||||
GeneratePodcastRequest,
|
||||
GeneratePPTRequest,
|
||||
TTSRequest,
|
||||
)
|
||||
from src.tools import VolcengineTTS
|
||||
@@ -216,3 +218,22 @@ async def generate_podcast(request: GeneratePodcastRequest):
|
||||
except Exception as e:
|
||||
logger.exception(f"Error occurred during podcast generation: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@app.post("/api/ppt/generate")
|
||||
async def generate_ppt(request: GeneratePPTRequest):
|
||||
try:
|
||||
report_content = request.content
|
||||
print(report_content)
|
||||
workflow = build_ppt_graph()
|
||||
final_state = workflow.invoke({"input": report_content})
|
||||
generated_file_path = final_state["generated_file_path"]
|
||||
with open(generated_file_path, "rb") as f:
|
||||
ppt_bytes = f.read()
|
||||
return Response(
|
||||
content=ppt_bytes,
|
||||
media_type="application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
||||
)
|
||||
except Exception as e:
|
||||
logger.exception(f"Error occurred during ppt generation: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
Reference in New Issue
Block a user