Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -286,12 +286,26 @@ words = st.number_input(ui["words_label"], min_value=12000, max_value=25000, val
|
|
| 286 |
|
| 287 |
tab_amj, tab_asq = st.tabs(["✨ 定量实证研究 (AMJ 引擎)", "📝 定性案例研究 (ASQ 引擎)"])
|
| 288 |
|
|
|
|
|
|
|
| 289 |
with tab_amj:
|
| 290 |
st.markdown("### 📊 定量研究配置 (Academy of Management Journal Style)")
|
| 291 |
st.info("💡 该模式聚焦理论演绎、假设检验与因果推断。结构锁定为:引言、理论与假设、方法、结果、讨论、结论。")
|
| 292 |
uploaded_papers_amj = st.file_uploader("1. 上传核心参考论文 (可选,仅限PDF/DOCX,建议1-20篇)", type=["pdf", "doc", "docx"], accept_multiple_files=True, key="up_amj_ref", disabled=st.session_state.is_running)
|
| 293 |
-
uploaded_data_amj = st.file_uploader("2. 上传
|
| 294 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
if st.button("🚀 启动 AMJ 模式生成", disabled=st.session_state.is_running, key="btn_amj"):
|
| 296 |
if is_system_busy():
|
| 297 |
st.warning("⏳ 有小伙伴在写作,预计25-35分钟后可用。")
|
|
@@ -307,6 +321,18 @@ with tab_asq:
|
|
| 307 |
uploaded_papers_asq = st.file_uploader("1. 上传核心参考论文 (可选,仅限PDF/DOCX,建议1-20篇)", type=["pdf", "doc", "docx"], accept_multiple_files=True, key="up_asq_ref", disabled=st.session_state.is_running)
|
| 308 |
uploaded_interviews = st.file_uploader("2. 上传真实访谈/田野资料 (可选,仅限TXT/PDF/DOCX)", type=["txt", "pdf", "doc", "docx"], key="up_asq_data", disabled=st.session_state.is_running)
|
| 309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
if st.button("🚀 启动 ASQ 模式生成", disabled=st.session_state.is_running, key="btn_asq"):
|
| 311 |
if is_system_busy():
|
| 312 |
st.warning("⏳ 有小伙伴在写作,预计25-35分钟后可用。")
|
|
@@ -669,7 +695,7 @@ if st.session_state.start_pipeline or st.session_state.resume_pipeline:
|
|
| 669 |
lang_hint = "ru" if "Русский" in target_lang else ("kk" if "Қазақша" in target_lang else "en")
|
| 670 |
num_paragraphs = agent._calc_paragraph_count(adjusted_target, lang_hint)
|
| 671 |
|
| 672 |
-
if "introduction" in sec_title.lower():
|
| 673 |
adaptive_heading_rule = "[HEADING MANDATE] DO NOT use any subheadings (no ## or ###) in this section. Write in continuous, well-structured paragraphs."
|
| 674 |
else:
|
| 675 |
adaptive_heading_rule = f"[HEADING MANDATE] Use Level 2 (##) and Level 3 (###) subheadings to structure the text." if adjusted_target > 800 else (f"[HEADING MANDATE] Use Level 2 (##) subheadings." if adjusted_target > 400 else "")
|
|
|
|
| 286 |
|
| 287 |
tab_amj, tab_asq = st.tabs(["✨ 定量实证研究 (AMJ 引擎)", "📝 定性案例研究 (ASQ 引擎)"])
|
| 288 |
|
| 289 |
+
tab_amj, tab_asq = st.tabs(["✨ 定量实证研究 (AMJ 引擎)", "📝 定性案例研究 (ASQ 引擎)"])
|
| 290 |
+
|
| 291 |
with tab_amj:
|
| 292 |
st.markdown("### 📊 定量研究配置 (Academy of Management Journal Style)")
|
| 293 |
st.info("💡 该模式聚焦理论演绎、假设检验与因果推断。结构锁定为:引言、理论与假设、方法、结果、讨论、结论。")
|
| 294 |
uploaded_papers_amj = st.file_uploader("1. 上传核心参考论文 (可选,仅限PDF/DOCX,建议1-20篇)", type=["pdf", "doc", "docx"], accept_multiple_files=True, key="up_amj_ref", disabled=st.session_state.is_running)
|
| 295 |
+
uploaded_data_amj = st.file_uploader("2. 上传统计结果表 (可选,仅限Excel/CSV)", type=["csv", "xlsx", "xls"], key="up_amj_data", disabled=st.session_state.is_running)
|
| 296 |
|
| 297 |
+
# =========================================================
|
| 298 |
+
# [新增] AMJ 定量数据模板 UI (折叠面板 + 下载按钮)
|
| 299 |
+
# =========================================================
|
| 300 |
+
with st.expander("💡 不知道怎么整理数据?点击查看 & 下载:定量数据 (CSV) 标准模板"):
|
| 301 |
+
st.markdown("**⚠️ 核心提示**:请上传**统计结果表**(如信效度、相关系数、路径系数),**请勿**上传成千上万行的原始问卷明细,以免触发系统防超载截断。")
|
| 302 |
+
|
| 303 |
+
amj_csv_template = """--- 表1: 描述性统计与相关系数 ---\nVariables,Mean,SD,1,2,3\nTeam Cohesion,4.21,0.85,(0.88),,\nAI Integration,3.95,0.91,0.45**,(0.82),\nTask Performance,4.10,0.78,0.52**,0.38*,(0.85)\n\n--- 表2: 信效度检验 ---\nConstruct,Items,Cronbach's Alpha,CR,AVE\nTeam Cohesion,4,0.89,0.91,0.71\nAI Integration,3,0.85,0.88,0.68\n\n--- 表3: 假设检验 ---\nHypothesis,Path,Beta,T-value,P-value,Supported?\nH1,AI Integration -> Team Cohesion,0.35,4.21,0.000,Yes"""
|
| 304 |
+
|
| 305 |
+
st.code(amj_csv_template, language="csv")
|
| 306 |
+
st.download_button(label="📥 一键下载 CSV 数据模板", data=amj_csv_template, file_name="AMJ_Data_Template.csv", mime="text/csv", use_container_width=True)
|
| 307 |
+
# =========================================================
|
| 308 |
+
|
| 309 |
if st.button("🚀 启动 AMJ 模式生成", disabled=st.session_state.is_running, key="btn_amj"):
|
| 310 |
if is_system_busy():
|
| 311 |
st.warning("⏳ 有小伙伴在写作,预计25-35分钟后可用。")
|
|
|
|
| 321 |
uploaded_papers_asq = st.file_uploader("1. 上传核心参考论文 (可选,仅限PDF/DOCX,建议1-20篇)", type=["pdf", "doc", "docx"], accept_multiple_files=True, key="up_asq_ref", disabled=st.session_state.is_running)
|
| 322 |
uploaded_interviews = st.file_uploader("2. 上传真实访谈/田野资料 (可选,仅限TXT/PDF/DOCX)", type=["txt", "pdf", "doc", "docx"], key="up_asq_data", disabled=st.session_state.is_running)
|
| 323 |
|
| 324 |
+
# =========================================================
|
| 325 |
+
# [新增] ASQ 定性访谈模板 UI (折叠面板 + 下载按钮)
|
| 326 |
+
# =========================================================
|
| 327 |
+
with st.expander("💡 不知道怎么整理访谈?点击查看 & 下载:定性访谈记录 (TXT) 标准模板"):
|
| 328 |
+
st.markdown("**⚠️ 核心提示**:为了让 AI 提取出最精准的语录和编码树,请务必标注**受访者角色 (Role)**,并采用清晰的**对话格式**。")
|
| 329 |
+
|
| 330 |
+
asq_txt_template = """[Interview ID]: INT-01\n[Role]: Senior Software Engineer\n[Date]: 2026-03-12\n[Duration]: 45 mins\n\nInterviewer: How did the introduction of the generative AI assistant change your daily stand-up meetings?\n\nRespondent (INT-01): To be honest, it was total chaos at first. Everyone was looking at the AI's code suggestions instead of talking to each other. We stopped debating architecture because we just assumed the AI knew better. It felt like we lost our collective intuition. \n\nInterviewer: Did that feeling of losing intuition change over time?\n\nRespondent (INT-01): Yes. About a month in, we realized the AI was making repetitive architecture errors. That forced us to communicate more deeply than before.\n\n--------------------------------------------------\n\n[Interview ID]: INT-02\n[Role]: Scrum Master\n[Date]: 2026-03-15\n\nInterviewer: [Your Question Here]\n\nRespondent (INT-02): [Their Answer Here]"""
|
| 331 |
+
|
| 332 |
+
st.code(asq_txt_template, language="text")
|
| 333 |
+
st.download_button(label="📥 一键下载 TXT 访谈模板", data=asq_txt_template, file_name="ASQ_Interview_Template.txt", mime="text/plain", use_container_width=True)
|
| 334 |
+
# =========================================================
|
| 335 |
+
|
| 336 |
if st.button("🚀 启动 ASQ 模式生成", disabled=st.session_state.is_running, key="btn_asq"):
|
| 337 |
if is_system_busy():
|
| 338 |
st.warning("⏳ 有小伙伴在写作,预计25-35分钟后可用。")
|
|
|
|
| 695 |
lang_hint = "ru" if "Русский" in target_lang else ("kk" if "Қазақша" in target_lang else "en")
|
| 696 |
num_paragraphs = agent._calc_paragraph_count(adjusted_target, lang_hint)
|
| 697 |
|
| 698 |
+
if "introduction" in sec_title.lower() or "conclusion" in sec_title.lower():
|
| 699 |
adaptive_heading_rule = "[HEADING MANDATE] DO NOT use any subheadings (no ## or ###) in this section. Write in continuous, well-structured paragraphs."
|
| 700 |
else:
|
| 701 |
adaptive_heading_rule = f"[HEADING MANDATE] Use Level 2 (##) and Level 3 (###) subheadings to structure the text." if adjusted_target > 800 else (f"[HEADING MANDATE] Use Level 2 (##) subheadings." if adjusted_target > 400 else "")
|