-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove playground tools + add tool results + misc fixes (#566)
* feat: remove tools * wip tool selection * feat: remove tool * fix: add toolkey when sending message * feat: add tool description + inputs * feat: add tool results info
- Loading branch information
1 parent
36e88cb
commit 3c9e04f
Showing
18 changed files
with
259 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
apps/shinkai-desktop/src/components/playground-tool/components/remove-tool-button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useRemoveTool } from '@shinkai_network/shinkai-node-state/v2/mutations/removeTool/useRemoveTool'; | ||
import { Button } from '@shinkai_network/shinkai-ui'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { toast } from 'sonner'; | ||
|
||
import { useAuth } from '../../../store/auth'; | ||
|
||
export default function RemoveToolButton({ toolKey }: { toolKey: string }) { | ||
const auth = useAuth((state) => state.auth); | ||
const navigate = useNavigate(); | ||
|
||
const { mutateAsync: removeTool, isPending: isRemoveToolPending } = | ||
useRemoveTool({ | ||
onSuccess: () => { | ||
toast.success('Tool has been removed successfully'); | ||
navigate('/tools'); | ||
}, | ||
onError: (error) => { | ||
toast.error('Failed to remove tool', { | ||
description: error.response?.data?.message ?? error.message, | ||
}); | ||
}, | ||
}); | ||
|
||
return ( | ||
<Button | ||
className="border-red-800 bg-red-700/50 text-red-50 hover:bg-red-900" | ||
disabled={isRemoveToolPending} | ||
isLoading={isRemoveToolPending} | ||
onClick={async () => { | ||
await removeTool({ | ||
toolKey: toolKey ?? '', | ||
nodeAddress: auth?.node_address ?? '', | ||
token: auth?.api_v2_key ?? '', | ||
}); | ||
}} | ||
size="sm" | ||
variant={'outline'} | ||
> | ||
Delete Tool | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.