From 434c121d445247d2f72e10a017f07a0c23226296 Mon Sep 17 00:00:00 2001 From: jonmatthis Date: Wed, 24 Jan 2024 20:43:11 -0500 Subject: [PATCH] fix dumb bug --- .../services/threads/discord-message.service.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/interfaces/discord/services/threads/discord-message.service.ts b/src/interfaces/discord/services/threads/discord-message.service.ts index bd8b8f2..3417886 100644 --- a/src/interfaces/discord/services/threads/discord-message.service.ts +++ b/src/interfaces/discord/services/threads/discord-message.service.ts @@ -139,8 +139,8 @@ export class DiscordMessageService { attachmentText += attachmentResponse.text; if (attachmentResponse.type === 'transcript') { const maxMessageLength = 1800; // Reduced to 1800 to account for "message X of N" text - const fullAttachmenText = attachmentResponse.text; - const attachmentTextLength = fullAttachmenText.length; + const fullAttachmentText = attachmentResponse.text; + const attachmentTextLength = fullAttachmentText.length; if (attachmentTextLength > maxMessageLength) { const numberOfMessages = Math.ceil( @@ -150,7 +150,7 @@ export class DiscordMessageService { for (let i = 0; i < numberOfMessages; i++) { const start = i * maxMessageLength; const end = start + maxMessageLength; - const chunk = fullAttachmenText.slice(start, end); + const chunk = fullAttachmentText.slice(start, end); const chunkMsg = `> Message ${ i + 1 } of ${numberOfMessages}\n\n${chunk}`; @@ -164,13 +164,13 @@ export class DiscordMessageService { ); } } else { - await discordMessage.reply(fullAttachmenText); + await discordMessage.reply(fullAttachmentText); } } attachmentText += 'END TEXT FROM ATTACHMENTS'; } - return { humanInputText, attachmentText }; } + return { humanInputText, attachmentText }; } private async _sendFullResponseAsAttachment( @@ -178,7 +178,6 @@ export class DiscordMessageService { discordMessage: Message, replyMessage: Message, ) { - // add full chunk to the message as a `.md` attachement const attachment = new AttachmentBuilder(Buffer.from(fullAiResponse), { name: `full_response_to_discordMessageId_${discordMessage.id}.md`, description: