Add xAI for image captioning

This commit is contained in:
Cohee
2025-04-11 19:05:03 +03:00
parent 1c52099ed6
commit 17cdc78a91
5 changed files with 17 additions and 1 deletions

View File

@@ -428,6 +428,7 @@ jQuery(async function () {
'zerooneai': SECRET_KEYS.ZEROONEAI,
'groq': SECRET_KEYS.GROQ,
'cohere': SECRET_KEYS.COHERE,
'xai': SECRET_KEYS.XAI,
};
if (chatCompletionApis[api] && secret_state[chatCompletionApis[api]]) {

View File

@@ -31,6 +31,7 @@
<option value="openrouter">OpenRouter</option>
<option value="ooba" data-i18n="Text Generation WebUI (oobabooga)">Text Generation WebUI (oobabooga)</option>
<option value="vllm">vLLM</option>
<option value="xai">xAI (Grok)</option>
</select>
</div>
<div class="flex1 flex-container flexFlowColumn flexNoGap">
@@ -134,6 +135,8 @@
<option data-type="koboldcpp" value="koboldcpp_current" data-i18n="currently_loaded">[Currently loaded]</option>
<option data-type="vllm" value="vllm_current" data-i18n="currently_selected">[Currently selected]</option>
<option data-type="custom" value="custom_current" data-i18n="currently_selected">[Currently selected]</option>
<option data-type="xai" value="grok-2-vision-1212">grok-2-vision-1212</option>
<option data-type="xai" value="grok-vision-beta">grok-vision-beta</option>
</select>
</div>
<div data-type="ollama">

View File

@@ -153,6 +153,10 @@ function throwIfInvalidModel(useReverseProxy) {
throw new Error('Cohere API key is not set.');
}
if (extension_settings.caption.multimodal_api === 'xai' && !secret_state[SECRET_KEYS.XAI]) {
throw new Error('xAI API key is not set.');
}
if (extension_settings.caption.multimodal_api === 'ollama' && !textgenerationwebui_settings.server_urls[textgen_types.OLLAMA]) {
throw new Error('Ollama server URL is not set.');
}