| 157 | host.appendChild(foot); |
| 158 | |
| 159 | function turnNode(t) { |
| 160 | if (t.kind === "user") { |
| 161 | const wrap = htmlEl("div", { class: "lc-row lc-row--right" }); |
| 162 | wrap.appendChild(htmlEl("div", { class: "lc-bubble lc-bubble--user" }, t.text)); |
| 163 | return wrap; |
| 164 | } |
| 165 | if (t.kind === "tool") { |
| 166 | const wrap = htmlEl("div", { class: "lc-row" }); |
| 167 | const card = htmlEl("div", { class: "lc-tool" }); |
| 168 | card.appendChild( |
| 169 | htmlEl("div", { class: "lc-tool__sig" }, [ |
| 170 | htmlEl("span", { class: "lc-tool__name" }, t.tool), |
| 171 | htmlEl("span", { class: "lc-muted" }, "(" + t.args + ")"), |
| 172 | ]) |
| 173 | ); |
| 174 | card.appendChild(htmlEl("div", { class: "lc-tool__result" }, "↳ " + t.result)); |
| 175 | wrap.appendChild(card); |
| 176 | return wrap; |
| 177 | } |
| 178 | const wrap = htmlEl("div", { class: "lc-row" }); |
| 179 | wrap.appendChild(htmlEl("div", { class: "lc-bubble lc-bubble--agent" }, t.text)); |
| 180 | return wrap; |
| 181 | } |
| 182 | |
| 183 | function play() { |
| 184 | body.innerHTML = ""; |