Improve model capability checks for AIMLAPI
| @@ -5439,7 +5439,7 @@ export function isImageInliningSupported() { | ||
| 5439 | 5439 | case chat_completion_sources.XAI: |
| 5440 | 5440 | return visionSupportedModels.some(model => oai_settings.xai_model.includes(model)); |
| 5441 | 5441 | case chat_completion_sources.AIMLAPI: |
| 5442 | - return visionSupportedModels.some(model => oai_settings.aimlapi_model.includes(model)); | |
| 5442 | + return (Array.isArray(model_list) && model_list.find(m => m.id === oai_settings.aimlapi_model)?.features?.includes('openai/chat-completion.vision')); | |
| 5443 | 5443 | case chat_completion_sources.POLLINATIONS: |
| 5444 | 5444 | return (Array.isArray(model_list) && model_list.find(m => m.id === oai_settings.pollinations_model)?.vision); |
| 5445 | 5445 | case chat_completion_sources.MOONSHOT: |
| @@ -6086,6 +6086,7 @@ export function initOpenAI() { | ||
| 6086 | 6086 | |
| 6087 | 6087 | $('#custom_prompt_post_processing').on('change', function () { |
| 6088 | 6088 | oai_settings.custom_prompt_post_processing = String($(this).val()); |
| 6089 | + updateFeatureSupportFlags(); | |
| 6089 | 6090 | saveSettingsDebounced(); |
| 6090 | 6091 | }); |
| 6091 | 6092 | |
| @@ -626,6 +626,13 @@ export class ToolManager { | ||
| 626 | 626 | } |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | + if (oai_settings.chat_completion_source === chat_completion_sources.AIMLAPI && Array.isArray(model_list)) { | |
| 630 | + const currentModel = model_list.find(model => model.id === oai_settings.aimlapi_model); | |
| 631 | + if (Array.isArray(currentModel?.features)) { | |
| 632 | + return currentModel.features.includes('openai/chat-completion.function'); | |
| 633 | + } | |
| 634 | + } | |
| 635 | + | |
| 629 | 636 | const supportedSources = [ |
| 630 | 637 | chat_completion_sources.OPENAI, |
| 631 | 638 | chat_completion_sources.CUSTOM, |