jayash391 commited on
Commit
fc21868
·
verified ·
1 Parent(s): 2bec3b9

Update sherlock2.py

Browse files
Files changed (1) hide show
  1. sherlock2.py +5 -2
sherlock2.py CHANGED
@@ -323,8 +323,11 @@ def chat_with_sherlock():
323
 
324
  if user_input:
325
  conversation_history = [sherlock_persona, sherlock_guidelines] + st.session_state.chat_history
326
- # Convert chat history tuples to strings
327
- conversation_text = "\n".join([f"Human: {user}\nSherlock: {response}" for user, response in conversation_history])
 
 
 
328
  # Combine conversation text with user input
329
  prompt = conversation_text + f"\nHuman: {user_input}"
330
  response = model.generate_content([prompt])
 
323
 
324
  if user_input:
325
  conversation_history = [sherlock_persona, sherlock_guidelines] + st.session_state.chat_history
326
+ # Convert chat history to text (handle strings and tuples)
327
+ conversation_text = "\n".join([
328
+ item if isinstance(item, str) else f"Human: {item[0]}\nSherlock: {item[1]}"
329
+ for item in conversation_history
330
+ ])
331
  # Combine conversation text with user input
332
  prompt = conversation_text + f"\nHuman: {user_input}"
333
  response = model.generate_content([prompt])