added gridview

This commit is contained in:
DarokCx 2024-09-30 09:08:00 -04:00
parent bebd0e438b
commit 5f5f9e34ea
1 changed files with 24 additions and 0 deletions

View File

@ -433,6 +433,30 @@ function onFeatherlessModelSelect(modelId) {
setGenerationParamsFromPreset({ max_length: model.context_length });
selectedModelId = modelId; // Store the selected model ID
}
let isGridView = true; // Default state set to grid view
// Ensure the correct initial view is applied when the page loads
document.addEventListener('DOMContentLoaded', function() {
const modelCardBlock = document.getElementById('model_card_block');
modelCardBlock.classList.add('grid-view');
const toggleButton = document.getElementById('model_grid_toggle');
toggleButton.addEventListener('click', function() {
// Toggle between grid and list view
if (isGridView) {
modelCardBlock.classList.remove('grid-view');
modelCardBlock.classList.add('list-view');
this.title = 'Toggle to grid view';
} else {
modelCardBlock.classList.remove('list-view');
modelCardBlock.classList.add('grid-view');
this.title = 'Toggle to list view';
}
isGridView = !isGridView;
});
});
function onMancerModelSelect() {
const modelId = String($('#mancer_model').val());
textgen_settings.mancer_model = modelId;