From b26cbc1c2f2f4bb65a6b3cfdf1edf067839be79a Mon Sep 17 00:00:00 2001 From: paulclindo Date: Thu, 12 Dec 2024 13:07:14 -0500 Subject: [PATCH 1/7] fixes --- apps/shinkai-desktop/src/components/tools/python-tool.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/shinkai-desktop/src/components/tools/python-tool.tsx b/apps/shinkai-desktop/src/components/tools/python-tool.tsx index 8da77e919..641c63007 100644 --- a/apps/shinkai-desktop/src/components/tools/python-tool.tsx +++ b/apps/shinkai-desktop/src/components/tools/python-tool.tsx @@ -173,7 +173,7 @@ export default function PythonTool({ onCheckedChange={async () => { await updateTool({ toolKey: toolKey ?? '', - toolType: 'Deno', + toolType: 'Python', toolPayload: {} as ShinkaiTool, isToolEnabled: !isEnabled, nodeAddress: auth?.node_address ?? '', From 8e12eb7cbb69119a7c6c888f4dc7fa4fb84d8cd3 Mon Sep 17 00:00:00 2001 From: paulclindo Date: Thu, 12 Dec 2024 17:45:57 -0500 Subject: [PATCH 2/7] fixes --- apps/shinkai-desktop/src/pages/tools.tsx | 343 ++++++++++---------- libs/shinkai-ui/src/components/textarea.tsx | 24 +- 2 files changed, 186 insertions(+), 181 deletions(-) diff --git a/apps/shinkai-desktop/src/pages/tools.tsx b/apps/shinkai-desktop/src/pages/tools.tsx index 5f2f577de..d962af45e 100644 --- a/apps/shinkai-desktop/src/pages/tools.tsx +++ b/apps/shinkai-desktop/src/pages/tools.tsx @@ -17,7 +17,6 @@ import { Form, FormField, Input, - ScrollArea, Switch, TextField, Tooltip, @@ -92,191 +91,187 @@ export const Tools = () => { } title={t('tools.label')} > - -
- { - setSearchQuery(e.target.value); +
+ { + setSearchQuery(e.target.value); + }} + placeholder="Search..." + spellCheck={false} + value={searchQuery} + /> + + {searchQuery && ( + + )} +
+
+ {(isPending || !isSearchQuerySynced || isSearchToolListPending) && + Array.from({ length: 8 }).map((_, idx) => ( +
- - {t('common.clearSearch')} - - )} -
-
- {(isPending || !isSearchQuerySynced || isSearchToolListPending) && - Array.from({ length: 8 }).map((_, idx) => ( -
-
- -
- - -
+
+ +
+ +
- -
- ))} - {!searchQuery && - isSearchQuerySynced && - toolsList?.map((tool) => ( -
-
-
- - {formatText(tool.name)}{' '} - - {tool.author !== '@@official.shinkai' && ( - - {tool.author} - - )} -
-

- {tool.description} -

-
- + +
+ ))} + {!searchQuery && + isSearchQuerySynced && + toolsList?.map((tool) => ( +
+
+
+ + {formatText(tool.name)}{' '} + + {tool.author !== '@@official.shinkai' && ( + + {tool.author} + )} - to={`/tools/${tool.tool_router_key}`} - > - - {t('common.configure')} - - - - - { - await updateTool({ - toolKey: tool.tool_router_key, - toolType: tool.tool_type, - toolPayload: {} as ShinkaiTool, - isToolEnabled: !tool.enabled, - nodeAddress: auth?.node_address ?? '', - token: auth?.api_v2_key ?? '', - }); - }} - /> - - - - {t('common.enabled')} - - - - +
+

+ {tool.description} +

- ))} - {searchQuery && - isSearchQuerySynced && - searchToolList?.map((tool) => ( -
-
-
- - {formatText(tool.name)}{' '} - - {tool.author !== '@@official.shinkai' && ( - - {tool.author} - - )} -
-

- {tool.description} -

-
- - + {t('common.configure')} + + + + + { + await updateTool({ + toolKey: tool.tool_router_key, + toolType: tool.tool_type, + toolPayload: {} as ShinkaiTool, + isToolEnabled: !tool.enabled, + nodeAddress: auth?.node_address ?? '', + token: auth?.api_v2_key ?? '', + }); + }} + /> + + + + {t('common.enabled')} + + + + +
+ ))} + {searchQuery && + isSearchQuerySynced && + searchToolList?.map((tool) => ( +
+
+
+ + {formatText(tool.name)}{' '} + + {tool.author !== '@@official.shinkai' && ( + + {tool.author} + )} - to={`/tools/${tool.tool_router_key}`} - > - - {t('common.configure')} - - - - - { - await updateTool({ - toolKey: tool.tool_router_key, - toolType: tool.tool_type, - toolPayload: {} as ShinkaiTool, - isToolEnabled: !tool.enabled, - nodeAddress: auth?.node_address ?? '', - token: auth?.api_v2_key ?? '', - }); - }} - /> - - - - {t('common.enabled')} - - - - -
- ))} - {searchQuery && - isSearchQuerySynced && - searchToolList?.length === 0 && ( -
-

- {t('tools.emptyState.search.text')} +

+

+ {tool.description}

- )} -
- + + + + {t('common.configure')} + + + + + { + await updateTool({ + toolKey: tool.tool_router_key, + toolType: tool.tool_type, + toolPayload: {} as ShinkaiTool, + isToolEnabled: !tool.enabled, + nodeAddress: auth?.node_address ?? '', + token: auth?.api_v2_key ?? '', + }); + }} + /> + + + + {t('common.enabled')} + + + + +
+ ))} + {searchQuery && isSearchQuerySynced && searchToolList?.length === 0 && ( +
+

+ {t('tools.emptyState.search.text')} +

+
+ )} +
); }; diff --git a/libs/shinkai-ui/src/components/textarea.tsx b/libs/shinkai-ui/src/components/textarea.tsx index 2ca03853c..7c5b664c7 100644 --- a/libs/shinkai-ui/src/components/textarea.tsx +++ b/libs/shinkai-ui/src/components/textarea.tsx @@ -5,14 +5,24 @@ import { cn } from '../utils'; const DEFAULT_MIN_TEXTAREA_HEIGHT = 32; const DEFAULT_MAX_TEXTAREA_HEIGHT = 300; -export type TextareaProps = React.TextareaHTMLAttributes & { - minHeight?: number; - maxHeight?: number; - resize?: 'none' | 'both' | 'horizontal' | 'vertical'; -}; +export type TextareaProps = + React.TextareaHTMLAttributes & { + minHeight?: number; + maxHeight?: number; + resize?: 'none' | 'both' | 'horizontal' | 'vertical'; + }; const Textarea = React.forwardRef( - ({ className, minHeight = DEFAULT_MIN_TEXTAREA_HEIGHT, maxHeight = DEFAULT_MAX_TEXTAREA_HEIGHT, resize = 'none', ...props }, ref) => { + ( + { + className, + minHeight = DEFAULT_MIN_TEXTAREA_HEIGHT, + maxHeight = DEFAULT_MAX_TEXTAREA_HEIGHT, + resize = 'none', + ...props + }, + ref, + ) => { const textareaRef = React.useRef(null); React.useLayoutEffect(() => { @@ -34,7 +44,7 @@ const Textarea = React.forwardRef( return (