Skip to content

Commit

Permalink
Merge pull request #366 from bmgalego/fix-getRecentMessageInteractions
Browse files Browse the repository at this point in the history
fix: bug in getRecentMessageInteractions not awating for promisses before formating
  • Loading branch information
ponderingdemocritus authored Nov 17, 2024
2 parents c5992d3 + 30a6ba5 commit 04de0f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,10 @@ Text: ${attachment.text}
recentInteractionsData: Memory[]
): Promise<string> => {
// Format the recent messages
const formattedInteractions = await recentInteractionsData
.map(async (message) => {
const formattedInteractions = await Promise.all(
recentInteractionsData.map(async (message) => {
const isSelf = message.userId === this.agentId;
let sender;
let sender: string;
if (isSelf) {
sender = this.character.name;
} else {
Expand All @@ -853,9 +853,9 @@ Text: ${attachment.text}
}
return `${sender}: ${message.content.text}`;
})
.join("\n");
);

return formattedInteractions;
return formattedInteractions.join("\n");
};

const formattedMessageInteractions =
Expand Down

0 comments on commit 04de0f4

Please sign in to comment.