UntilDot commited on
Commit
6802b6d
·
verified ·
1 Parent(s): dda7259

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +7 -2
static/script.js CHANGED
@@ -134,12 +134,17 @@ const userInput = document.getElementById("userInput");
134
  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 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
 
 
134
  const chatContainer = document.getElementById("chatContainer");
135
 
136
  function appendMessage(role, text) {
137
+ const wrapper = document.createElement("div");
138
+ wrapper.className = `flex ${role === "user" ? "justify-end" : "justify-start"}`;
139
+
140
  const div = document.createElement("div");
141
  div.className = `p-3 rounded shadow max-w-2xl whitespace-pre-wrap break-words ${
142
+ role === "user" ? "bg-blue text-fg0" : "bg-green text-fg0"
143
  }`;
144
+
145
  div.textContent = text;
146
+ wrapper.appendChild(div);
147
+ chatContainer.appendChild(wrapper);
148
  chatContainer.scrollTop = chatContainer.scrollHeight;
149
  }
150