diff --git a/package.json b/package.json index a9539ed..e904132 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "lowcode", "description": "lowcode tool, support ChatGPT and other LLM", "author": "wjkang ", - "version": "1.8.1", + "version": "1.8.2", "icon": "asset/icon.png", "publisher": "wjkang", "repository": "https://github.com/lowcoding/lowcode-vscode", diff --git a/src/utils/generate.ts b/src/utils/generate.ts index 22aaa2a..4d637d4 100644 --- a/src/utils/generate.ts +++ b/src/utils/generate.ts @@ -19,6 +19,7 @@ import { getOutputChannel } from './outputChannel'; import { getLastActiveTextEditor } from '../context'; import { getSyncFolder } from './config'; import { createChatCompletionForScript } from './llm'; +import { resetMaterialName } from './name'; export const genCodeByBlock = async (data: { material: string; @@ -36,7 +37,7 @@ export const genCodeByBlock = async (data: { data.privateMaterials ? getPrivateBlockMaterialsPath() : blockMaterialsPath, - data.material, + resetMaterialName(data.material), ); const schemaFile = path.join(block, 'config/schema.json'); const schama = fs.readJSONSync(schemaFile); @@ -161,7 +162,7 @@ export const genCodeBySnippet = async (data: { data.privateMaterials ? getPrivateSnippetMaterialsPath() : snippetMaterialsPath, - data.name, + resetMaterialName(data.name), ); const scriptFile = path.join(snippetPath, 'script/index.js'); const hook = { diff --git a/src/utils/name.ts b/src/utils/name.ts new file mode 100644 index 0000000..dea3b4f --- /dev/null +++ b/src/utils/name.ts @@ -0,0 +1,4 @@ +export const resetMaterialName = (name: string) => { + const arrayStr = name.split('] '); + return arrayStr[1] || name; +};