PeterPinetree commited on
Commit
43d4e1c
·
verified ·
1 Parent(s): 3780a59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -190,11 +190,10 @@ def save_story(chat_history):
190
  return None
191
 
192
  story_text = "# My Interactive Adventure\n\n"
193
- # Process in pairs (user message, bot response)
194
- for i in range(0, len(chat_history), 2):
195
- if i+1 < len(chat_history):
196
- story_text += f"**Player:** {chat_history[i]}\n\n"
197
- story_text += f"**Story:** {chat_history[i+1]}\n\n---\n\n"
198
 
199
  # Return as bytes for download
200
  return story_text.encode('utf-8')
 
190
  return None
191
 
192
  story_text = "# My Interactive Adventure\n\n"
193
+ # Process chat history (already in tuples of user, bot messages)
194
+ for user_msg, bot_msg in chat_history:
195
+ story_text += f"**Player:** {user_msg}\n\n"
196
+ story_text += f"**Story:** {bot_msg}\n\n---\n\n"
 
197
 
198
  # Return as bytes for download
199
  return story_text.encode('utf-8')