new line formating

This commit is contained in:
Alex
2023-03-03 18:51:45 +00:00
parent 70d2ef16d0
commit f233766671
2 changed files with 2 additions and 1 deletions

View File

@@ -143,7 +143,7 @@ def api_answer():
# some formatting for the frontend
result['answer'] = result['result']
result['answer'] = result['answer'].replace("\\n", "<br>")
result['answer'] = result['answer'].replace("\\n", "\n")
try:
result['answer'] = result['answer'].split("SOURCES:")[0]
except:

View File

@@ -46,6 +46,7 @@ function submitForm(event){
}
if(data.answer){
msg_html = '<div class="bg-indigo-500 text-white p-2 rounded-lg mb-2 self-start"><code class="text-sm">'
data.answer = data.answer.replace(/\n/g, "<br>");
msg_html += data.answer
msg_html += '</code></div>'
document.getElementById("messages").innerHTML += msg_html;