diff --git a/apps/shinkai-visor/src/components/add-agent/add-agent.tsx b/apps/shinkai-visor/src/components/add-agent/add-agent.tsx index 2a0fadd51..011978386 100644 --- a/apps/shinkai-visor/src/components/add-agent/add-agent.tsx +++ b/apps/shinkai-visor/src/components/add-agent/add-agent.tsx @@ -100,7 +100,10 @@ export const AddAgent = () => { }); }; return ( -
+
+

+ +

{ const auth = useAuth((state) => state.auth); const { agents } = useAgents({ - sender: auth?.shinkai_identity ?? "", + 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 ?? "", + 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 ?? '', }); - return ( -
- + return !agents?.length ? ( +
+ +
+ ) : ( +
+

+ +

+ {agents?.map((agent) => ( -

- {agent.id} -

- +
))}
diff --git a/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx b/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx index 19149d9a8..3305a0ec2 100644 --- a/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx +++ b/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx @@ -1,16 +1,24 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { useCreateChat } from "@shinkai_network/shinkai-node-state/lib/mutations/createChat/useCreateChat"; +import { useCreateChat } from '@shinkai_network/shinkai-node-state/lib/mutations/createChat/useCreateChat'; import { Loader2 } from 'lucide-react'; import { useEffect } from 'react'; import { useForm } from 'react-hook-form'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage, useIntl } from 'react-intl'; import { useHistory } from 'react-router-dom'; import { z } from 'zod'; import { useAuth } from '../../store/auth/auth'; import { Button } from '../ui/button'; -import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '../ui/form'; import { Input } from '../ui/input'; +import { Textarea } from '../ui/textarea'; const formSchema = z.object({ receiverIdentity: z.string().nonempty(), @@ -22,7 +30,7 @@ type FormSchemaType = z.infer; export const CreateInbox = () => { const history = useHistory(); const auth = useAuth((state) => state.auth); - + const intl = useIntl(); const form = useForm({ resolver: zodResolver(formSchema), defaultValues: { @@ -32,19 +40,17 @@ export const CreateInbox = () => { }); const { isLoading, mutateAsync: createChat } = useCreateChat({ onSuccess: (data) => { - history.replace( - `/inboxes/${encodeURIComponent(data.inboxId)}` - ); + history.replace(`/inboxes/${encodeURIComponent(data.inboxId)}`); }, }); const submit = (values: FormSchemaType) => { if (!auth) return; - const [receiver, ...rest] = values.receiverIdentity.split("/"); + const [receiver, ...rest] = values.receiverIdentity.split('/'); createChat({ sender: auth.shinkai_identity, senderSubidentity: `${auth.profile}/device/${auth.registration_name}`, receiver, - receiverSubidentity: rest.join("/"), + receiverSubidentity: rest.join('/'), message: values.message, my_device_encryption_sk: auth.my_device_encryption_sk, my_device_identity_sk: auth.my_device_identity_sk, @@ -61,53 +67,65 @@ export const CreateInbox = () => { }, [auth, form]); return ( - - -
- ( - - - - - - - - - - )} - /> - - ( - - - - - - - - - - )} - /> -
- - - +
+ ( + + + + + + + + + + )} + /> + + ( + + + + + +