mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
chevrons for tool result expansion
This commit is contained in:
committed by
Thomas Krijnen
parent
d7de4f8df0
commit
29e5e0fd1a
+5
-3
@@ -75,14 +75,16 @@ function addMessage(role, text) {
|
|||||||
const wrap = document.createElement("div");
|
const wrap = document.createElement("div");
|
||||||
wrap.className = `msg ${role}`;
|
wrap.className = `msg ${role}`;
|
||||||
wrap.innerHTML = `
|
wrap.innerHTML = `
|
||||||
<div class="role ${role}">${role}</div>
|
<div class="role ${role}">${role}${role === "tool" ? '<span class="chevron">▶</span>' : ''}</div>
|
||||||
<div class="bubble"></div>`;
|
<div class="bubble"></div>`;
|
||||||
const bubble = wrap.querySelector(".bubble");
|
const bubble = wrap.querySelector(".bubble");
|
||||||
bubble.textContent = text;
|
bubble.textContent = text;
|
||||||
bubble.onclick = function () {
|
bubble.onclick = function () {
|
||||||
if (bubble.scrollHeight > 100 && role === "tool") {
|
if (bubble.scrollHeight > 100 && role === "tool") {
|
||||||
bubble.style.maxHeight = bubble.style.maxHeight == 'none' ? '' : 'none';
|
const expanded = bubble.style.maxHeight === 'none';
|
||||||
bubble.style.borderBottom = bubble.style.borderBottom == '' ? 'dotted 2px gray' : '';
|
bubble.style.maxHeight = expanded ? '' : 'none';
|
||||||
|
bubble.style.borderBottom = expanded ? '' : 'dotted 2px gray';
|
||||||
|
wrap.querySelector(".chevron").style.transform = expanded ? '' : 'rotate(90deg)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msgsEl.appendChild(wrap);
|
msgsEl.appendChild(wrap);
|
||||||
|
|||||||
@@ -82,6 +82,15 @@ main {
|
|||||||
font-size: 60%;
|
font-size: 60%;
|
||||||
max-height: 100px;
|
max-height: 100px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chevron {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 10px;
|
||||||
|
margin-left: 6px;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.composer {
|
.composer {
|
||||||
|
|||||||
Reference in New Issue
Block a user