From aab1bb42e3112b1dbb7b996e0f1ae6ec6bac1dd8 Mon Sep 17 00:00:00 2001 From: Nico Arqueros <1622112+nicarq@users.noreply.github.com> Date: Fri, 12 Jan 2024 21:16:55 -0600 Subject: [PATCH] fix --- apps/shinkai-visor/src/components/inbox/inbox.tsx | 9 +++++---- libs/shinkai-message-ts/src/api/methods.ts | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/shinkai-visor/src/components/inbox/inbox.tsx b/apps/shinkai-visor/src/components/inbox/inbox.tsx index 4c92a624f..d2f9f2036 100644 --- a/apps/shinkai-visor/src/components/inbox/inbox.tsx +++ b/apps/shinkai-visor/src/components/inbox/inbox.tsx @@ -1,6 +1,6 @@ import { extractJobIdFromInbox, - extractReceiverShinkaiName, + getOtherPersonIdentity, isJobInbox as checkIsJobInbox, } from '@shinkai_network/shinkai-message-ts/utils'; import { useSendMessageToJob } from '@shinkai_network/shinkai-node-state/lib/mutations/sendMessageToJob/useSendMessageToJob'; @@ -102,11 +102,12 @@ export const Inbox = () => { profile_identity_sk: auth.profile_identity_sk, }); } else { - const sender = `${auth.shinkai_identity}/${auth.profile}/device/${auth.registration_name}`; - const receiver = extractReceiverShinkaiName(decodedInboxId, sender); + const sender = `${auth.shinkai_identity}/${auth.profile}`; + const receiver_fullname = getOtherPersonIdentity(decodedInboxId, sender); + const receiver = receiver_fullname.split('/')[0]; sendMessageToInbox({ sender: auth.shinkai_identity, - sender_subidentity: `${auth.profile}/device/${auth.registration_name}`, + sender_subidentity: `${auth.profile}`, receiver, message: value, inboxId: decodedInboxId, diff --git a/libs/shinkai-message-ts/src/api/methods.ts b/libs/shinkai-message-ts/src/api/methods.ts index 5119e1fc8..73c5eeb47 100644 --- a/libs/shinkai-message-ts/src/api/methods.ts +++ b/libs/shinkai-message-ts/src/api/methods.ts @@ -120,13 +120,19 @@ export const sendTextMessageWithInbox = async ( setupDetailsState: CredentialsPayload, ): Promise<{ inboxId: string; message: ShinkaiMessage }> => { try { + // Note(Nico): we are forcing to send messages from profiles by removing device related stuff + const senderShinkaiName = new ShinkaiNameWrapper( + sender + '/' + sender_subidentity, + ); + const senderProfile = senderShinkaiName.get_profile_name; + const messageStr = ShinkaiMessageBuilderWrapper.send_text_message_with_inbox( setupDetailsState.profile_encryption_sk, setupDetailsState.profile_identity_sk, setupDetailsState.node_encryption_pk, sender, - sender_subidentity, + senderProfile, receiver, '', inbox_name,