Work on tl

This commit is contained in:
Yokayo
2025-04-28 18:45:16 +07:00
parent 97e1f482c1
commit 11908f7363
13 changed files with 191 additions and 61 deletions

View File

@@ -5,8 +5,9 @@ import { textgenerationwebui_settings as textgen_settings, textgen_types } from
import { tokenizers } from './tokenizers.js';
import { renderTemplateAsync } from './templates.js';
import { POPUP_TYPE, callGenericPopup } from './popup.js';
import { t } from './i18n.js';
import { t, translate } from './i18n.js';
import { accountStorage } from './util/AccountStorage.js';
import { localizePagination } from './utils.js';
let mancerModels = [];
let togetherModels = [];
@@ -368,7 +369,16 @@ export async function loadFeatherlessModels(data) {
prevText: '<',
nextText: '>',
formatNavigator: function (currentPage, totalPage) {
return (currentPage - 1) * perPage + 1 + ' - ' + currentPage * perPage + ' of ' + totalPage * perPage;
let translated_of;
try {
translated_of = translate('pagination_of');
if (translated_of == 'pagination_of') {
translated_of = 'of';
}
} catch (e) {
translated_of = 'of';
}
return (currentPage - 1) * perPage + 1 + ' - ' + currentPage * perPage + ` ${translated_of} ` + totalPage * perPage;
},
showNavigator: true,
callback: function (modelsOnPage, pagination) {
@@ -391,15 +401,15 @@ export async function loadFeatherlessModels(data) {
const modelClassDiv = document.createElement('div');
modelClassDiv.classList.add('model-class');
modelClassDiv.textContent = `Class: ${model.model_class || 'N/A'}`;
modelClassDiv.textContent = t`Class` + `: ${model.model_class || 'N/A'}`;
const contextLengthDiv = document.createElement('div');
contextLengthDiv.classList.add('model-context-length');
contextLengthDiv.textContent = `Context Length: ${model.context_length}`;
contextLengthDiv.textContent = t`Context Length` + `: ${model.context_length}`;
const dateAddedDiv = document.createElement('div');
dateAddedDiv.classList.add('model-date-added');
dateAddedDiv.textContent = `Added On: ${new Date(model.created * 1000).toLocaleDateString()}`;
dateAddedDiv.textContent = t`Added On` + `: ${new Date(model.created * 1000).toLocaleDateString()}`;
detailsContainer.appendChild(modelClassDiv);
detailsContainer.appendChild(contextLengthDiv);
@@ -423,6 +433,7 @@ export async function loadFeatherlessModels(data) {
// Update the current page value whenever the page changes
featherlessCurrentPage = pagination.pageNumber;
localizePagination(paginationContainer);
},
afterSizeSelectorChange: function (e) {
const newPerPage = e.target.value;