Support image inlining for 01.ai

This commit is contained in:
Cohee 2024-08-01 01:15:13 +03:00
parent 3a8614db94
commit 7b9eb97c7f
2 changed files with 15 additions and 2 deletions

View File

@ -1770,7 +1770,7 @@
</div>
</label>
</div>
<div class="range-block" data-source="openai,openrouter,makersuite,claude,custom">
<div class="range-block" data-source="openai,openrouter,makersuite,claude,custom,01ai">
<label for="openai_image_inlining" class="checkbox_label flexWrap widthFreeExpand">
<input id="openai_image_inlining" type="checkbox" />
<span data-i18n="Send inline images">Send inline images</span>

View File

@ -4298,7 +4298,17 @@ async function onModelChange() {
if (oai_settings.chat_completion_source === chat_completion_sources.ZEROONEAI) {
if (oai_settings.max_context_unlocked) {
$('#openai_max_context').attr('max', unlocked_max);
} else {
}
else if (['yi-large'].includes(oai_settings.zerooneai_model)) {
$('#openai_max_context').attr('max', max_32k);
}
else if (['yi-vision'].includes(oai_settings.zerooneai_model)) {
$('#openai_max_context').attr('max', max_16k);
}
else if (['yi-large-turbo'].includes(oai_settings.zerooneai_model)) {
$('#openai_max_context').attr('max', max_4k);
}
else {
$('#openai_max_context').attr('max', max_16k);
}
@ -4665,6 +4675,7 @@ export function isImageInliningSupported() {
'gpt-4-turbo',
'gpt-4o',
'gpt-4o-mini',
'yi-vision',
];
switch (oai_settings.chat_completion_source) {
@ -4678,6 +4689,8 @@ export function isImageInliningSupported() {
return !oai_settings.openrouter_force_instruct;
case chat_completion_sources.CUSTOM:
return true;
case chat_completion_sources.ZEROONEAI:
return visionSupportedModels.some(model => oai_settings.zerooneai_model.includes(model));
default:
return false;
}