diff --git a/src/gptContext.js b/src/gptContext.js index e89a76c..ab05ad5 100644 --- a/src/gptContext.js +++ b/src/gptContext.js @@ -39,7 +39,7 @@ async function handleQuestionSubmission(panel, question, selectedUris) { const chatCompletion = await openai.createChatCompletion({ model: "gpt-3.5-turbo-16k", messages: [ - { role: "system", content: "Answer the coding questions, only provide the code and documentation, explaining the solution after providing the code." }, + { role: "system", content: "Answer the coding questions, only provide the code and documentation, explaining the solution after providing the code. Put codeblocks inside ``` code ``` with file names above each snippet." }, { role: "user", content: question + "\n" + fileContents}, ], }); diff --git a/src/webviewPanel.js b/src/webviewPanel.js index c20db73..2764908 100644 --- a/src/webviewPanel.js +++ b/src/webviewPanel.js @@ -304,13 +304,19 @@ function getWebviewContent(apiResponse = '', question = '') {
-

${question ? '> ' + question : null}

+

${ + question = question.replace(//g, '>'), + question ? '> ' + question : null + }

${ apiResponse ? `

-

${apiResponse.replace(/```([^```]+)```/g, '
$1
')}
+
${
+                                apiResponse = apiResponse.replace(//g, '>'),
+                                apiResponse.replace(/```([^```]+)```/g, '
$1
') + }

` : null