filter ``\ncommitmsg to ``commitmsg

This commit is contained in:
bobo.yang 2023-05-11 10:26:13 +08:00
parent 8ab29050e6
commit 93714a2255

View File

@ -108,7 +108,8 @@ export async function sendMessage(message: any, panel: vscode.WebviewPanel): Pro
}
const onData = (partialResponse: ChatResponse) => {
MessageHandler.sendMessage(panel, { command: 'receiveMessagePartial', text: partialResponse.response, user: partialResponse.user, date: partialResponse.date }, false);
const responseText = partialResponse.response.replace(/```\ncommitmsg/g, "```commitmsg");
MessageHandler.sendMessage(panel, { command: 'receiveMessagePartial', text: responseText, user: partialResponse.user, date: partialResponse.date }, false);
};
const chatResponse = await devChat.chat(parsedMessage.text, chatOptions, onData);
@ -117,7 +118,8 @@ export async function sendMessage(message: any, panel: vscode.WebviewPanel): Pro
messageHistory.add(panel, {request: message.text, text: parsedMessage.text, parent_hash, hash: chatResponse['prompt-hash'], user: chatResponse.user, date: chatResponse.date });
}
MessageHandler.sendMessage(panel, { command: 'receiveMessage', text: chatResponse.response, hash: chatResponse['prompt-hash'], user: chatResponse.user, date: chatResponse.date, isError: chatResponse.isError });
const responseText = chatResponse.response.replace(/```\ncommitmsg/g, "```commitmsg");
MessageHandler.sendMessage(panel, { command: 'receiveMessage', text: responseText, hash: chatResponse['prompt-hash'], user: chatResponse.user, date: chatResponse.date, isError: chatResponse.isError });
return;
}