Spaces:
Sleeping
Sleeping
Update kadiApy_ragchain.py
Browse files- kadiApy_ragchain.py +7 -3
kadiApy_ragchain.py
CHANGED
@@ -227,10 +227,14 @@ class KadiApyRagchain:
|
|
227 |
def format_history(self, chat_history):
|
228 |
formatted_history = []
|
229 |
for i, entry in enumerate(chat_history, start=1):
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
232 |
formatted_history.append(f"Turn {i}:")
|
233 |
formatted_history.append(f"User Query: {user_query}")
|
234 |
-
formatted_history.append(f"Assistant Response: {assistant_response}")
|
235 |
formatted_history.append("\n")
|
|
|
236 |
return "\n".join(formatted_history)
|
|
|
227 |
def format_history(self, chat_history):
|
228 |
formatted_history = []
|
229 |
for i, entry in enumerate(chat_history, start=1):
|
230 |
+
# Unpack the tuple
|
231 |
+
user_query = entry[0] if entry[0] is not None else "No query provided"
|
232 |
+
assistant_response = entry[1] if entry[1] is not None else "No response yet"
|
233 |
+
|
234 |
+
# Format the history
|
235 |
formatted_history.append(f"Turn {i}:")
|
236 |
formatted_history.append(f"User Query: {user_query}")
|
237 |
+
formatted_history.append(f"Assistant Response: {assistant_response}")
|
238 |
formatted_history.append("\n")
|
239 |
+
|
240 |
return "\n".join(formatted_history)
|