mirror of
https://github.com/Iheuzio/gpt-contextfiles.git
synced 2025-07-18 05:50:48 +00:00
fix(display-html): html is now properly displayed
This commit is contained in:
parent
fbf7632a4a
commit
08a84fbfcd
@ -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},
|
||||
],
|
||||
});
|
||||
|
@ -304,13 +304,19 @@ function getWebviewContent(apiResponse = '', question = '') {
|
||||
</div>
|
||||
<div class="content" id="api-response">
|
||||
<div id="question-rep">
|
||||
<p>${question ? '> ' + question : null}</p>
|
||||
<p>${
|
||||
question = question.replace(/</g, '<').replace(/>/g, '>'),
|
||||
question ? '> ' + question : null
|
||||
}</p>
|
||||
</div>
|
||||
${
|
||||
apiResponse ? `
|
||||
<div id="rendered">
|
||||
<p id="responses">
|
||||
<pre id="response">${apiResponse.replace(/```([^```]+)```/g, '<div id="code-block"><code>$1</code><button onclick="copyCode(event)" id="copy-button">copy</button></div>')}</pre>
|
||||
<pre id="response">${
|
||||
apiResponse = apiResponse.replace(/</g, '<').replace(/>/g, '>'),
|
||||
apiResponse.replace(/```([^```]+)```/g, '<div id="code-block"><code>$1</code><button onclick="copyCode(event)" id="copy-button">copy</button></div>')
|
||||
}</pre>
|
||||
</p>
|
||||
</div>
|
||||
` : null
|
||||
|
Loading…
Reference in New Issue
Block a user