Added AskCode functionality to DevChat
- Added new settings for Python virtual environment and supported file types in package.json. - Added new commands for starting and stopping AskCode Index in package.json. - Registered new 'ask-code' command in CommandManager. - Registered AskCode Index start and stop commands in extension.ts. - Added 'askCode' handler in loadHandlers.ts and messageHandler.ts. - Updated messageHandler to check for '/ask-code' in message text and call 'askCode' command.
This commit is contained in:
parent
59d2c057c5
commit
fd011ee265
20
package.json
20
package.json
@ -155,6 +155,16 @@
|
|||||||
"default": false,
|
"default": false,
|
||||||
"description": "Enable/Disable function calling for GPT.",
|
"description": "Enable/Disable function calling for GPT.",
|
||||||
"when": "DevChat.llmModel == 'OpenAI'"
|
"when": "DevChat.llmModel == 'OpenAI'"
|
||||||
|
},
|
||||||
|
"DevChat.PythonVirtualEnv": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "Path to the Python virtual environment for AskCode."
|
||||||
|
},
|
||||||
|
"DevChat.askcode.supportedFileTypes": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ".+\\.js$, .+\\.ts$, .+\\.jsx$, .+\\.tsx$, .+\\.java$, .+\\.py$, .+\\.go$, .+\\.rb$, .+\\.php$, .+\\.cpp$, .+\\.c$, .+\\.cs$, .+\\.swift$, .+\\.rs$, .+\\.sh$, .+\\.bash$, .+\\.zsh$, .+\\.m$, .+\\.mm$, .+\\.h$, .+\\.hpp$, .+\\.hh$, .+\\.html$, .+\\.htm$, .+\\.xhtml$, .+\\.xml$, .+\\.css$, .+\\.scss$, .+\\.sass$, .+\\.less$, .+\\.json$, .+\\.yaml$, .+\\.yml$, .+\\.toml$, .+\\.ini$, .+\\.md$, .+\\.markdown$, .+\\.txt$, .+\\.csv$, .+\\.sql$, .+\\.sqlite$, .+\\.db$, .+\\.hql$, .+\\.psql$, .+\\.pgsql$, .+\\.plpgsql$",
|
||||||
|
"description": "Comma-separated list of regular expressions for supported file types for analysis."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -257,6 +267,16 @@
|
|||||||
{
|
{
|
||||||
"command": "devchat.askForFile_chinese",
|
"command": "devchat.askForFile_chinese",
|
||||||
"title": "添加到DevChat"
|
"title": "添加到DevChat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "DevChat.AskCodeIndexStart",
|
||||||
|
"title": "Start AskCode Index",
|
||||||
|
"category": "DevChat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "DevChat.AskCodeIndexStop",
|
||||||
|
"title": "Stop AskCode Index",
|
||||||
|
"category": "DevChat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"menus": {
|
"menus": {
|
||||||
|
@ -17,6 +17,15 @@ class CommandManager {
|
|||||||
public static getInstance(): CommandManager {
|
public static getInstance(): CommandManager {
|
||||||
if (!CommandManager.instance) {
|
if (!CommandManager.instance) {
|
||||||
CommandManager.instance = new CommandManager();
|
CommandManager.instance = new CommandManager();
|
||||||
|
CommandManager.instance.registerCommand({
|
||||||
|
name: 'ask-code',
|
||||||
|
pattern: 'ask-code',
|
||||||
|
description: 'ask code',
|
||||||
|
args: 0,
|
||||||
|
handler: async (commandName: string, userInput: string) => {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommandManager.instance;
|
return CommandManager.instance;
|
||||||
|
@ -15,6 +15,8 @@ import {
|
|||||||
regApplyDiffResultCommand,
|
regApplyDiffResultCommand,
|
||||||
registerStatusBarItemClickCommand,
|
registerStatusBarItemClickCommand,
|
||||||
regPythonPathCommand,
|
regPythonPathCommand,
|
||||||
|
registerAskCodeIndexStartCommand,
|
||||||
|
registerAskCodeIndexStopCommand,
|
||||||
} from './contributes/commands';
|
} from './contributes/commands';
|
||||||
import { regLanguageContext } from './contributes/context';
|
import { regLanguageContext } from './contributes/context';
|
||||||
import { regDevChatView, regTopicView } from './contributes/views';
|
import { regDevChatView, regTopicView } from './contributes/views';
|
||||||
@ -56,5 +58,7 @@ function activate(context: vscode.ExtensionContext) {
|
|||||||
regApplyDiffResultCommand(context);
|
regApplyDiffResultCommand(context);
|
||||||
|
|
||||||
regPythonPathCommand(context);
|
regPythonPathCommand(context);
|
||||||
|
registerAskCodeIndexStartCommand(context);
|
||||||
|
registerAskCodeIndexStopCommand(context);
|
||||||
}
|
}
|
||||||
exports.activate = activate;
|
exports.activate = activate;
|
||||||
|
@ -6,7 +6,7 @@ import { doCommit } from './doCommit';
|
|||||||
import { historyMessages } from './historyMessages';
|
import { historyMessages } from './historyMessages';
|
||||||
import { regCommandList } from './regCommandList';
|
import { regCommandList } from './regCommandList';
|
||||||
import { regContextList } from './regContextList';
|
import { regContextList } from './regContextList';
|
||||||
import { sendMessage, stopDevChat, regeneration, deleteChatMessage } from './sendMessage';
|
import { sendMessage, stopDevChat, regeneration, deleteChatMessage, askCode } from './sendMessage';
|
||||||
import { blockApply } from './showDiff';
|
import { blockApply } from './showDiff';
|
||||||
import { showDiff } from './showDiff';
|
import { showDiff } from './showDiff';
|
||||||
import { addConext } from './addContext';
|
import { addConext } from './addContext';
|
||||||
@ -76,3 +76,5 @@ messageHandler.registerHandler('applyAction', applyAction);
|
|||||||
// Delete chat message
|
// Delete chat message
|
||||||
// Response: { command: 'deletedChatMessage', result: <message id> }
|
// Response: { command: 'deletedChatMessage', result: <message id> }
|
||||||
messageHandler.registerHandler('deleteChatMessage', deleteChatMessage);
|
messageHandler.registerHandler('deleteChatMessage', deleteChatMessage);
|
||||||
|
|
||||||
|
messageHandler.registerHandler('askCode', askCode);
|
||||||
|
@ -52,6 +52,11 @@ export class MessageHandler {
|
|||||||
if (message.text.indexOf('/autox') !== -1) {
|
if (message.text.indexOf('/autox') !== -1) {
|
||||||
autox = true;
|
autox = true;
|
||||||
}
|
}
|
||||||
|
// if "/ask-code" in message.text, then call devchat-ask to get result
|
||||||
|
if (message.text.indexOf('/ask-code') !== -1) {
|
||||||
|
message.command = 'askCode';
|
||||||
|
message.text = message.text.replace('/ask-code', '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handler = this.handlers[message.command];
|
const handler = this.handlers[message.command];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user