superemewill commited on
Commit
62c3609
·
verified ·
1 Parent(s): 9d4d891

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -603,12 +603,18 @@ def main():
603
 
604
  # 操作按钮
605
  col1, col2, col3, col4 = st.columns(4)
606
-
 
 
 
 
 
 
607
  with col1:
608
  st.download_button(
609
  label="📥 下载 MD",
610
  data=final_blog,
611
- file_name=f"{topic.replace(' ', '_')}.md",
612
  mime="text/markdown",
613
  use_container_width=True
614
  )
@@ -626,7 +632,7 @@ def main():
626
  st.download_button(
627
  label="📥 下载 JSON",
628
  data=json.dumps(export_data, ensure_ascii=False, indent=2),
629
- file_name=f"{topic.replace(' ', '_')}.json",
630
  mime="application/json",
631
  use_container_width=True
632
  )
 
603
 
604
  # 操作按钮
605
  col1, col2, col3, col4 = st.columns(4)
606
+
607
+
608
+ if isinstance(topic, list):
609
+ topic_str = "_".join(str(x).strip().replace(' ', '_') for x in topic if x)
610
+ else:
611
+ topic_str = str(topic)
612
+
613
  with col1:
614
  st.download_button(
615
  label="📥 下载 MD",
616
  data=final_blog,
617
+ file_name=f"{topic_str.replace(' ', '_')}.md",
618
  mime="text/markdown",
619
  use_container_width=True
620
  )
 
632
  st.download_button(
633
  label="📥 下载 JSON",
634
  data=json.dumps(export_data, ensure_ascii=False, indent=2),
635
+ file_name=f"{topic_str.replace(' ', '_')}.json",
636
  mime="application/json",
637
  use_container_width=True
638
  )