Spaces:
Sleeping
Sleeping
handle empty tuples
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def authenticate_and_generate(token, message, history, system_message, max_token
|
|
26 |
system_message = str(system_message)
|
27 |
|
28 |
# Construct the prompt with system message, history, and user input
|
29 |
-
history_str = "\n".join([f"User: {str(msg[0])}\nAssistant: {str(msg[1])}" for msg in history if
|
30 |
prompt = system_message + "\n" + history_str
|
31 |
prompt += f"\nUser: {message}\nAssistant:"
|
32 |
|
|
|
26 |
system_message = str(system_message)
|
27 |
|
28 |
# Construct the prompt with system message, history, and user input
|
29 |
+
history_str = "\n".join([f"User: {str(msg[0])}\nAssistant: {str(msg[1])}" for msg in history if isinstance(msg, (tuple, list)) and len(msg) == 2])
|
30 |
prompt = system_message + "\n" + history_str
|
31 |
prompt += f"\nUser: {message}\nAssistant:"
|
32 |
|