diff --git a/frontend/app.py b/frontend/app.py index 11d06b0..7c61042 100644 --- a/frontend/app.py +++ b/frontend/app.py @@ -237,13 +237,19 @@ def run_workflow(api_key, model, max_round): # 显示需求 st.info(f"📋 用户需求:{requirement}") - # 创建 Agent - llm_config = get_llm_config(model=model, api_key=api_key) + # 创建 Agent - 配置大 token 数,确保生成完整内容 + llm_config = get_llm_config(model=model, api_key=api_key, temperature=0.7, max_tokens=8192) - pm = AssistantAgent("PM_Agent", system_message=PM_PROMPT, llm_config=llm_config, human_input_mode="NEVER") - qa = AssistantAgent("QA_Agent", system_message=QA_PROMPT, llm_config=llm_config, human_input_mode="NEVER") - dev = AssistantAgent("Dev_Agent", system_message=DEV_PROMPT, llm_config=llm_config, human_input_mode="NEVER") - orch = AssistantAgent("Orchestrator", system_message=ORCH_PROMPT, llm_config=llm_config, human_input_mode="NEVER") + # 优化提示词,要求生成完整代码 + pm_prompt = PM_PROMPT + "\n\n【重要】请生成完整的、详细的需求文档,不要省略任何内容。" + qa_prompt = QA_PROMPT + "\n\n【重要】请生成完整的测试代码,包含所有必要的导入、测试函数和断言,不要省略。" + dev_prompt = DEV_PROMPT + "\n\n【重要】请生成完整的、可运行的代码,包含所有必要的导入、类和函数实现,不要省略任何代码。" + orch_prompt = ORCH_PROMPT + "\n\n【重要】请确保所有输出完整详细。" + + pm = AssistantAgent("PM_Agent", system_message=pm_prompt, llm_config=llm_config, human_input_mode="NEVER") + qa = AssistantAgent("QA_Agent", system_message=qa_prompt, llm_config=llm_config, human_input_mode="NEVER") + dev = AssistantAgent("Dev_Agent", system_message=dev_prompt, llm_config=llm_config, human_input_mode="NEVER") + orch = AssistantAgent("Orchestrator", system_message=orch_prompt, llm_config=llm_config, human_input_mode="NEVER") user = UserProxyAgent("User_Proxy", human_input_mode="NEVER", max_consecutive_auto_reply=0, code_execution_config={"work_dir": "workspace", "use_docker": False})