mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add Tabby model selection
This commit is contained in:
@ -12,6 +12,7 @@ let dreamGenModels = [];
|
||||
let vllmModels = [];
|
||||
let aphroditeModels = [];
|
||||
let featherlessModels = [];
|
||||
let tabbyModels = [];
|
||||
export let openRouterModels = [];
|
||||
|
||||
/**
|
||||
@ -66,6 +67,30 @@ export async function loadOllamaModels(data) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadTabbyModels(data) {
|
||||
if (!Array.isArray(data)) {
|
||||
console.error('Invalid Tabby models data', data);
|
||||
return;
|
||||
}
|
||||
|
||||
tabbyModels = data;
|
||||
tabbyModels.sort((a, b) => a.id.localeCompare(b.id));
|
||||
tabbyModels.unshift({ id: '' });
|
||||
|
||||
if (!tabbyModels.find(x => x.id === textgen_settings.tabby_model)) {
|
||||
textgen_settings.tabby_model = tabbyModels[0]?.id || '';
|
||||
}
|
||||
|
||||
$('#tabby_model').empty();
|
||||
for (const model of tabbyModels) {
|
||||
const option = document.createElement('option');
|
||||
option.value = model.id;
|
||||
option.text = model.id;
|
||||
option.selected = model.id === textgen_settings.tabby_model;
|
||||
$('#tabby_model').append(option);
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadTogetherAIModels(data) {
|
||||
if (!Array.isArray(data)) {
|
||||
console.error('Invalid Together AI models data', data);
|
||||
@ -310,6 +335,12 @@ function onOllamaModelSelect() {
|
||||
$('#api_button_textgenerationwebui').trigger('click');
|
||||
}
|
||||
|
||||
function onTabbyModelSelect() {
|
||||
const modelId = String($('#tabby_model').val());
|
||||
textgen_settings.tabby_model = modelId;
|
||||
$('#api_button_textgenerationwebui').trigger('click');
|
||||
}
|
||||
|
||||
function onOpenRouterModelSelect() {
|
||||
const modelId = String($('#openrouter_model').val());
|
||||
textgen_settings.openrouter_model = modelId;
|
||||
@ -641,6 +672,7 @@ export function initTextGenModels() {
|
||||
$('#aphrodite_model').on('change', onAphroditeModelSelect);
|
||||
$('#featherless_model').on('change', onFeatherlessModelSelect);
|
||||
$('#tabby_download_model').on('click', downloadTabbyModel);
|
||||
$('#tabby_model').on('change', onTabbyModelSelect);
|
||||
|
||||
const providersSelect = $('.openrouter_providers');
|
||||
for (const provider of OPENROUTER_PROVIDERS) {
|
||||
@ -671,6 +703,13 @@ export function initTextGenModels() {
|
||||
searchInputCssClass: 'text_pole',
|
||||
width: '100%',
|
||||
});
|
||||
$('#tabby_model').select2({
|
||||
placeholder: '[Currently loaded]',
|
||||
searchInputPlaceholder: 'Search models...',
|
||||
searchInputCssClass: 'text_pole',
|
||||
width: '100%',
|
||||
allowClear: true,
|
||||
});
|
||||
$('#model_infermaticai_select').select2({
|
||||
placeholder: 'Select a model',
|
||||
searchInputPlaceholder: 'Search models...',
|
||||
|
Reference in New Issue
Block a user