From 5f5f9e34ea8c5365bf289d9f1869d62916f93214 Mon Sep 17 00:00:00 2001 From: DarokCx <77368869+DarokCx@users.noreply.github.com> Date: Mon, 30 Sep 2024 09:08:00 -0400 Subject: [PATCH] added gridview --- public/scripts/textgen-models.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/public/scripts/textgen-models.js b/public/scripts/textgen-models.js index e3c9ec2a3..14d39b0c5 100644 --- a/public/scripts/textgen-models.js +++ b/public/scripts/textgen-models.js @@ -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;