Update static/script.js
Browse files- static/script.js +3 -2
static/script.js
CHANGED
@@ -135,13 +135,14 @@ const chatContainer = document.getElementById("chatContainer");
|
|
135 |
|
136 |
function appendMessage(role, text) {
|
137 |
const div = document.createElement("div");
|
138 |
-
div.className = `p-3 rounded shadow max-w-2xl
|
|
|
|
|
139 |
div.textContent = text;
|
140 |
chatContainer.appendChild(div);
|
141 |
chatContainer.scrollTop = chatContainer.scrollHeight;
|
142 |
}
|
143 |
|
144 |
-
|
145 |
chatForm.addEventListener("submit", async (e) => {
|
146 |
e.preventDefault();
|
147 |
const prompt = userInput.value.trim();
|
|
|
135 |
|
136 |
function appendMessage(role, text) {
|
137 |
const div = document.createElement("div");
|
138 |
+
div.className = `p-3 rounded shadow max-w-2xl whitespace-pre-wrap break-words ${
|
139 |
+
role === "user" ? "bg-blue text-fg0 self-end" : "bg-green text-fg0 self-start"
|
140 |
+
}`;
|
141 |
div.textContent = text;
|
142 |
chatContainer.appendChild(div);
|
143 |
chatContainer.scrollTop = chatContainer.scrollHeight;
|
144 |
}
|
145 |
|
|
|
146 |
chatForm.addEventListener("submit", async (e) => {
|
147 |
e.preventDefault();
|
148 |
const prompt = userInput.value.trim();
|