API: Relax multimodal format, fixes HuggingFace Chat UI (#6353)

This commit is contained in:
Stefan Merettig 2024-09-03 04:03:15 +02:00 committed by GitHub
parent 4c74c7a116
commit 9a150c3368
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: B5690EEEBB952194

View file

@ -154,8 +154,9 @@ def convert_history(history):
elif item['type'] == 'text' and isinstance(item['text'], str):
content = item['text']
if image_url and content:
if image_url:
new_history.append({"image_url": image_url, "role": "user"})
if content:
new_history.append({"content": content, "role": "user"})
else:
new_history.append(entry)