Support image inlining for 01.ai

7b9eb97c7f3032bee19f8cf98899250a9859cd6d

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +15 -2Showing whitespace changes
public/index.html+1 -1
@@ -1770,7 +1770,7 @@
1770 </div>1770 </div>
1771 </label>1771 </label>
1772 </div>1772 </div>
1773 <div class="range-block" data-source="openai,openrouter,makersuite,claude,custom">1773 <div class="range-block" data-source="openai,openrouter,makersuite,claude,custom,01ai">
1774 <label for="openai_image_inlining" class="checkbox_label flexWrap widthFreeExpand">1774 <label for="openai_image_inlining" class="checkbox_label flexWrap widthFreeExpand">
1775 <input id="openai_image_inlining" type="checkbox" />1775 <input id="openai_image_inlining" type="checkbox" />
1776 <span data-i18n="Send inline images">Send inline images</span>1776 <span data-i18n="Send inline images">Send inline images</span>
public/scripts/openai.js+14 -1
@@ -4298,7 +4298,17 @@ async function onModelChange() {
4298 if (oai_settings.chat_completion_source === chat_completion_sources.ZEROONEAI) {4298 if (oai_settings.chat_completion_source === chat_completion_sources.ZEROONEAI) {
4299 if (oai_settings.max_context_unlocked) {4299 if (oai_settings.max_context_unlocked) {
4300 $('#openai_max_context').attr('max', unlocked_max);4300 $('#openai_max_context').attr('max', unlocked_max);
4301 } else {4301 }
4302 else if (['yi-large'].includes(oai_settings.zerooneai_model)) {
4303 $('#openai_max_context').attr('max', max_32k);
4304 }
4305 else if (['yi-vision'].includes(oai_settings.zerooneai_model)) {
4306 $('#openai_max_context').attr('max', max_16k);
4307 }
4308 else if (['yi-large-turbo'].includes(oai_settings.zerooneai_model)) {
4309 $('#openai_max_context').attr('max', max_4k);
4310 }
4311 else {
4302 $('#openai_max_context').attr('max', max_16k);4312 $('#openai_max_context').attr('max', max_16k);
4303 }4313 }
43044314
@@ -4665,6 +4675,7 @@ export function isImageInliningSupported() {
4665 'gpt-4-turbo',4675 'gpt-4-turbo',
4666 'gpt-4o',4676 'gpt-4o',
4667 'gpt-4o-mini',4677 'gpt-4o-mini',
4678 'yi-vision',
4668 ];4679 ];
46694680
4670 switch (oai_settings.chat_completion_source) {4681 switch (oai_settings.chat_completion_source) {
@@ -4678,6 +4689,8 @@ export function isImageInliningSupported() {
4678 return !oai_settings.openrouter_force_instruct;4689 return !oai_settings.openrouter_force_instruct;
4679 case chat_completion_sources.CUSTOM:4690 case chat_completion_sources.CUSTOM:
4680 return true;4691 return true;
4692 case chat_completion_sources.ZEROONEAI:
4693 return visionSupportedModels.some(model => oai_settings.zerooneai_model.includes(model));
4681 default:4694 default:
4682 return false;4695 return false;
4683 }4696 }