mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-19 12:24:46 +08:00
feat: enable ppt_composer.zh_CN.md with request.locale (#694)
* feat: enable ppt_composer.zh_CN.md with request.locale * fix: GeneratePPTRequest miss locale field --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
@@ -21,7 +21,7 @@ def ppt_composer_node(state: PPTState):
|
|||||||
model = get_llm_by_type(AGENT_LLM_MAP["ppt_composer"])
|
model = get_llm_by_type(AGENT_LLM_MAP["ppt_composer"])
|
||||||
ppt_content = model.invoke(
|
ppt_content = model.invoke(
|
||||||
[
|
[
|
||||||
SystemMessage(content=get_prompt_template("ppt/ppt_composer")),
|
SystemMessage(content=get_prompt_template("ppt/ppt_composer", locale=state.get("locale", "en-US"))),
|
||||||
HumanMessage(content=state["input"]),
|
HumanMessage(content=state["input"]),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class PPTState(MessagesState):
|
|||||||
|
|
||||||
# Input
|
# Input
|
||||||
input: str = ""
|
input: str = ""
|
||||||
|
locale: str = ""
|
||||||
# Output
|
# Output
|
||||||
generated_file_path: str = ""
|
generated_file_path: str = ""
|
||||||
|
|
||||||
|
|||||||
@@ -751,7 +751,7 @@ async def generate_ppt(request: GeneratePPTRequest):
|
|||||||
report_content = request.content
|
report_content = request.content
|
||||||
print(report_content)
|
print(report_content)
|
||||||
workflow = build_ppt_graph()
|
workflow = build_ppt_graph()
|
||||||
final_state = workflow.invoke({"input": report_content})
|
final_state = workflow.invoke({"input": report_content, "locale": request.locale})
|
||||||
generated_file_path = final_state["generated_file_path"]
|
generated_file_path = final_state["generated_file_path"]
|
||||||
with open(generated_file_path, "rb") as f:
|
with open(generated_file_path, "rb") as f:
|
||||||
ppt_bytes = f.read()
|
ppt_bytes = f.read()
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ class GeneratePodcastRequest(BaseModel):
|
|||||||
|
|
||||||
class GeneratePPTRequest(BaseModel):
|
class GeneratePPTRequest(BaseModel):
|
||||||
content: str = Field(..., description="The content of the ppt")
|
content: str = Field(..., description="The content of the ppt")
|
||||||
|
locale: str = Field(
|
||||||
|
"en-US", description="Language locale for the conversation (e.g., en-US, zh-CN)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class GenerateProseRequest(BaseModel):
|
class GenerateProseRequest(BaseModel):
|
||||||
|
|||||||
Reference in New Issue
Block a user