GuXiaopeng commited on
Commit
205b79a
·
verified ·
1 Parent(s): f615937

Update core/pipeline_agent.py

Browse files
Files changed (1) hide show
  1. core/pipeline_agent.py +26 -0
core/pipeline_agent.py CHANGED
@@ -477,6 +477,32 @@ You MUST output your response EXACTLY using the following two delimiters. Do not
477
 
478
  return final_abstract, final_conclusion
479
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  # =====================================================================
481
  # [核心架构升级] 双轨制大纲路由,取代自由生成的结构断层风险
482
  # =====================================================================
 
477
 
478
  return final_abstract, final_conclusion
479
 
480
+ # ... 保留上面的 synthesize_literature 和 generate_anchors 函数不变 ...
481
+
482
+ # [新增] 综合文献的流式输出方法
483
+ def stream_synthesize_literature(self, topic, refs_text, user_core_literature=""):
484
+ user_injection = f"\n\nCRITICAL MANDATE: Prioritize User-Provided Core Literature:\n<USER_CORE_LITERATURE>\n{user_core_literature[:20000]}\n</USER_CORE_LITERATURE>\n" if user_core_literature else ""
485
+ sys_prompt = APP_CONFIG["prompt_templates"]["synthesis_system"]
486
+ user_prompt = APP_CONFIG["prompt_templates"]["synthesis_user"].replace(
487
+ "{topic}", topic).replace("{user_injection}", user_injection).replace(
488
+ "{refs_text}", refs_text).replace("{directive}", APP_CONFIG['deep_synthesis_directive'])
489
+ return self.stream_deepseek(sys_prompt, user_prompt, model_name="deepseek-chat")
490
+
491
+ # [新增] 生成锚点的流式输出方法
492
+ def stream_generate_anchors(self, topic, keywords, synthesis_result, refs_text):
493
+ sys_prompt = "You are a senior scholar conceptualizing a high-impact empirical paper."
494
+ format_mandate = """\n\n[CRITICAL FORMAT MANDATE]
495
+ You MUST output your response EXACTLY using the following two delimiters. Do not add Markdown headings like ## before them:
496
+ ---ABSTRACT---
497
+ (Write the comprehensive abstract here)
498
+ ---CONCLUSION---
499
+ (Write the expected conclusion here)"""
500
+
501
+ base_directive = APP_CONFIG.get('anchor_generation_directive', '')
502
+ user_prompt = f"Topic: {topic}\nKeywords: {keywords}\nLiterature Synthesis:\n{synthesis_result}\nCitation Context:\n{refs_text[:3000]}\n{base_directive}{format_mandate}"
503
+
504
+ return self.stream_deepseek(sys_prompt, user_prompt, max_tokens=8000, model_name="deepseek-reasoner")
505
+
506
  # =====================================================================
507
  # [核心架构升级] 双轨制大纲路由,取代自由生成的结构断层风险
508
  # =====================================================================