From 64814d56c5aaf41791c9d835263ba3d599e27dd5 Mon Sep 17 00:00:00 2001 From: Anirban Kar Date: Sun, 8 Dec 2024 04:11:34 +0530 Subject: [PATCH] Update folderImport.ts updated function output --- app/utils/folderImport.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/utils/folderImport.ts b/app/utils/folderImport.ts index 2803286b..57cbe318 100644 --- a/app/utils/folderImport.ts +++ b/app/utils/folderImport.ts @@ -5,7 +5,7 @@ export const createChatFromFolder = async ( files: File[], binaryFiles: string[], folderName: string -): Promise<{ userMessage: Message; assistantMessage: Message }> => { +): Promise => { const fileArtifacts = await Promise.all( files.map(async (file) => { return new Promise((resolve, reject) => { @@ -33,17 +33,24 @@ ${content} ? `\n\nSkipped ${binaryFiles.length} binary files:\n${binaryFiles.map((f) => `- ${f}`).join('\n')}` : ''; - const assistantMessage: Message = { + const assistantMessages: Message[] = [{ role: 'assistant', content: `I've imported the contents of the "${folderName}" folder.${binaryFilesMessage} ${fileArtifacts.join('\n\n')} +`, + id: generateId(), + createdAt: new Date(), + },{ + role: 'assistant', + content: ` + ${setupCommand} ${followupMessage}`, id: generateId(), createdAt: new Date(), - }; + }]; const userMessage: Message = { role: 'user', @@ -52,5 +59,5 @@ ${setupCommand} createdAt: new Date(), }; - return { userMessage, assistantMessage }; + return [ userMessage, ...assistantMessages ]; };