2323 const RESOURCE_BACKUP_PATH = ` litellm/${RESOURCE_BACKUP_NAME } ` ;
2424 let providers: string [] = [];
2525 let selectedProvider: string = ' ' ;
26+ let maxTokens: number | null = null ;
2627
2728 onMount (() => {
2829 const urlParams = new URLSearchParams (window .location .search );
@@ -126,22 +127,21 @@ We also need to update [${RESOURCE_BACKUP_NAME}](https://github.com/${REPO_FULL_
126127 let loading = true ;
127128
128129 $ : {
129- filterResults (query , selectedProvider );
130+ filterResults (query , selectedProvider , maxTokens );
130131 }
131132
132- function filterResults(query : string , selectedProvider : string ) {
133+ function filterResults(query : string , selectedProvider : string , maxTokens : number | null ) {
133134 if (index ) {
134135 let filteredResults: Item [];
135136
136137 // Get all items from the index
137138 const allItems = index [' _docs' ] as Item [];
138139
139- // First, filter by provider if one is selected
140- if (selectedProvider ) {
141- filteredResults = allItems .filter (item => item .litellm_provider === selectedProvider );
142- } else {
143- filteredResults = allItems ;
144- }
140+ // Filter by provider and max_tokens
141+ filteredResults = allItems .filter (item =>
142+ (! selectedProvider || item .litellm_provider === selectedProvider ) &&
143+ (maxTokens === null || (item .max_tokens && item .max_tokens >= maxTokens ))
144+ );
145145
146146 // Then, apply search query if it's not empty
147147 if (query !== " " && query !== null ) {
@@ -166,6 +166,7 @@ We also need to update [${RESOURCE_BACKUP_NAME}](https://github.com/${REPO_FULL_
166166 results = filteredResults .map ((item , refIndex ) => ({ item , refIndex }));
167167 loading = false ;
168168 }
169+
169170}
170171 </script >
171172
@@ -198,23 +199,43 @@ We also need to update [${RESOURCE_BACKUP_NAME}](https://github.com/${REPO_FULL_
198199 <section style =" height: 1.5em;" />
199200 {/if }
200201
201-
202-
203-
204202 <input
205- bind:value ={query }
206- type =" search"
207- autocomplete =" off"
208- name =" query"
209- aria-label =" query"
210- />
211-
212- <select bind:value ={selectedProvider }>
213- <option value =" " >All Providers</option >
214- {#each providers as provider }
215- <option value ={provider }>{provider }</option >
216- {/each }
217- </select >
203+ id =" query"
204+ bind:value ={query }
205+ type =" search"
206+ autocomplete =" off"
207+ name =" query"
208+ aria-label =" query"
209+ placeholder =" Search for models..."
210+ />
211+
212+
213+
214+ <div class =" filter-container" >
215+
216+ <div class =" filter-row" >
217+ <div class =" filter-item" >
218+ <label for =" provider" >Select provider:</label >
219+ <select id ="provider" bind:value ={selectedProvider }>
220+ <option value =" " >All Providers</option >
221+ {#each providers as provider }
222+ <option value ={provider }>{provider }</option >
223+ {/each }
224+ </select >
225+ </div >
226+
227+ <div class =" filter-item" >
228+ <label for =" maxTokens" >max_tokens >=</label >
229+ <input
230+ id =" maxTokens"
231+ bind:value ={maxTokens }
232+ type =" number"
233+ min =" 0"
234+ placeholder =" Enter minimum max_tokens"
235+ />
236+ </div >
237+ </div >
238+ </div >
218239
219240 {#if loading }
220241 <span aria-busy =" true" />
@@ -255,8 +276,50 @@ We also need to update [${RESOURCE_BACKUP_NAME}](https://github.com/${REPO_FULL_
255276 white-space : nowrap ;
256277 }
257278
279+
280+ /* Remove the margin-top from the existing select style */
258281 select {
259- margin-top : 1rem ;
260282 width : 100% ;
261283 }
284+
285+ summary :hover {
286+ font-weight : bold ;
287+ }
288+
289+ h2 {
290+ margin-top : 2rem ;
291+ }
292+ input , select {
293+ margin-top : 0.5rem ; /* Ensure margin top for all inputs and selects */
294+ }
295+
296+ .truncate {
297+ overflow : hidden ;
298+ text-overflow : ellipsis ;
299+ white-space : nowrap ;
300+ }
301+
302+ .filter-container {
303+ margin-top : 1rem ;
304+ }
305+
306+ .filter-row {
307+ display : flex ;
308+ justify-content : space-between ; /* spaces filter items across the row */
309+ align-items : center ; /* aligns items vertically in the middle */
310+ }
311+
312+ .filter-item {
313+ display : flex ;
314+ flex-direction : column ; /* stacks label and input vertically */
315+ flex : 1 ;
316+ padding : 0 10px ;
317+ }
318+
319+ /* Alignment and full width for inputs inside flex containers */
320+ select , input [type = " number" ] {
321+ width : 100% ; /* makes input take full width of its parent */
322+ margin-top : 0.4rem ; /* Add a little top margin for visual spacing */
323+ }
324+
262325 </style >
0 commit comments