Better Practice

 Better Practice
This commit is contained in:
Clivia 2024-08-03 21:00:37 +08:00
parent 8f49429228
commit 028eb7b351

View File

@ -21,10 +21,8 @@
let filteredModels = []; let filteredModels = [];
$: filteredModels = $models $: filteredModels = $models
.filter( .filter((p) =>
(p) => p.name.toLowerCase().includes(prompt.toLowerCase().split(' ')?.at(0)?.substring(1) ?? '')
p.name.toLowerCase().includes(prompt.toLowerCase().split(' ')?.at(0)?.substring(1) ?? '') &&
p?.info?.meta?.hidden
) )
.sort((a, b) => a.name.localeCompare(b.name)); .sort((a, b) => a.name.localeCompare(b.name));
@ -151,7 +149,7 @@
<button <button
class="px-3 py-1.5 rounded-xl w-full text-left {modelIdx === selectedIdx class="px-3 py-1.5 rounded-xl w-full text-left {modelIdx === selectedIdx
? 'bg-gray-50 dark:bg-gray-850 selected-command-option-button' ? 'bg-gray-50 dark:bg-gray-850 selected-command-option-button'
: ''}" : ''} {model?.info?.meta?.hidden ? 'hidden' : ''}"
type="button" type="button"
on:click={() => { on:click={() => {
confirmSelect(model); confirmSelect(model);
@ -164,7 +162,7 @@
<div class="flex font-medium text-black dark:text-gray-100 line-clamp-1"> <div class="flex font-medium text-black dark:text-gray-100 line-clamp-1">
<img <img
src={model?.info?.meta?.profile_image_url ?? '/static/favicon.png'} src={model?.info?.meta?.profile_image_url ?? '/static/favicon.png'}
alt="Model" alt={model.name}
class="rounded-full size-6 items-center mr-2" class="rounded-full size-6 items-center mr-2"
/> />
{model.name} {model.name}