mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
fix: fix variable shadowing in file action parsing
Rename conflicting variable 'actionType' to 'fileActionType' to avoid shadowing
This commit is contained in:
parent
335f7c6077
commit
c5804a4ab9
@ -57,6 +57,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
|
||||
exports[`StreamingMessageParser > valid artifacts with actions > should correctly parse chunks and strip out bolt artifacts (1) > onActionClose 2`] = `
|
||||
{
|
||||
"action": {
|
||||
"actionType": "create",
|
||||
"content": "some content
|
||||
",
|
||||
"filePath": "index.js",
|
||||
@ -83,6 +84,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
|
||||
exports[`StreamingMessageParser > valid artifacts with actions > should correctly parse chunks and strip out bolt artifacts (1) > onActionOpen 2`] = `
|
||||
{
|
||||
"action": {
|
||||
"actionType": "create",
|
||||
"content": "",
|
||||
"filePath": "index.js",
|
||||
"type": "file",
|
||||
|
@ -357,14 +357,14 @@ export class StreamingMessageParser {
|
||||
}
|
||||
} else if (actionType === 'file') {
|
||||
const filePath = this.#extractAttribute(actionTag, 'filePath') as string;
|
||||
const actionType = this.#extractAttribute(actionTag, 'actionType') as 'create' | 'update';
|
||||
const fileActionType = this.#extractAttribute(actionTag, 'actionType') as 'create' | 'update';
|
||||
|
||||
if (!filePath) {
|
||||
logger.debug('File path not specified');
|
||||
}
|
||||
|
||||
(actionAttributes as FileAction).filePath = filePath;
|
||||
(actionAttributes as FileAction).actionType = actionType || 'create'; // default to 'create' if not specified
|
||||
(actionAttributes as FileAction).actionType = fileActionType || 'create';
|
||||
} else if (!['shell', 'start'].includes(actionType)) {
|
||||
logger.warn(`Unknown action type '${actionType}'`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user