Update folderImport.ts
Browse filesupdated function output
- app/utils/folderImport.ts +11 -4
app/utils/folderImport.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const createChatFromFolder = async (
|
|
| 5 |
files: File[],
|
| 6 |
binaryFiles: string[],
|
| 7 |
folderName: string
|
| 8 |
-
): Promise<
|
| 9 |
const fileArtifacts = await Promise.all(
|
| 10 |
files.map(async (file) => {
|
| 11 |
return new Promise<string>((resolve, reject) => {
|
|
@@ -33,17 +33,24 @@ ${content}
|
|
| 33 |
? `\n\nSkipped ${binaryFiles.length} binary files:\n${binaryFiles.map((f) => `- ${f}`).join('\n')}`
|
| 34 |
: '';
|
| 35 |
|
| 36 |
-
const
|
| 37 |
role: 'assistant',
|
| 38 |
content: `I've imported the contents of the "${folderName}" folder.${binaryFilesMessage}
|
| 39 |
|
| 40 |
<boltArtifact id="imported-files" title="Imported Files">
|
| 41 |
${fileArtifacts.join('\n\n')}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
${setupCommand}
|
| 43 |
</boltArtifact>${followupMessage}`,
|
| 44 |
id: generateId(),
|
| 45 |
createdAt: new Date(),
|
| 46 |
-
};
|
| 47 |
|
| 48 |
const userMessage: Message = {
|
| 49 |
role: 'user',
|
|
@@ -52,5 +59,5 @@ ${setupCommand}
|
|
| 52 |
createdAt: new Date(),
|
| 53 |
};
|
| 54 |
|
| 55 |
-
return
|
| 56 |
};
|
|
|
|
| 5 |
files: File[],
|
| 6 |
binaryFiles: string[],
|
| 7 |
folderName: string
|
| 8 |
+
): Promise<Message[]> => {
|
| 9 |
const fileArtifacts = await Promise.all(
|
| 10 |
files.map(async (file) => {
|
| 11 |
return new Promise<string>((resolve, reject) => {
|
|
|
|
| 33 |
? `\n\nSkipped ${binaryFiles.length} binary files:\n${binaryFiles.map((f) => `- ${f}`).join('\n')}`
|
| 34 |
: '';
|
| 35 |
|
| 36 |
+
const assistantMessages: Message[] = [{
|
| 37 |
role: 'assistant',
|
| 38 |
content: `I've imported the contents of the "${folderName}" folder.${binaryFilesMessage}
|
| 39 |
|
| 40 |
<boltArtifact id="imported-files" title="Imported Files">
|
| 41 |
${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">
|
| 49 |
${setupCommand}
|
| 50 |
</boltArtifact>${followupMessage}`,
|
| 51 |
id: generateId(),
|
| 52 |
createdAt: new Date(),
|
| 53 |
+
}];
|
| 54 |
|
| 55 |
const userMessage: Message = {
|
| 56 |
role: 'user',
|
|
|
|
| 59 |
createdAt: new Date(),
|
| 60 |
};
|
| 61 |
|
| 62 |
+
return [ userMessage, ...assistantMessages ];
|
| 63 |
};
|