add default instructions
This commit is contained in:
parent
2b7752608e
commit
9580250bb0
@ -1 +0,0 @@
|
|||||||
You are a software developer assistant.
|
|
@ -44,15 +44,22 @@ async function writeDiffFile(diff_file: string) {
|
|||||||
|
|
||||||
export const commitMessageCommand: Command = {
|
export const commitMessageCommand: Command = {
|
||||||
name: 'commitMessageCommand',
|
name: 'commitMessageCommand',
|
||||||
pattern: 'git: commit message',
|
pattern: 'commit_meesage',
|
||||||
description: 'commit message for changes',
|
description: 'commit message for changes',
|
||||||
handler: async (userInput: string) => {
|
handler: async (userInput: string) => {
|
||||||
const tempDir = createTempSubdirectory('devchat/context');
|
const tempDir = createTempSubdirectory('devchat/context');
|
||||||
|
|
||||||
// 创建临时目录
|
// // 创建临时目录
|
||||||
const diff_file = path.join(tempDir, 'diff_output.txt');
|
// const diff_file = path.join(tempDir, 'diff_output.txt');
|
||||||
await writeDiffFile(diff_file);
|
// await writeDiffFile(diff_file);
|
||||||
|
|
||||||
return `[context|${diff_file}] Write a commit message`;
|
// return `[context|${diff_file}] Write a commit message`;
|
||||||
|
|
||||||
|
const workspaceDir = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
|
||||||
|
if (workspaceDir) {
|
||||||
|
const commitmessageInstruction = path.join(workspaceDir, '.chat', 'instructions', 'commit_message', 'instCommitMessage.txt');
|
||||||
|
return `[instruction|${commitmessageInstruction}] Write a commit message`;
|
||||||
|
}
|
||||||
|
return 'Write a commit message';
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -87,7 +87,7 @@ function getInstructionFiles(): string[] {
|
|||||||
const instructionFiles: string[] = [];
|
const instructionFiles: string[] = [];
|
||||||
const workspaceDir = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
|
const workspaceDir = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
|
||||||
if (workspaceDir) {
|
if (workspaceDir) {
|
||||||
const chatInstructionsPath = path.join(workspaceDir, '.chat', 'instructions');
|
const chatInstructionsPath = path.join(workspaceDir, '.chat', 'instructions', 'default');
|
||||||
try {
|
try {
|
||||||
// 读取 chatInstructionsPath 目录下的所有文件和目录
|
// 读取 chatInstructionsPath 目录下的所有文件和目录
|
||||||
const files = fs.readdirSync(chatInstructionsPath);
|
const files = fs.readdirSync(chatInstructionsPath);
|
||||||
@ -126,6 +126,9 @@ async function handleMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
chatOptions.header = getInstructionFiles();
|
chatOptions.header = getInstructionFiles();
|
||||||
|
if (parsedMessage.instruction.length > 0) {
|
||||||
|
chatOptions.header = parsedMessage.instruction;
|
||||||
|
}
|
||||||
|
|
||||||
if (parsedMessage.reference.length > 0) {
|
if (parsedMessage.reference.length > 0) {
|
||||||
chatOptions.reference = parsedMessage.reference;
|
chatOptions.reference = parsedMessage.reference;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user