From 3080ceb28f4903b97429da80ff05f4bfde0efaba Mon Sep 17 00:00:00 2001 From: Anirban Kar Date: Wed, 29 Jan 2025 19:01:00 +0530 Subject: [PATCH] fix: issue with alternate message when importing from folder and git --- app/components/git/GitUrlImport.client.tsx | 5 ++++ app/utils/folderImport.ts | 7 +++++- app/utils/projectCommands.ts | 27 ++++++++++++++++------ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/app/components/git/GitUrlImport.client.tsx b/app/components/git/GitUrlImport.client.tsx index 908537010..6053acdc3 100644 --- a/app/components/git/GitUrlImport.client.tsx +++ b/app/components/git/GitUrlImport.client.tsx @@ -91,6 +91,11 @@ ${escapeBoltTags(file.content)} const messages = [filesMessage]; if (commandsMessage) { + messages.push({ + role: 'user', + id: generateId(), + content: 'Setup the codebase and Start the application', + }); messages.push(commandsMessage); } diff --git a/app/utils/folderImport.ts b/app/utils/folderImport.ts index 98bbe316c..11449cf32 100644 --- a/app/utils/folderImport.ts +++ b/app/utils/folderImport.ts @@ -38,7 +38,7 @@ export const createChatFromFolder = async ( role: 'assistant', content: `I've imported the contents of the "${folderName}" folder.${binaryFilesMessage} - + ${fileArtifacts .map( (file) => ` @@ -61,6 +61,11 @@ ${escapeBoltTags(file.content)} const messages = [userMessage, filesMessage]; if (commandsMessage) { + messages.push({ + role: 'user', + id: generateId(), + content: 'Setup the codebase and Start the application', + }); messages.push(commandsMessage); } diff --git a/app/utils/projectCommands.ts b/app/utils/projectCommands.ts index e734dffb9..34abc0a0d 100644 --- a/app/utils/projectCommands.ts +++ b/app/utils/projectCommands.ts @@ -3,7 +3,8 @@ import { generateId } from './fileUtils'; export interface ProjectCommands { type: string; - setupCommand: string; + setupCommand?: string; + startCommand?: string; followupMessage: string; } @@ -33,7 +34,8 @@ export async function detectProjectCommands(files: FileContent[]): Promise${commands.setupCommand}`; + } + + if (commands.startCommand) { + commandString += ` +${commands.startCommand} +`; + } + return { role: 'assistant', content: ` - -${commands.setupCommand} - +${commandString} ${commands.followupMessage ? `\n\n${commands.followupMessage}` : ''}`, id: generateId(), createdAt: new Date(),