feat: Sort Tools and Functions dropdowns alphabetically (#20871)

Alphabetically sort Tools and Functions selection dropdowns in Chat Controls sidebar for easier navigation and better user experience.
This commit is contained in:
G30
2026-01-22 07:07:07 -05:00
committed by GitHub
parent 14f6747dfc
commit 9e5d6069fe

View File

@@ -172,7 +172,7 @@
>{$i18n.t('Select a tool')}</option
>
{#each $tools.filter((tool) => !tool?.id?.startsWith('server:')) as tool, toolIdx}
{#each $tools.filter((tool) => !tool?.id?.startsWith('server:')).sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')) as tool, toolIdx}
<option value={tool.id} class="bg-gray-100 dark:bg-gray-800">{tool.name}</option>
{/each}
{:else if tab === 'functions'}
@@ -180,7 +180,7 @@
>{$i18n.t('Select a function')}</option
>
{#each $functions as func, funcIdx}
{#each $functions.sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')) as func, funcIdx}
<option value={func.id} class="bg-gray-100 dark:bg-gray-800">{func.name}</option>
{/each}
{/if}