fix: fix enhance prompt to stop implementing full project instead of enhancing (#1383) #release
* fix: enhance prompt fix * fix: added error capture on api error * fix: replaced error with log for wrong files selected by bolt
This commit is contained in:
@@ -204,7 +204,10 @@ export async function selectContext(props: {
|
||||
}
|
||||
|
||||
if (!filePaths.includes(fullPath)) {
|
||||
throw new Error(`File ${path} is not in the list of files above.`);
|
||||
logger.error(`File ${path} is not in the list of files above.`);
|
||||
return;
|
||||
|
||||
// throw new Error(`File ${path} is not in the list of files above.`);
|
||||
}
|
||||
|
||||
if (currrentFiles.includes(path)) {
|
||||
@@ -218,6 +221,13 @@ export async function selectContext(props: {
|
||||
onFinish(resp);
|
||||
}
|
||||
|
||||
const totalFiles = Object.keys(filteredFiles).length;
|
||||
logger.info(`Total files: ${totalFiles}`);
|
||||
|
||||
if (totalFiles == 0) {
|
||||
throw new Error(`Bolt failed to select files`);
|
||||
}
|
||||
|
||||
return filteredFiles;
|
||||
|
||||
// generateText({
|
||||
|
||||
@@ -319,21 +319,23 @@ export class ActionRunner {
|
||||
const webcontainer = await this.#webcontainer;
|
||||
const historyPath = this.#getHistoryPath(filePath);
|
||||
const content = await webcontainer.fs.readFile(historyPath, 'utf-8');
|
||||
|
||||
return JSON.parse(content);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get file history:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async saveFileHistory(filePath: string, history: FileHistory) {
|
||||
const webcontainer = await this.#webcontainer;
|
||||
// const webcontainer = await this.#webcontainer;
|
||||
const historyPath = this.#getHistoryPath(filePath);
|
||||
|
||||
await this.#runFileAction({
|
||||
type: 'file',
|
||||
filePath: historyPath,
|
||||
content: JSON.stringify(history),
|
||||
changeSource: 'auto-save'
|
||||
changeSource: 'auto-save',
|
||||
} as any);
|
||||
}
|
||||
|
||||
@@ -375,4 +377,4 @@ export class ActionRunner {
|
||||
output,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user