UI Changes

This commit is contained in:
Tanishq Dubey 2024-09-26 13:53:07 -04:00
parent 3000ff6ead
commit c6d152ae3b

View File

@ -117,9 +117,17 @@
function addThought(step, content) { function addThought(step, content) {
if (thinkingDetails) { if (thinkingDetails) {
const thoughtElement = document.createElement('div'); const stepElement = document.createElement('div');
thoughtElement.innerHTML = `<strong>${step}:</strong> ${content}`; stepElement.classList.add('thought-summary', 'collapsible');
thinkingDetails.appendChild(thoughtElement); stepElement.textContent = step;
stepElement.onclick = toggleStepDetails;
const stepDetails = document.createElement('div');
stepDetails.classList.add('thought-details');
stepDetails.innerHTML = content;
thinkingDetails.appendChild(stepElement);
thinkingDetails.appendChild(stepDetails);
chatContainer.scrollTop = chatContainer.scrollHeight; chatContainer.scrollTop = chatContainer.scrollHeight;
} }
} }
@ -133,7 +141,18 @@
function toggleThinkingDetails() { function toggleThinkingDetails() {
this.classList.toggle('open'); this.classList.toggle('open');
thinkingDetails.style.display = thinkingDetails.style.display === 'none' ? 'block' : 'none'; const details = this.nextElementSibling;
if (details) {
details.style.display = details.style.display === 'none' ? 'block' : 'none';
}
}
function toggleStepDetails() {
this.classList.toggle('open');
const details = this.nextElementSibling;
if (details) {
details.style.display = details.style.display === 'none' ? 'block' : 'none';
}
} }
socket.on('thinking', (data) => { socket.on('thinking', (data) => {