Skip to content

Commit

Permalink
Merge pull request #581 from dcSpark/feature/versions
Browse files Browse the repository at this point in the history
Adding versions
  • Loading branch information
acedward authored Dec 27, 2024
2 parents 2555f49 + face908 commit 4081e10
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion apps/shinkai-desktop/src/pages/tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -150,6 +150,9 @@ export const Tools = () => {
<span className="text-sm font-medium capitalize text-white">
{formatText(tool.name)}{' '}
</span>
<Badge className="text-gray-80 bg-gray-200 text-xs font-normal">
{getVersionFromTool(tool)}
</Badge>
{tool.author !== '@@official.shinkai' && (
<Badge className="text-gray-80 bg-gray-200 text-xs font-normal">
{tool.author}
Expand Down Expand Up @@ -213,6 +216,9 @@ export const Tools = () => {
<span className="text-sm font-medium text-white">
{formatText(tool.name)}{' '}
</span>
<Badge className="text-gray-80 bg-gray-200 text-xs font-normal">
{getVersionFromTool(tool)}
</Badge>
{tool.author !== '@@official.shinkai' && (
<Badge className="text-gray-80 bg-gray-200 text-xs font-normal">
{tool.author}
Expand Down
13 changes: 13 additions & 0 deletions libs/shinkai-ui/src/helpers/format-text.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ShinkaiToolHeader } from "@shinkai_network/shinkai-message-ts/api/tools/types";

export const formatText = (text: string) => {
const words = text.split('_');

Expand All @@ -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';
};

0 comments on commit 4081e10

Please sign in to comment.