Skip to content

Commit 5153dac

Browse files
committed
✨ feat: add extensionContext
1 parent c44210a commit 5153dac

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "lowcode",
44
"description": "lowcode tool, support ChatGPT and other LLM",
55
"author": "wjkang <[email protected]>",
6-
"version": "1.7.8",
6+
"version": "1.7.9",
77
"icon": "asset/icon.png",
88
"publisher": "wjkang",
99
"repository": "https://github.com/lowcoding/lowcode-vscode",

src/utils/llm.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { createChatCompletion as openaiCreateChatCompletion } from './openai';
44
import { emitter } from './emitter';
55
import { getSyncFolder } from './config';
66
import { showChatGPTView } from '../webview';
7+
import { getEnv } from './vscodeEnv';
78

89
const LLMScript: {
910
createChatCompletion?: (options: {
1011
messages: { role: 'system' | 'user' | 'assistant'; content: string }[];
1112
handleChunk?: (data: { text?: string }) => void;
13+
lowcodeContext: object;
1214
}) => Promise<string>;
1315
} = {};
1416

@@ -38,6 +40,9 @@ export const createChatCompletion = async (options: {
3840
emitter.emit('chatGPTChunck', data);
3941
}
4042
},
43+
lowcodeContext: {
44+
env: getEnv(),
45+
},
4146
});
4247
emitter.emit('chatGPTComplete', res);
4348
return res;

src/utils/vscodeEnv.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as path from 'path';
22
import { workspace } from 'vscode';
33
import { getSyncFolder } from './config';
4+
import { getExtensionContext } from '../context';
45

56
export const rootPath = path.join(workspace.rootPath || '');
67

@@ -39,6 +40,7 @@ export const getEnv = () => ({
3940
blockMaterialsPath,
4041
snippetMaterialsPath,
4142
privateMaterialsPath: getSyncFolder(),
43+
extensionContext: getExtensionContext(),
4244
});
4345

4446
export const checkRootPath = () => {

0 commit comments

Comments
 (0)