2023-05-08 12:09:52 +08:00
|
|
|
import { messageHandler } from './messageHandler';
|
|
|
|
import { codeApply } from './codeApply';
|
|
|
|
import { codeFileApply } from './codeFileApply';
|
|
|
|
import { convertCommand } from './convertCommand';
|
|
|
|
import { doCommit } from './doCommit';
|
|
|
|
import { historyMessages } from './historyMessages';
|
|
|
|
import { regCommandList } from './regCommandList';
|
|
|
|
import { regContextList } from './regContextList';
|
2023-05-23 11:16:48 +08:00
|
|
|
import { sendMessage, stopDevChat, regeneration } from './sendMessage';
|
2023-05-08 12:09:52 +08:00
|
|
|
import { blockApply } from './showDiff';
|
|
|
|
import { showDiff } from './showDiff';
|
|
|
|
import { addConext } from './addContext';
|
2023-05-08 12:48:59 +08:00
|
|
|
import { addRefCommandContext } from './addRefCommandContext';
|
|
|
|
import { contextDetail } from './contextDetail';
|
2023-05-10 17:56:56 +08:00
|
|
|
import { listAllMessages } from './listMessages';
|
2023-06-02 09:58:44 +08:00
|
|
|
import { regActionList } from './regActionList';
|
|
|
|
import { applyAction } from './applyAction';
|
2023-05-08 12:09:52 +08:00
|
|
|
|
2023-05-09 17:17:31 +08:00
|
|
|
|
2023-05-28 08:18:14 +08:00
|
|
|
// According to the context menu selected by the user, add the corresponding context file
|
|
|
|
// Response: { command: 'appendContext', context: <context file> }
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('addContext', addConext);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Apply the code block replied by AI to the currently active view
|
|
|
|
// Response: none
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('code_apply', codeApply);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Apply the code block replied by AI to the currently active view, replacing the current file content
|
|
|
|
// Response: none
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('code_file_apply', codeFileApply);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Convert the command input into a natural language description sent to AI
|
|
|
|
// Response: { command: 'convertCommand', result: <natural language description> }
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('convertCommand', convertCommand);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Perform commit operation
|
|
|
|
// Response: none
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('doCommit', doCommit);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Get the history messages, called when the user view is displayed
|
|
|
|
// Response: { command: 'historyMessages', result: <history messages> }
|
|
|
|
// <history messages> is a list, the specific attribute information is determined when the interface is added
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('historyMessages', historyMessages);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Register the command list
|
|
|
|
// Response: { command: 'regCommandList', result: <command list> }
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('regCommandList', regCommandList);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Register the context list
|
|
|
|
// Response: { command: 'regContextList', result: <context list> }
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('regContextList', regContextList);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Send a message, send the message entered by the user to AI
|
|
|
|
// Response:
|
|
|
|
// { command: 'receiveMessagePartial', text: <response message text>, user: <user>, date: <date> }
|
|
|
|
// { command: 'receiveMessagePartial', text: <response message text>, user: <user>, date: <date> }
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('sendMessage', sendMessage);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Stop devchat, used to stop devchat by the user
|
|
|
|
// Response: none
|
2023-05-09 14:08:18 +08:00
|
|
|
messageHandler.registerHandler('stopDevChat', stopDevChat);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Show diff
|
|
|
|
// Response: none
|
2023-05-08 12:09:52 +08:00
|
|
|
messageHandler.registerHandler('block_apply', blockApply);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Show diff, for historical reasons, the same as above
|
2023-05-08 12:48:59 +08:00
|
|
|
messageHandler.registerHandler('show_diff', showDiff);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Process the ref command entered by the user
|
|
|
|
// Response: { command: 'appendContext', context: <context file> }
|
2023-05-08 12:48:59 +08:00
|
|
|
messageHandler.registerHandler('addRefCommandContext', addRefCommandContext);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Get context details
|
|
|
|
// Response: { command: 'contextDetailResponse', 'file':<context file>, result: <context file content> }
|
|
|
|
// <context file content> is a JSON string
|
2023-05-09 17:17:31 +08:00
|
|
|
messageHandler.registerHandler('contextDetail', contextDetail);
|
2023-05-10 17:56:56 +08:00
|
|
|
// Debug handler
|
|
|
|
messageHandler.registerHandler('listAllMessages', listAllMessages);
|
2023-05-28 08:18:14 +08:00
|
|
|
// Regeneration
|
|
|
|
// The response is the same as sendMessage
|
2023-05-23 11:16:48 +08:00
|
|
|
messageHandler.registerHandler('regeneration', regeneration);
|
2023-06-02 09:58:44 +08:00
|
|
|
// Register the action list
|
|
|
|
// Response: { command: 'regActionList', result: <action list> }
|
|
|
|
messageHandler.registerHandler('regActionList', regActionList);
|
|
|
|
// Apply action for code block
|
|
|
|
// Response: none
|
|
|
|
messageHandler.registerHandler('applyAction', applyAction);
|