Skip to content

Commit

Permalink
Update trade_gpt.html
Browse files Browse the repository at this point in the history
  • Loading branch information
alanbarret authored Nov 28, 2023
1 parent e868299 commit 87ad95f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions trade_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h1>Trade GPT Chatbot</h1>
</div>

<script>
var file_ids = []
var file_ids = []
// Function to dynamically resize textarea
function adjustTextAreaHeight(textArea) {
textArea.style.height = "auto";
Expand Down Expand Up @@ -247,7 +247,7 @@ <h1>Trade GPT Chatbot</h1>
messageDiv.classList.add("user");
}

if (file && fileType) {
if (file && fileType) {
if (fileType === "file") {
var base64EncodedCSV = file.split("base64,")[1];
var csvContent = atob(base64EncodedCSV);
Expand All @@ -259,8 +259,8 @@ <h1>Trade GPT Chatbot</h1>
messageDiv.innerHTML = `${message}<br/><pre><code class="language-python">${runSteps}</code></pre><br/>${imgTag}`;
}
} else {
messageDiv.innerHTML = convertMarkdownToHTML(message);
}
messageDiv.innerHTML = convertMarkdownToHTML(message) + (runSteps ? `<br/><pre><code class="language-python">${runSteps}</code></pre>` : '');
}

chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
Expand Down Expand Up @@ -344,13 +344,12 @@ <h1>Trade GPT Chatbot</h1>
.then((response) => response.json())
.then((result) => {
removeLoader();
console.log(result)
if (result && result.data.assistant) {
var file = result.data.file || null;
var fileType = result.data.file_type || null;
var runSteps = result.data.run_steps;
file_ids = result.file_ids
addMessage(result.data.assistant, "bot", file, fileType, runSteps);
file_ids = result.data.file_ids
addMessage(result.data.assistant, "bot", file, fileType, runSteps,file_ids);
if (result.data.thread_id) {
saveThreadIdToLocalStorage(result.data.thread_id);
}
Expand Down

0 comments on commit 87ad95f

Please sign in to comment.