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 @@
17701770 </div>
17711771 </label>
17721772 </div>
17731773 <div class="range-block" data-source="openai,openrouter,makersuite,claude,custom,01ai">
17741774 <label for="openai_image_inlining" class="checkbox_label flexWrap widthFreeExpand">
17751775 <input id="openai_image_inlining" type="checkbox" />
17761776 <span data-i18n="Send inline images">Send inline images</span>
public/scripts/openai.js+14 -1
@@ -4298,7 +4298,17 @@ async function onModelChange() {
42984298 if (oai_settings.chat_completion_source === chat_completion_sources.ZEROONEAI) {
42994299 if (oai_settings.max_context_unlocked) {
43004300 $('#openai_max_context').attr('max', unlocked_max);
43014301 } else {
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 {
43024312 $('#openai_max_context').attr('max', max_16k);
43034313 }
43044314
@@ -4665,6 +4675,7 @@ export function isImageInliningSupported() {
46654675 'gpt-4-turbo',
46664676 'gpt-4o',
46674677 'gpt-4o-mini',
4678+ 'yi-vision',
46684679 ];
46694680
46704681 switch (oai_settings.chat_completion_source) {
@@ -4678,6 +4689,8 @@ export function isImageInliningSupported() {
46784689 return !oai_settings.openrouter_force_instruct;
46794690 case chat_completion_sources.CUSTOM:
46804691 return true;
4692+ case chat_completion_sources.ZEROONEAI:
4693+ return visionSupportedModels.some(model => oai_settings.zerooneai_model.includes(model));
46814694 default:
46824695 return false;
46834696 }