Unverified Commit ea950355 authored by shpgy-shpgy's avatar shpgy-shpgy Committed by GitHub
Browse files

fix: the error when encountering pure text conversations (#5088)


Signed-off-by: default avatarshpgy-shpgy <875664365@qq.com>
parent 5c225145
...@@ -139,17 +139,20 @@ class MultimodalRequestProcessor: ...@@ -139,17 +139,20 @@ class MultimodalRequestProcessor:
for message in messages: for message in messages:
for content in message.get("content", []): for content in message.get("content", []):
if content.get("type") == "text": if isinstance(content, str):
text_parts.append(content.get("text", "")) text_parts.append(content)
elif content.get("type") == "image_url": else:
url = content.get("image_url", {}).get("url", "") if content.get("type") == "text":
if not url: text_parts.append(content.get("text", ""))
continue elif content.get("type") == "image_url":
self.modality = "image" url = content.get("image_url", {}).get("url", "")
if url.endswith((".pt", ".pth", ".bin")): if not url:
embedding_paths.append(url) continue
else: self.modality = "image"
image_urls.append(url) if url.endswith((".pt", ".pth", ".bin")):
embedding_paths.append(url)
else:
image_urls.append(url)
return " ".join(text_parts), image_urls, embedding_paths return " ".join(text_parts), image_urls, embedding_paths
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment