Tabby: Fix model name return on error

Tabby's model API is always /v1/model/list, so return "None" if the
request fails since that means a model is most likely not loaded.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2023-11-23 00:09:58 -05:00
parent b4afb10fab
commit e445aeec14
2 changed files with 5 additions and 1 deletions

View File

@ -1513,7 +1513,7 @@
<option value="kobold"><span data-i18n="KoboldAI">KoboldAI Classic</span></option> <option value="kobold"><span data-i18n="KoboldAI">KoboldAI Classic</span></option>
<option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</span></option> <option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</span></option>
<option value="novel"><span data-i18n="NovelAI">NovelAI</span></option> <option value="novel"><span data-i18n="NovelAI">NovelAI</span></option>
<option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, KoboldCpp)</span></option> <option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, TabbyAPI, KoboldCpp)</span></option>
<option value="openai"><span data-i18n="Chat Completion (OpenAI, Claude, Window/OpenRouter, Scale, AI21)">Chat Completion (OpenAI, Claude, Window, OpenRouter, Scale, AI21, PaLM)</span></option> <option value="openai"><span data-i18n="Chat Completion (OpenAI, Claude, Window/OpenRouter, Scale, AI21)">Chat Completion (OpenAI, Claude, Window, OpenRouter, Scale, AI21, PaLM)</span></option>
</select> </select>
</div> </div>

View File

@ -596,6 +596,10 @@ app.post("/api/textgenerationwebui/status", jsonParser, async function (request,
const modelName = modelInfo?.id; const modelName = modelInfo?.id;
result = modelName || result; result = modelName || result;
} else {
// TabbyAPI returns an error 400 if a model isn't loaded
result = "None"
} }
} catch (error) { } catch (error) {
console.error(`Failed to get TabbyAPI model info: ${error}`); console.error(`Failed to get TabbyAPI model info: ${error}`);