Skip to content

Commit

Permalink
Merge pull request #117 from dcSpark/nico/fix-conversation
Browse files Browse the repository at this point in the history
conversation fix
  • Loading branch information
nicarq authored Jan 15, 2024
2 parents 8226798 + aab1bb4 commit ada57d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 5 additions & 4 deletions apps/shinkai-visor/src/components/inbox/inbox.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion libs/shinkai-message-ts/src/api/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ada57d8

Please sign in to comment.