Spaces:
Sleeping
Sleeping
報告標題改為「LLM 輔助研究報告」、模型標註移至標題後並改藍色
Browse files- 報告標題:深度→輔助
- LLM 模型標註由底部移至標題下方,字色改為藍色(docx 與分頁)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- app_agent.py +12 -11
app_agent.py
CHANGED
|
@@ -1293,8 +1293,14 @@ def run_report_writing(scenario_key: str, user_metadata: str, user_focus: str,
|
|
| 1293 |
style = doc.styles['Normal']
|
| 1294 |
style.font.name = '微軟正黑體'
|
| 1295 |
style.font.size = Pt(11)
|
| 1296 |
-
heading = doc.add_heading('LLM
|
| 1297 |
heading.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1298 |
doc.add_paragraph(f'研究情境:{scenario_info["title"]}',
|
| 1299 |
style='Normal').alignment = WD_ALIGN_PARAGRAPH.CENTER
|
| 1300 |
doc.add_paragraph(f'報告時間:{now_tw().strftime("%Y-%m-%d %H:%M:%S")}(台灣時間)',
|
|
@@ -1309,21 +1315,14 @@ def run_report_writing(scenario_key: str, user_metadata: str, user_focus: str,
|
|
| 1309 |
elif stripped.startswith('- '): doc.add_paragraph(stripped[2:], style='List Bullet')
|
| 1310 |
elif stripped.startswith('* '): doc.add_paragraph(stripped[2:], style='List Bullet')
|
| 1311 |
elif stripped: doc.add_paragraph(stripped)
|
| 1312 |
-
# 報告底部:標註使用的 LLM 模型
|
| 1313 |
-
doc.add_paragraph('')
|
| 1314 |
-
foot = doc.add_paragraph(f'本報告由主 Agent(LLM1)模型 {LLM1_MODEL} 生成。')
|
| 1315 |
-
foot.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
| 1316 |
-
for r in foot.runs:
|
| 1317 |
-
r.font.size = Pt(9)
|
| 1318 |
doc.save(str(docx_path))
|
| 1319 |
|
| 1320 |
-
# 存 txt
|
| 1321 |
with open(str(txt_path), 'w', encoding='utf-8') as f:
|
| 1322 |
f.write(f"研究情境:{scenario_info['title']}\n")
|
| 1323 |
f.write(f"時間:{now_tw().strftime('%Y-%m-%d %H:%M:%S')}(台灣時間)\n")
|
| 1324 |
f.write("=" * 60 + "\n\n")
|
| 1325 |
f.write(result_text)
|
| 1326 |
-
f.write(f"\n\n{'=' * 60}\n本報告由主 Agent(LLM1)模型 {LLM1_MODEL} 生成。\n")
|
| 1327 |
|
| 1328 |
return {
|
| 1329 |
"docx_path": docx_path,
|
|
@@ -2754,9 +2753,11 @@ def create_app():
|
|
| 2754 |
try:
|
| 2755 |
with open(str(txt_files[0]), 'r', encoding='utf-8') as f:
|
| 2756 |
rpt_text = f.read()
|
| 2757 |
-
|
|
|
|
|
|
|
| 2758 |
except Exception:
|
| 2759 |
-
R[17] = "### LLM
|
| 2760 |
|
| 2761 |
dl_rpt = []
|
| 2762 |
if final_rpts:
|
|
|
|
| 1293 |
style = doc.styles['Normal']
|
| 1294 |
style.font.name = '微軟正黑體'
|
| 1295 |
style.font.size = Pt(11)
|
| 1296 |
+
heading = doc.add_heading('LLM 輔助重譯研究報告', level=0)
|
| 1297 |
heading.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
| 1298 |
+
# 標題後標註使用的 LLM 模型(藍色)
|
| 1299 |
+
model_p = doc.add_paragraph()
|
| 1300 |
+
model_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
| 1301 |
+
mr = model_p.add_run(f'本報告由主 Agent(LLM1)模型 {LLM1_MODEL} 生成')
|
| 1302 |
+
mr.font.size = Pt(10)
|
| 1303 |
+
mr.font.color.rgb = RGBColor(0x0E, 0x73, 0xB8)
|
| 1304 |
doc.add_paragraph(f'研究情境:{scenario_info["title"]}',
|
| 1305 |
style='Normal').alignment = WD_ALIGN_PARAGRAPH.CENTER
|
| 1306 |
doc.add_paragraph(f'報告時間:{now_tw().strftime("%Y-%m-%d %H:%M:%S")}(台灣時間)',
|
|
|
|
| 1315 |
elif stripped.startswith('- '): doc.add_paragraph(stripped[2:], style='List Bullet')
|
| 1316 |
elif stripped.startswith('* '): doc.add_paragraph(stripped[2:], style='List Bullet')
|
| 1317 |
elif stripped: doc.add_paragraph(stripped)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1318 |
doc.save(str(docx_path))
|
| 1319 |
|
| 1320 |
+
# 存 txt(模型標註置於標題下方)
|
| 1321 |
with open(str(txt_path), 'w', encoding='utf-8') as f:
|
| 1322 |
f.write(f"研究情境:{scenario_info['title']}\n")
|
| 1323 |
f.write(f"時間:{now_tw().strftime('%Y-%m-%d %H:%M:%S')}(台灣時間)\n")
|
| 1324 |
f.write("=" * 60 + "\n\n")
|
| 1325 |
f.write(result_text)
|
|
|
|
| 1326 |
|
| 1327 |
return {
|
| 1328 |
"docx_path": docx_path,
|
|
|
|
| 2753 |
try:
|
| 2754 |
with open(str(txt_files[0]), 'r', encoding='utf-8') as f:
|
| 2755 |
rpt_text = f.read()
|
| 2756 |
+
model_note = (f"<span style='color:#0ea5e9;font-weight:600'>"
|
| 2757 |
+
f"本報告由主 Agent(LLM1)模型 {LLM1_MODEL} 生成</span>")
|
| 2758 |
+
R[17] = f"### LLM 輔助研究報告 {model_note}\n\n{rpt_text}"
|
| 2759 |
except Exception:
|
| 2760 |
+
R[17] = "### LLM 輔助研究報告\n\n(讀取報告時發生錯誤)"
|
| 2761 |
|
| 2762 |
dl_rpt = []
|
| 2763 |
if final_rpts:
|