mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-06-07 14:17:09 -04:00
API: Remove obsolete multimodal extension handling
Multimodal support will be added back once it's implemented in llama-server.
This commit is contained in:
parent
8137eb8ef4
commit
85bf2e15b9
1 changed files with 0 additions and 24 deletions
|
@ -96,30 +96,6 @@ def convert_history(history):
|
||||||
user_input_last = True
|
user_input_last = True
|
||||||
system_message = ""
|
system_message = ""
|
||||||
|
|
||||||
# Multimodal: convert OpenAI format to multimodal extension format
|
|
||||||
if any('content' in entry and isinstance(entry['content'], list) for entry in history):
|
|
||||||
new_history = []
|
|
||||||
for entry in history:
|
|
||||||
if isinstance(entry['content'], list):
|
|
||||||
for item in entry['content']:
|
|
||||||
if not isinstance(item, dict):
|
|
||||||
continue
|
|
||||||
|
|
||||||
image_url = None
|
|
||||||
content = None
|
|
||||||
if item['type'] == 'image_url' and isinstance(item['image_url'], dict):
|
|
||||||
image_url = item['image_url']['url']
|
|
||||||
elif item['type'] == 'text' and isinstance(item['text'], str):
|
|
||||||
content = item['text']
|
|
||||||
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)
|
|
||||||
|
|
||||||
history = new_history
|
|
||||||
|
|
||||||
for entry in history:
|
for entry in history:
|
||||||
if "image_url" in entry:
|
if "image_url" in entry:
|
||||||
image_url = entry['image_url']
|
image_url = entry['image_url']
|
||||||
|
|
Loading…
Add table
Reference in a new issue