-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpackage.json
More file actions
332 lines (331 loc) · 10 KB
/
package.json
File metadata and controls
332 lines (331 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
{
"name": "navicode",
"displayName": "NaviCode",
"description": "This is a code intelligent completion plugin that helps you enjoy coding.",
"publisher": "weiziyan",
"version": "0.0.1",
"engines": {
"vscode": "^1.97.2"
},
"categories": [
"Other"
],
"activationEvents": [
"onLanguage:javascript",
"onLanguage:typescript",
"onLanguage:python",
"onLanguage:java",
"onLanguage:c",
"onLanguage:cpp",
"onCommand:navicode.configureCustomModels",
"onCommand:navicode.switchModel",
"onCommand:navicode.openChat"
],
"main": "./extension.js",
"contributes": {
"viewsContainers": {
"secondarySideBar": [
{
"id": "navicode",
"title": "NaviCode",
"icon": "media/robot-img.svg"
}
]
},
"views": {
"navicode": [
{
"type": "webview",
"id": "navicodeChatView",
"name": "NaviCode Chat"
}
]
},
"configuration": {
"title": "NaviCode",
"properties": {
"navicode.enableAutoTrigger": {
"type": "boolean",
"default": true,
"description": "启用自动触发代码补全。禁用后,只能通过快捷键(Alt+Ctrl+.)手动触发。"
},
"navicode.customPrompt": {
"type": "string",
"default": "用户提示词为空",
"description": "自定义代码补全提示词。"
},
"navicode.enableRelatedFiles": {
"type": "boolean",
"default": false,
"description": "启用关联文件上下文。开启后,会自动分析导入语句并包含相关文件内容。"
},
"navicode.enablePurity": {
"type": "boolean",
"default": false,
"description": "启用纯净模式。开启后,不会加入除代码外的任何提示词。"
},
"navicode.enableRag": {
"type": "boolean",
"default": false,
"description": "启用Rag查询。开启后,会通过本地构建的Rag仓库来查询相关代码。"
},
"navicode.maxRelatedFileSize": {
"type": "number",
"default": 50000,
"description": "单个关联文件的最大字符数限制。超过此限制的文件内容将被截断。"
},
"navicode.maxTotalRelatedFilesSize": {
"type": "number",
"default": 50000,
"description": "所有关联文件内容的总字符数限制。"
},
"navicode.enableGitDiff": {
"type": "boolean",
"default": false,
"description": "启用当前文件Git变更历史。开启后,会自动包含当前文件的Git Diff信息。"
},
"navicode.maxDiffSize": {
"type": "number",
"default": 20000,
"description": "变更历史的最大字符数限制。"
},
"navicode.enableReadme": {
"type": "boolean",
"default": false,
"description": "启用当前文件README。开启后,会自动包含当前文件的README信息。"
},
"navicode.maxReadmeSize": {
"type": "number",
"default": 20000,
"description": "变更README的最大字符数限制。"
},
"navicode.selectedModel": {
"type": "string",
"default": "deepseek-chat",
"description": "选择当前使用的 AI 模型",
"enum": [
"deepseek-chat",
"gpt-4",
"gpt-3.5",
"doubao"
]
},
"navicode.templates": {
"type": "array",
"default": [
{
"id": "default",
"name": "默认模板",
"template": " /* 用户提示 */\n{{customPrompt}}\n\n{{#if ragContext}}\n/* 相关代码片段(RAG检索): */\n```\n{{ragContext}}\n```\n{{/if}}\n\n{{#if includeReadme}}\n/* README */\n```\n{{readme}}\n```\n{{/if}}\n\n{{#if includeDiff}}\n/* DIFF */\n```diff\n{{fileDiff}}\n```\n{{/if}}\n\n{{#if includeRelatedFiles}}\n/* 关联文件 */\n{{#each relatedFiles}}文件: {{this.path}}\n```\n{{this.content}}\n```\n{{/each}}\n{{/if}}\n\n/* 上下文 */\n文件: {{fileName}}\n语言: {{languageId}}\n前缀代码:\n{{prefix}}"
},
{
"id": "js_class",
"name": "JS 类模板",
"template": "/* JavaScript 类 */\nclass {{className}} {\n constructor() {\n {{customPrompt}}\n }\n}\n"
},
{
"id": "py_module",
"name": "Python 模块模板",
"template": "# -*- coding: utf-8 -*-\n\"\"\"\n模块:{{fileName}}\n\"\"\"\n\n{{customPrompt}}\n\nif __name__ == \"__main__\":\n pass\n"
}
],
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "模板唯一标识"
},
"name": {
"type": "string",
"description": "模板名称,供下拉列表显示"
},
"template": {
"type": "string",
"description": "Prompt 提示词内容"
}
}
},
"description": "可管理的多个 Prompt 模板列表"
},
"navicode.activeTemplate": {
"type": "string",
"default": "default",
"description": "当前激活的模板 ID"
},
"navicode.customModels": {
"type": "array",
"default": [],
"description": "用户自定义模型配置列表",
"items": {
"type": "object",
"properties": {
"modelName": {
"type": "string"
},
"baseURL": {
"type": "string"
},
"apiKey": {
"type": "string"
},
"model": {
"type": "string"
}
},
"required": ["modelName", "baseURL", "apiKey", "model"]
}
}
}
},
"commands": [
{
"command": "navicode.helloWorld",
"title": "Hello World"
},
{
"command": "navicode.openChat",
"title": "打开聊天窗口"
},
{
"command": "navicode.generateSuggestion",
"title": "手动触发自动补全功能"
},
{
"command": "navicode.toggleAutoTrigger",
"title": "NaviCode: 切换自动触发功能"
},
{
"command": "extension.commentToCode",
"title": "智能生成"
},
{
"command": "extension.codeFromTempArea",
"title": "用临时记忆区产生代码"
},
{
"command": "extension.addToTempArea",
"title": "加入临时记忆区"
},
{
"command": "extension.showTempArea",
"title": "显示临时记忆区"
},
{
"command": "navicode.editCustomPrompt",
"title": "NaviCode: 编辑代码补全提示词"
},
{
"command": "navicode.toggleRelatedFiles",
"title": "NaviCode: 切换关联文件分析功能"
},
{
"command": "navicode.toggleGitDiff",
"title": "NaviCode: 切换Git变更历史功能"
},
{
"command": "navicode.toggleReadme",
"title": "NaviCode: 切换README读取功能"
},
{
"command": "navicode.switchModel",
"title": "切换 AI 模型"
},
{
"command": "navicode.configureCustomModels",
"title": "NaviCode: 添加自定义模型"
},
{
"command": "navicode.viewCurrentModelInfo",
"title": "NaviCode: 查看当前模型信息"
},
{
"command": "navicode.deleteCustomModel",
"title": "NaviCode: 删除自定义模型"
},
{
"command": "navicode.editCustomModel",
"title": "NaviCode: 编辑自定义模型"
},
{
"command": "navicode.configureTemplate",
"title": "NaviCode: 用户自定义全局提示词模板"
},
{
"command": "navicode.togglePurity",
"title": "NaviCode: 切换纯净模式"
},
{
"command": "navicode.toggleRag",
"title": "NaviCode: 切换Rag查询"
}
],
"keybindings": [
{
"command": "navicode.generateSuggestion",
"key": "ctrl+alt+.",
"mac": "cmd+alt+.",
"when": "editorTextFocus"
}
],
"menus": {
"editor/context": [
{
"command": "extension.commentToCode",
"when": "editorHasSelection",
"group": "navigation"
},
{
"command": "extension.addToTempArea",
"when": "editorHasSelection"
},
{
"command": "extension.codeFromTempArea",
"when": "editorHasSelection"
},
{
"command": "extension.showTempArea",
"when": "editorHasSelection"
}
],
"commandPalette": [
{
"command": "navicode.configureCustomModels",
"command": "navicode.viewCurrentModelInfo"
}
]
}
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "vscode-test"
},
"devDependencies": {
"@types/mocha": "^10.0.10",
"@types/node": "20.x",
"@types/vscode": "^1.97.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"eslint": "^9.21.0",
"mocha": "^9.2.0"
},
"dependencies": {
"@langchain/community": "^0.0.51",
"@langchain/openai": "^0.0.16",
"@xenova/transformers": "^2.11.0",
"axios": "^0.27.2",
"dotenv": "^16.5.0",
"glob": "^7.2.0",
"handlebars": "^4.7.8",
"hnswlib-node": "^3.0.0",
"openai": "^4.90.0",
"recast": "^0.23.11",
"tree-sitter": "^0.22.4",
"tree-sitter-c": "^0.24.1",
"tree-sitter-cpp": "^0.23.4",
"tree-sitter-java": "^0.23.5",
"tree-sitter-javascript": "^0.23.1",
"tree-sitter-python": "^0.23.6"
}
}