diff --git a/packages/core/src/runtime.ts b/packages/core/src/runtime.ts index 2c4e5940..f221d417 100644 --- a/packages/core/src/runtime.ts +++ b/packages/core/src/runtime.ts @@ -838,10 +838,10 @@ Text: ${attachment.text} recentInteractionsData: Memory[] ): Promise => { // 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 { @@ -853,9 +853,9 @@ Text: ${attachment.text} } return `${sender}: ${message.content.text}`; }) - .join("\n"); + ); - return formattedInteractions; + return formattedInteractions.join("\n"); }; const formattedMessageInteractions =