Rathapoom commited on
Commit
682335c
·
verified ·
1 Parent(s): d00c434

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -7
app.py CHANGED
@@ -2937,8 +2937,20 @@ def show_completion_options():
2937
  try:
2938
  st.balloons()
2939
 
2940
- # Show completion message
2941
- st.markdown("""
 
 
 
 
 
 
 
 
 
 
 
 
2942
  <div style="
2943
  background-color: #e8f5e9;
2944
  padding: 20px;
@@ -2951,7 +2963,7 @@ def show_completion_options():
2951
  🎉 ยินดีด้วย! คุณเขียนเรื่องราวจบสมบูรณ์แล้ว
2952
  </h2>
2953
  <p style="color: #1b5e20;">
2954
- เรื่องราวของคุณจบลงด้วย: {st.session_state.ending_type}
2955
  </p>
2956
  </div>
2957
  """, unsafe_allow_html=True)
@@ -2967,11 +2979,14 @@ def show_completion_options():
2967
  use_container_width=True):
2968
  with st.spinner("กำลังเรียบเรียงเรื่องราว..."):
2969
  try:
2970
- stitched_story = stitch_story(
2971
- st.session_state.story,
2972
- st.session_state.current_theme,
2973
- st.session_state.level
 
 
2974
  )
 
2975
  show_stitched_story(stitched_story)
2976
  except Exception as e:
2977
  logging.error(f"Error in story stitching: {str(e)}")
 
2937
  try:
2938
  st.balloons()
2939
 
2940
+ # Show completion message with proper ending type display
2941
+ ending_type_display = {
2942
+ "Happy Ending": "จบแบบมีความสุข",
2943
+ "Mysterious Ending": "จบแบบทิ้งท้ายให้คิดต่อ",
2944
+ "Lesson Learned": "จบแบบได้ข้อคิด",
2945
+ "Surprise Ending": "จบแบบพลิกความคาดหมาย"
2946
+ }
2947
+
2948
+ current_ending = ending_type_display.get(
2949
+ st.session_state.ending_type,
2950
+ st.session_state.ending_type
2951
+ )
2952
+
2953
+ st.markdown(f"""
2954
  <div style="
2955
  background-color: #e8f5e9;
2956
  padding: 20px;
 
2963
  🎉 ยินดีด้วย! คุณเขียนเรื่องราวจบสมบูรณ์แล้ว
2964
  </h2>
2965
  <p style="color: #1b5e20;">
2966
+ เรื่องราวของคุณจบลงด้วย: {current_ending}
2967
  </p>
2968
  </div>
2969
  """, unsafe_allow_html=True)
 
2979
  use_container_width=True):
2980
  with st.spinner("กำลังเรียบเรียงเรื่องราว..."):
2981
  try:
2982
+ stitched_story = generate_stitched_story(
2983
+ story=st.session_state.story,
2984
+ style="Classic Fairytale", # Default style
2985
+ detail_level="ปานกลาง", # Default detail level
2986
+ theme=st.session_state.current_theme,
2987
+ level=st.session_state.level
2988
  )
2989
+ st.session_state.stitched_story = stitched_story
2990
  show_stitched_story(stitched_story)
2991
  except Exception as e:
2992
  logging.error(f"Error in story stitching: {str(e)}")