Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -255,13 +255,16 @@ def reset_conversation(
|
|
| 255 |
# GRADIO UI INTERFACE
|
| 256 |
# ============================================================================
|
| 257 |
|
| 258 |
-
def format_history_for_chatbot(history: List[Tuple[str, str]]) -> List[
|
| 259 |
"""
|
| 260 |
Convert internal (question, answer) tuples into
|
| 261 |
-
Gradio Chatbot
|
| 262 |
-
Returns the history as-is since Gradio expects [(user_msg, bot_msg), ...]
|
| 263 |
"""
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
|
| 267 |
def generate_visual_topic_suggestions(
|
|
|
|
| 255 |
# GRADIO UI INTERFACE
|
| 256 |
# ============================================================================
|
| 257 |
|
| 258 |
+
def format_history_for_chatbot(history: List[Tuple[str, str]]) -> List[dict]:
|
| 259 |
"""
|
| 260 |
Convert internal (question, answer) tuples into
|
| 261 |
+
Gradio v4 Chatbot message format.
|
|
|
|
| 262 |
"""
|
| 263 |
+
messages = []
|
| 264 |
+
for q, a in history:
|
| 265 |
+
messages.append({"role": "user", "content": q})
|
| 266 |
+
messages.append({"role": "assistant", "content": a})
|
| 267 |
+
return messages
|
| 268 |
|
| 269 |
|
| 270 |
def generate_visual_topic_suggestions(
|