Display context size for featherless models
| @@ -242,6 +242,7 @@ export async function loadFeatherlessModels(data) { | ||
| 242 | 242 | return; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | + data.sort((a, b) => a.id.localeCompare(b.id)); | |
| 245 | 246 | featherlessModels = data; |
| 246 | 247 | |
| 247 | 248 | if (!data.find(x => x.id === textgen_settings.featherless_model)) { |
| @@ -262,6 +263,8 @@ function onFeatherlessModelSelect() { | ||
| 262 | 263 | const modelId = String($('#featherless_model').val()); |
| 263 | 264 | textgen_settings.featherless_model = modelId; |
| 264 | 265 | $('#api_button_textgenerationwebui').trigger('click'); |
| 266 | + const model = featherlessModels.find(x => x.id === modelId); | |
| 267 | + setGenerationParamsFromPreset({ max_length: model.context_length }); | |
| 265 | 268 | } |
| 266 | 269 | |
| 267 | 270 | |
| @@ -431,6 +434,20 @@ function getAphroditeModelTemplate(option) { | ||
| 431 | 434 | `)); |
| 432 | 435 | } |
| 433 | 436 | |
| 437 | +function getFeatherlessModelTemplate(option) { | |
| 438 | + const model = featherlessModels.find(x => x.id === option?.element?.value); | |
| 439 | + | |
| 440 | + if (!option.id || !model) { | |
| 441 | + return option.text; | |
| 442 | + } | |
| 443 | + | |
| 444 | + return $((` | |
| 445 | + <div class="flex-container flexFlowColumn"> | |
| 446 | + <div><strong>${DOMPurify.sanitize(model.name)}</strong> | <span>${model.context_length || '???'} tokens</span></div> | |
| 447 | + </div> | |
| 448 | + `)); | |
| 449 | +} | |
| 450 | + | |
| 434 | 451 | async function downloadOllamaModel() { |
| 435 | 452 | try { |
| 436 | 453 | const serverUrl = textgen_settings.server_urls[textgen_types.OLLAMA]; |
| @@ -679,6 +696,7 @@ jQuery(function () { | ||
| 679 | 696 | searchInputPlaceholder: 'Search models...', |
| 680 | 697 | searchInputCssClass: 'text_pole', |
| 681 | 698 | width: '100%', |
| 699 | + templateResult: getFeatherlessModelTemplate, | |
| 682 | 700 | }); |
| 683 | 701 | providersSelect.select2({ |
| 684 | 702 | sorter: data => data.sort((a, b) => a.text.localeCompare(b.text)), |