Skip to content

Commit 64814d5

Browse files
authored
Update folderImport.ts
updated function output
1 parent 39398ea commit 64814d5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

app/utils/folderImport.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const createChatFromFolder = async (
55
files: File[],
66
binaryFiles: string[],
77
folderName: string
8-
): Promise<{ userMessage: Message; assistantMessage: Message }> => {
8+
): Promise<Message[]> => {
99
const fileArtifacts = await Promise.all(
1010
files.map(async (file) => {
1111
return new Promise<string>((resolve, reject) => {
@@ -33,17 +33,24 @@ ${content}
3333
? `\n\nSkipped ${binaryFiles.length} binary files:\n${binaryFiles.map((f) => `- ${f}`).join('\n')}`
3434
: '';
3535

36-
const assistantMessage: Message = {
36+
const assistantMessages: Message[] = [{
3737
role: 'assistant',
3838
content: `I've imported the contents of the "${folderName}" folder.${binaryFilesMessage}
3939
4040
<boltArtifact id="imported-files" title="Imported Files">
4141
${fileArtifacts.join('\n\n')}
42+
</boltArtifact>`,
43+
id: generateId(),
44+
createdAt: new Date(),
45+
},{
46+
role: 'assistant',
47+
content: `
48+
<boltArtifact id="imported-files" title="Imported Files">
4249
${setupCommand}
4350
</boltArtifact>${followupMessage}`,
4451
id: generateId(),
4552
createdAt: new Date(),
46-
};
53+
}];
4754

4855
const userMessage: Message = {
4956
role: 'user',
@@ -52,5 +59,5 @@ ${setupCommand}
5259
createdAt: new Date(),
5360
};
5461

55-
return { userMessage, assistantMessage };
62+
return [ userMessage, ...assistantMessages ];
5663
};

0 commit comments

Comments
 (0)