yym68686 commited on
Commit
93f77d4
·
1 Parent(s): 89394ee

✨ Feature: Add an "image" field to the configuration file to customize control over whether to enable image reading support.

Browse files
Files changed (1) hide show
  1. request.py +6 -6
request.py CHANGED
@@ -142,7 +142,7 @@ async def get_gemini_payload(request, engine, provider):
142
  if item.type == "text":
143
  text_message = await get_text_message(msg.role, item.text, engine)
144
  content.append(text_message)
145
- elif item.type == "image_url":
146
  image_message = await get_image_message(item.image_url.url, engine)
147
  content.append(image_message)
148
  else:
@@ -331,7 +331,7 @@ async def get_vertex_gemini_payload(request, engine, provider):
331
  if item.type == "text":
332
  text_message = await get_text_message(msg.role, item.text, engine)
333
  content.append(text_message)
334
- elif item.type == "image_url":
335
  image_message = await get_image_message(item.image_url.url, engine)
336
  content.append(image_message)
337
  else:
@@ -477,7 +477,7 @@ async def get_vertex_claude_payload(request, engine, provider):
477
  if item.type == "text":
478
  text_message = await get_text_message(msg.role, item.text, engine)
479
  content.append(text_message)
480
- elif item.type == "image_url":
481
  image_message = await get_image_message(item.image_url.url, engine)
482
  content.append(image_message)
483
  else:
@@ -610,7 +610,7 @@ async def get_gpt_payload(request, engine, provider):
610
  if item.type == "text":
611
  text_message = await get_text_message(msg.role, item.text, engine)
612
  content.append(text_message)
613
- elif item.type == "image_url":
614
  image_message = await get_image_message(item.image_url.url, engine)
615
  content.append(image_message)
616
  else:
@@ -677,7 +677,7 @@ async def get_openrouter_payload(request, engine, provider):
677
  if item.type == "text":
678
  text_message = await get_text_message(msg.role, item.text, engine)
679
  content.append(text_message)
680
- elif item.type == "image_url":
681
  image_message = await get_image_message(item.image_url.url, engine)
682
  content.append(image_message)
683
  else:
@@ -943,7 +943,7 @@ async def get_claude_payload(request, engine, provider):
943
  if item.type == "text":
944
  text_message = await get_text_message(msg.role, item.text, engine)
945
  content.append(text_message)
946
- elif item.type == "image_url":
947
  image_message = await get_image_message(item.image_url.url, engine)
948
  content.append(image_message)
949
  else:
 
142
  if item.type == "text":
143
  text_message = await get_text_message(msg.role, item.text, engine)
144
  content.append(text_message)
145
+ elif item.type == "image_url" and provider.get("image", True):
146
  image_message = await get_image_message(item.image_url.url, engine)
147
  content.append(image_message)
148
  else:
 
331
  if item.type == "text":
332
  text_message = await get_text_message(msg.role, item.text, engine)
333
  content.append(text_message)
334
+ elif item.type == "image_url" and provider.get("image", True):
335
  image_message = await get_image_message(item.image_url.url, engine)
336
  content.append(image_message)
337
  else:
 
477
  if item.type == "text":
478
  text_message = await get_text_message(msg.role, item.text, engine)
479
  content.append(text_message)
480
+ elif item.type == "image_url" and provider.get("image", True):
481
  image_message = await get_image_message(item.image_url.url, engine)
482
  content.append(image_message)
483
  else:
 
610
  if item.type == "text":
611
  text_message = await get_text_message(msg.role, item.text, engine)
612
  content.append(text_message)
613
+ elif item.type == "image_url" and provider.get("image", True):
614
  image_message = await get_image_message(item.image_url.url, engine)
615
  content.append(image_message)
616
  else:
 
677
  if item.type == "text":
678
  text_message = await get_text_message(msg.role, item.text, engine)
679
  content.append(text_message)
680
+ elif item.type == "image_url" and provider.get("image", True):
681
  image_message = await get_image_message(item.image_url.url, engine)
682
  content.append(image_message)
683
  else:
 
943
  if item.type == "text":
944
  text_message = await get_text_message(msg.role, item.text, engine)
945
  content.append(text_message)
946
+ elif item.type == "image_url" and provider.get("image", True):
947
  image_message = await get_image_message(item.image_url.url, engine)
948
  content.append(image_message)
949
  else: