Spaces:
Runtime error
Runtime error
Update sherlock2.py
Browse files- 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
|
327 |
-
conversation_text = "\n".join([
|
|
|
|
|
|
|
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])
|