mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-23 06:04:46 +08:00
* feat: Add comprehensive Chinese localization support for issue #412 - Add locale parameter to ChatRequest model to capture user's language preference - Implement language-aware template loading in template.py with fallback to English - Update all apply_prompt_template calls to pass locale through the workflow - Create Chinese translations for 14 core prompt files: * Main agents: coordinator, planner, researcher, reporter, coder * Subprocess agents: podcast_script_writer, ppt_composer, prompt_enhancer * Writing assistant: all 6 prose prompts - Update app.py to extract and propagate locale through workflow state - Support both zh-CN and en-US locales with automatic fallback - Ensure locale flows through all agent nodes and template rendering * address the review suggestions
This commit is contained in:
@@ -126,6 +126,7 @@ async def chat_stream(request: ChatRequest):
|
||||
request.enable_deep_thinking,
|
||||
request.enable_clarification,
|
||||
request.max_clarification_rounds,
|
||||
request.locale,
|
||||
),
|
||||
media_type="text/event-stream",
|
||||
)
|
||||
@@ -307,6 +308,7 @@ async def _astream_workflow_generator(
|
||||
enable_deep_thinking: bool,
|
||||
enable_clarification: bool,
|
||||
max_clarification_rounds: int,
|
||||
locale: str = "en-US",
|
||||
):
|
||||
# Process initial messages
|
||||
for message in messages:
|
||||
@@ -335,6 +337,7 @@ async def _astream_workflow_generator(
|
||||
"clarified_research_topic": clarified_research_topic,
|
||||
"enable_clarification": enable_clarification,
|
||||
"max_clarification_rounds": max_clarification_rounds,
|
||||
"locale": locale,
|
||||
}
|
||||
|
||||
if not auto_accepted_plan and interrupt_feedback:
|
||||
|
||||
@@ -38,6 +38,9 @@ class ChatRequest(BaseModel):
|
||||
thread_id: Optional[str] = Field(
|
||||
"__default__", description="A specific conversation identifier"
|
||||
)
|
||||
locale: Optional[str] = Field(
|
||||
"en-US", description="Language locale for the conversation (e.g., en-US, zh-CN)"
|
||||
)
|
||||
max_plan_iterations: Optional[int] = Field(
|
||||
1, description="The maximum number of plan iterations"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user