From face9087f2a1b5c316ea5809f4170d50efc467c7 Mon Sep 17 00:00:00 2001 From: Eddie Date: Fri, 27 Dec 2024 16:12:59 -0300 Subject: [PATCH] Adding versions --- .../src/components/playground-tool/schemas.ts | 2 ++ apps/shinkai-desktop/src/pages/tools.tsx | 8 +++++++- libs/shinkai-ui/src/helpers/format-text.ts | 13 +++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/apps/shinkai-desktop/src/components/playground-tool/schemas.ts b/apps/shinkai-desktop/src/components/playground-tool/schemas.ts index d3e9ac933..99aaa9883 100644 --- a/apps/shinkai-desktop/src/components/playground-tool/schemas.ts +++ b/apps/shinkai-desktop/src/components/playground-tool/schemas.ts @@ -13,6 +13,8 @@ export const ToolMetadataSchema = z.object({ author: z.string(), + version: z.string().default('1.0.0'), + keywords: z.array(z.string()).default([]), configurations: z diff --git a/apps/shinkai-desktop/src/pages/tools.tsx b/apps/shinkai-desktop/src/pages/tools.tsx index d3918a777..17878676c 100644 --- a/apps/shinkai-desktop/src/pages/tools.tsx +++ b/apps/shinkai-desktop/src/pages/tools.tsx @@ -25,7 +25,7 @@ import { TooltipProvider, TooltipTrigger, } from '@shinkai_network/shinkai-ui'; -import { formatText } from '@shinkai_network/shinkai-ui/helpers'; +import { formatText, getVersionFromTool } from '@shinkai_network/shinkai-ui/helpers'; import { cn } from '@shinkai_network/shinkai-ui/utils'; import { BoltIcon, @@ -150,6 +150,9 @@ export const Tools = () => { {formatText(tool.name)}{' '} + + {getVersionFromTool(tool)} + {tool.author !== '@@official.shinkai' && ( {tool.author} @@ -213,6 +216,9 @@ export const Tools = () => { {formatText(tool.name)}{' '} + + {getVersionFromTool(tool)} + {tool.author !== '@@official.shinkai' && ( {tool.author} diff --git a/libs/shinkai-ui/src/helpers/format-text.ts b/libs/shinkai-ui/src/helpers/format-text.ts index c945080c6..ade55ac37 100644 --- a/libs/shinkai-ui/src/helpers/format-text.ts +++ b/libs/shinkai-ui/src/helpers/format-text.ts @@ -1,3 +1,5 @@ +import { ShinkaiToolHeader } from "@shinkai_network/shinkai-message-ts/api/tools/types"; + export const formatText = (text: string) => { const words = text.split('_'); @@ -21,3 +23,14 @@ export const formatCamelCaseText = (text: string) => { return result.charAt(0).toUpperCase() + result.slice(1); }; + +export const getVersionFromTool = (toolRouterKey: ShinkaiToolHeader) => { + if (toolRouterKey.version) { + return toolRouterKey.version; + } + const parts = toolRouterKey.name.split(':::'); + if (parts.length === 4) { + return parts[3]; + } + return 'latest'; +};