Update vlm.py
Browse files
vlm.py
CHANGED
@@ -59,7 +59,7 @@ def build_messages(message: dict, history: list[tuple]):
|
|
59 |
|
60 |
# Build the message list including history
|
61 |
messages = []
|
62 |
-
combined_user_input = [] #Combine images and text if found in same turn.
|
63 |
for user_turn, bot_turn in history:
|
64 |
if isinstance(user_turn, tuple): # Image input
|
65 |
image_content = [
|
@@ -69,8 +69,8 @@ def build_messages(message: dict, history: list[tuple]):
|
|
69 |
} for image_url in user_turn
|
70 |
]
|
71 |
combined_user_input.extend(image_content)
|
72 |
-
elif isinstance(user_turn, str): #Text input
|
73 |
-
combined_user_input.append({"type":"text", "text": user_turn})
|
74 |
if combined_user_input and bot_turn:
|
75 |
messages.append({'role': 'user', 'content': combined_user_input})
|
76 |
messages.append({'role': 'assistant', 'content': [{"type": "text", "text": bot_turn}]})
|
|
|
59 |
|
60 |
# Build the message list including history
|
61 |
messages = []
|
62 |
+
combined_user_input = [] # Combine images and text if found in same turn.
|
63 |
for user_turn, bot_turn in history:
|
64 |
if isinstance(user_turn, tuple): # Image input
|
65 |
image_content = [
|
|
|
69 |
} for image_url in user_turn
|
70 |
]
|
71 |
combined_user_input.extend(image_content)
|
72 |
+
elif isinstance(user_turn, str): # Text input
|
73 |
+
combined_user_input.append({"type": "text", "text": user_turn})
|
74 |
if combined_user_input and bot_turn:
|
75 |
messages.append({'role': 'user', 'content': combined_user_input})
|
76 |
messages.append({'role': 'assistant', 'content': [{"type": "text", "text": bot_turn}]})
|