mirror of
https://github.com/Iheuzio/gpt-contextfiles.git
synced 2025-07-18 14:00: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({
|
const chatCompletion = await openai.createChatCompletion({
|
||||||
model: "gpt-3.5-turbo-16k",
|
model: "gpt-3.5-turbo-16k",
|
||||||
messages: [
|
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},
|
{ role: "user", content: question + "\n" + fileContents},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
@ -304,13 +304,19 @@ function getWebviewContent(apiResponse = '', question = '') {
|
|||||||
</div>
|
</div>
|
||||||
<div class="content" id="api-response">
|
<div class="content" id="api-response">
|
||||||
<div id="question-rep">
|
<div id="question-rep">
|
||||||
<p>${question ? '> ' + question : null}</p>
|
<p>${
|
||||||
|
question = question.replace(/</g, '<').replace(/>/g, '>'),
|
||||||
|
question ? '> ' + question : null
|
||||||
|
}</p>
|
||||||
</div>
|
</div>
|
||||||
${
|
${
|
||||||
apiResponse ? `
|
apiResponse ? `
|
||||||
<div id="rendered">
|
<div id="rendered">
|
||||||
<p id="responses">
|
<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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
` : null
|
` : null
|
||||||
|
Loading…
Reference in New Issue
Block a user