diff --git a/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx b/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx
index ac1dd2be1..214d9e5a7 100644
--- a/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx
+++ b/apps/shinkai-desktop/src/pages/chat/chat-conversation.tsx
@@ -13,6 +13,8 @@ import {
import { useSendMessageToJob } from '@shinkai_network/shinkai-node-state/lib/mutations/sendMessageToJob/useSendMessageToJob';
import { useSendMessageToInbox } from '@shinkai_network/shinkai-node-state/lib/mutations/sendMesssageToInbox/useSendMessageToInbox';
import { useSendMessageWithFilesToInbox } from '@shinkai_network/shinkai-node-state/lib/mutations/sendMesssageWithFilesToInbox/useSendMessageWithFilesToInbox';
+import { useUpdateAgentInJob } from '@shinkai_network/shinkai-node-state/lib/mutations/updateAgentInJob/useUpdateAgentInJob';
+import { useAgents } from '@shinkai_network/shinkai-node-state/lib/queries/getAgents/useGetAgents';
import { useGetChatConversationWithPagination } from '@shinkai_network/shinkai-node-state/lib/queries/getChatConversation/useGetChatConversationWithPagination';
import {
Alert,
@@ -21,6 +23,11 @@ import {
Badge,
Button,
ChatInputArea,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuTrigger,
Form,
FormControl,
FormField,
@@ -33,13 +40,9 @@ import {
SheetHeader,
SheetTitle,
SheetTrigger,
- Tooltip,
- TooltipContent,
- TooltipPortal,
- TooltipProvider,
- TooltipTrigger,
} from '@shinkai_network/shinkai-ui';
import {
+ AgentIcon,
DirectoryTypeIcon,
FileTypeIcon,
} from '@shinkai_network/shinkai-ui/assets';
@@ -50,6 +53,7 @@ import { useEffect, useMemo, useRef } from 'react';
import { useDropzone } from 'react-dropzone';
import { useForm } from 'react-hook-form';
import { useParams } from 'react-router-dom';
+import { toast } from 'sonner';
import { useGetCurrentInbox } from '../../hooks/use-current-inbox';
import { useAuth } from '../../store/auth';
@@ -331,6 +335,77 @@ const ChatConversation = () => {
export default ChatConversation;
+function AgentSelection() {
+ const auth = useAuth((state) => state.auth);
+ const currentInbox = useGetCurrentInbox();
+ const { agents } = useAgents({
+ nodeAddress: auth?.node_address ?? '',
+ sender: auth?.shinkai_identity ?? '',
+ senderSubidentity: `${auth?.profile}`,
+ shinkaiIdentity: auth?.shinkai_identity ?? '',
+ my_device_encryption_sk: auth?.profile_encryption_sk ?? '',
+ my_device_identity_sk: auth?.profile_identity_sk ?? '',
+ node_encryption_pk: auth?.node_encryption_pk ?? '',
+ profile_encryption_sk: auth?.profile_encryption_sk ?? '',
+ profile_identity_sk: auth?.profile_identity_sk ?? '',
+ });
+
+ const { mutateAsync: updateAgentInJob } = useUpdateAgentInJob({
+ onError: (error) => {
+ toast.error('Failed to update agent', {
+ description: error.message,
+ });
+ },
+ });
+ return (
+
+
+
+ {/**/}
+ {currentInbox?.agent?.id}
+
+
+
+ {
+ const jobId = extractJobIdFromInbox(currentInbox?.inbox_id ?? '');
+ await updateAgentInJob({
+ nodeAddress: auth?.node_address ?? '',
+ shinkaiIdentity: auth?.shinkai_identity ?? '',
+ profile: auth?.profile ?? '',
+ jobId: jobId,
+ newAgentId: value,
+ my_device_encryption_sk: auth?.profile_encryption_sk ?? '',
+ my_device_identity_sk: auth?.profile_identity_sk ?? '',
+ node_encryption_pk: auth?.node_encryption_pk ?? '',
+ profile_encryption_sk: auth?.profile_encryption_sk ?? '',
+ profile_identity_sk: auth?.profile_identity_sk ?? '',
+ });
+ }}
+ value={currentInbox?.agent?.id ?? ''}
+ >
+ {agents.map((agent) => (
+
+
+
+ {agent.id}
+ {/*{agent.model}*/}
+
+
+ ))}
+
+
+
+ );
+}
+
export const ConversationHeader = () => {
const currentInbox = useGetCurrentInbox();
@@ -342,28 +417,11 @@ export const ConversationHeader = () => {
return (
-
-
+
+
{currentInbox?.custom_name || currentInbox?.inbox_id}
-
-
-
-
- {currentInbox?.agent?.id}
-
-
-
-
- Model:
- {currentInbox?.agent?.model}
-
-
-
-
+
{hasConversationContext && (
diff --git a/apps/shinkai-visor/src/components/edit-inbox-name-dialog/edit-inbox-name-dialog.tsx b/apps/shinkai-visor/src/components/edit-inbox-name-dialog/edit-inbox-name-dialog.tsx
index 70cb3aea9..c2d805620 100644
--- a/apps/shinkai-visor/src/components/edit-inbox-name-dialog/edit-inbox-name-dialog.tsx
+++ b/apps/shinkai-visor/src/components/edit-inbox-name-dialog/edit-inbox-name-dialog.tsx
@@ -1,10 +1,13 @@
import { zodResolver } from '@hookform/resolvers/zod';
import { AgentInbox } from '@shinkai_network/shinkai-message-ts/models';
+import { extractJobIdFromInbox } from '@shinkai_network/shinkai-message-ts/utils';
import {
UpdateInboxNameFormSchema,
updateInboxNameFormSchema,
} from '@shinkai_network/shinkai-node-state/forms/chat/inbox';
+import { useUpdateAgentInJob } from '@shinkai_network/shinkai-node-state/lib/mutations/updateAgentInJob/useUpdateAgentInJob';
import { useUpdateInboxName } from '@shinkai_network/shinkai-node-state/lib/mutations/updateInboxName/useUpdateInboxName';
+import { useAgents } from '@shinkai_network/shinkai-node-state/lib/queries/getAgents/useGetAgents';
import {
Badge,
Button,
@@ -13,16 +16,99 @@ import {
DrawerContent,
DrawerHeader,
DrawerTitle,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuTrigger,
Form,
FormField,
TextField,
} from '@shinkai_network/shinkai-ui';
+import { AgentIcon } from '@shinkai_network/shinkai-ui/assets';
+import { ChevronDown } from 'lucide-react';
import { useEffect } from 'react';
import { useForm } from 'react-hook-form';
import { FormattedMessage } from 'react-intl';
+import { toast } from 'sonner';
+import { useGetCurrentInbox } from '../../hooks/use-current-inbox';
import { useAuth } from '../../store/auth/auth';
+function AgentSelection() {
+ const auth = useAuth((state) => state.auth);
+ const currentInbox = useGetCurrentInbox();
+ const { agents } = useAgents({
+ nodeAddress: auth?.node_address ?? '',
+ sender: auth?.shinkai_identity ?? '',
+ senderSubidentity: `${auth?.profile}`,
+ shinkaiIdentity: auth?.shinkai_identity ?? '',
+ my_device_encryption_sk: auth?.profile_encryption_sk ?? '',
+ my_device_identity_sk: auth?.profile_identity_sk ?? '',
+ node_encryption_pk: auth?.node_encryption_pk ?? '',
+ profile_encryption_sk: auth?.profile_encryption_sk ?? '',
+ profile_identity_sk: auth?.profile_identity_sk ?? '',
+ });
+
+ const { mutateAsync: updateAgentInJob } = useUpdateAgentInJob({
+ onError: (error) => {
+ toast.error('Failed to update agent', {
+ description: error.message,
+ });
+ },
+ });
+ return (
+
+
+
+
+
+
{currentInbox?.agent?.id}
+
+
+
+
+
+ {
+ const jobId = extractJobIdFromInbox(currentInbox?.inbox_id ?? '');
+ await updateAgentInJob({
+ nodeAddress: auth?.node_address ?? '',
+ shinkaiIdentity: auth?.shinkai_identity ?? '',
+ profile: auth?.profile ?? '',
+ jobId: jobId,
+ newAgentId: value,
+ my_device_encryption_sk: auth?.profile_encryption_sk ?? '',
+ my_device_identity_sk: auth?.profile_identity_sk ?? '',
+ node_encryption_pk: auth?.node_encryption_pk ?? '',
+ profile_encryption_sk: auth?.profile_encryption_sk ?? '',
+ profile_identity_sk: auth?.profile_identity_sk ?? '',
+ });
+ }}
+ value={currentInbox?.agent?.id ?? ''}
+ >
+ {agents.map((agent) => (
+
+
+
+ {agent.id}
+ {/*{agent.model}*/}
+
+
+ ))}
+
+
+
+ );
+}
+
export type EditInboxNameDialogProps = {
open: boolean;
onCancel: () => void;
@@ -89,12 +175,7 @@ export const EditInboxNameDialog = ({
Current AI Agent
-
- {currentAgent?.id}
-
- {currentAgent?.model}
-
-
+