11import { useDebouncedValue } from '@/hooks/useDebounce' ;
2- import { useFetch } from '@/hooks/useFetch' ;
3- import { FeaturedTools , ToolsApiResponse } from '@/model/tools' ;
2+ import { FeaturedTools } from '@/model/tools' ;
43import {
54 Card ,
65 Listbox ,
@@ -58,12 +57,6 @@ export default forwardRef<ToolCatalogRef, CatalogListboxProps>(
5857
5958 const debouncedQuery = useDebouncedValue ( query , 250 ) ;
6059
61- const fetchTools = useFetch < ToolsApiResponse > (
62- 'https://tools.gptscript.ai/api/search?q=' + debouncedQuery ,
63- { disabled : ! debouncedQuery , clearOnDisabled : true }
64- ) ;
65- const { tools : toolsFromQuery = { } } = fetchTools . data ?? { } ;
66-
6760 const featuredResults = useMemo ( ( ) => {
6861 const flattened = ( featuredTools : FeaturedTools ) =>
6962 Object . entries ( featuredTools ) . flatMap ( ( [ category , tools ] ) =>
@@ -107,27 +100,6 @@ export default forwardRef<ToolCatalogRef, CatalogListboxProps>(
107100 const { resultsWithIndexes, lastIndex } = useMemo ( ( ) => {
108101 let index = 0 ;
109102 const featuredCategories = Object . entries ( featuredResults ) ;
110-
111- if ( Object . keys ( toolsFromQuery ) . length !== 0 ) {
112- featuredCategories . push ( [
113- 'Community Tools' ,
114- Object . entries ( toolsFromQuery )
115- . filter (
116- ( [ name ] ) =>
117- ! Object . values ( featuredResults )
118- . flat ( )
119- . some ( ( tool ) => tool . url === name )
120- )
121- . map ( ( [ toolName , tools ] ) => ( {
122- url : toolName ,
123- name : toolName . split ( '/' ) . pop ( ) ?. replace ( / - / g, ' ' ) ?? '' ,
124- description : tools [ 0 ] ?. description ?? '' ,
125- tags : [ ] ,
126- icon : < > </ > ,
127- } ) ) ,
128- ] ) ;
129- }
130-
131103 const resultsWithIndexes = featuredCategories . map (
132104 ( [ category , tools ] ) =>
133105 [
@@ -151,7 +123,7 @@ export default forwardRef<ToolCatalogRef, CatalogListboxProps>(
151123 resultsWithIndexes,
152124 lastIndex,
153125 } ;
154- } , [ featuredResults , toolsFromQuery ] ) ;
126+ } , [ featuredResults ] ) ;
155127
156128 const [ focusedItem , setFocusedItem ] = useState < number | null > ( null ) ;
157129
0 commit comments