Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -531,10 +531,16 @@ if st.session_state.start_pipeline or st.session_state.resume_pipeline:
|
|
| 531 |
anchor_response = ph.write_stream(stream_with_heartbeat(agent.stream_generate_anchors(topic, keywords, synthesis_result, refs_text)))
|
| 532 |
status.update(label="✅ 锚点推演完成!", state="complete", expanded=False)
|
| 533 |
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 537 |
conclusion_anchor = conclusion_match.group(1).strip() if conclusion_match else ""
|
|
|
|
| 538 |
|
| 539 |
pb.progress(15, text="📝 大纲设计与路由分发...")
|
| 540 |
update_heartbeat()
|
|
|
|
| 531 |
anchor_response = ph.write_stream(stream_with_heartbeat(agent.stream_generate_anchors(topic, keywords, synthesis_result, refs_text)))
|
| 532 |
status.update(label="✅ 锚点推演完成!", state="complete", expanded=False)
|
| 533 |
|
| 534 |
+
# ==========================================================
|
| 535 |
+
# [核心修复] 必须先剔除 <think> 标签!防止正则匹配到模型在思考时引用提示词的空占位符
|
| 536 |
+
# ==========================================================
|
| 537 |
+
anchor_response_clean = re.sub(r'<think>.*?</think>', '', anchor_response, flags=re.DOTALL).strip()
|
| 538 |
+
|
| 539 |
+
abstract_match = re.search(r'-+\s*ABSTRACT\s*-+\s*(.*?)(?=\s*-+\s*CONCLUSION\s*-+|$)', anchor_response_clean, re.DOTALL | re.IGNORECASE)
|
| 540 |
+
conclusion_match = re.search(r'-+\s*CONCLUSION\s*-+\s*(.*?)$', anchor_response_clean, re.DOTALL | re.IGNORECASE)
|
| 541 |
+
abstract_anchor = abstract_match.group(1).strip() if abstract_match else anchor_response_clean.strip()
|
| 542 |
conclusion_anchor = conclusion_match.group(1).strip() if conclusion_match else ""
|
| 543 |
+
# ==========================================================
|
| 544 |
|
| 545 |
pb.progress(15, text="📝 大纲设计与路由分发...")
|
| 546 |
update_heartbeat()
|