Skip to content

Commit 29e5e0f

Browse files
geronimi73aothms
authored andcommitted
chevrons for tool result expansion
1 parent d7de4f8 commit 29e5e0f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/ifcchat/app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,16 @@ function addMessage(role, text) {
7575
const wrap = document.createElement("div");
7676
wrap.className = `msg ${role}`;
7777
wrap.innerHTML = `
78-
<div class="role ${role}">${role}</div>
78+
<div class="role ${role}">${role}${role === "tool" ? '<span class="chevron">▶</span>' : ''}</div>
7979
<div class="bubble"></div>`;
8080
const bubble = wrap.querySelector(".bubble");
8181
bubble.textContent = text;
8282
bubble.onclick = function () {
8383
if (bubble.scrollHeight > 100 && role === "tool") {
84-
bubble.style.maxHeight = bubble.style.maxHeight == 'none' ? '' : 'none';
85-
bubble.style.borderBottom = bubble.style.borderBottom == '' ? 'dotted 2px gray' : '';
84+
const expanded = bubble.style.maxHeight === 'none';
85+
bubble.style.maxHeight = expanded ? '' : 'none';
86+
bubble.style.borderBottom = expanded ? '' : 'dotted 2px gray';
87+
wrap.querySelector(".chevron").style.transform = expanded ? '' : 'rotate(90deg)';
8688
}
8789
}
8890
msgsEl.appendChild(wrap);

src/ifcchat/style.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ main {
8282
font-size: 60%;
8383
max-height: 100px;
8484
overflow: hidden;
85+
cursor: pointer;
86+
}
87+
88+
.chevron {
89+
display: inline-block;
90+
font-size: 10px;
91+
margin-left: 6px;
92+
transition: transform 0.2s;
93+
vertical-align: middle;
8594
}
8695

8796
.composer {

0 commit comments

Comments
 (0)