Small improvements to reasoning UI

c5016732415291491da891ef093347f2ae5f994a

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +15 -2Ignore whitespace
public/scripts/reasoning.js+15 -2
@@ -372,15 +372,28 @@ export class ReasoningHandler {
372 #updateReasoningTimeUI() {372 #updateReasoningTimeUI() {
373 const element = this.messageReasoningHeaderDom;373 const element = this.messageReasoningHeaderDom;
374 const duration = this.getDuration();374 const duration = this.getDuration();
375 let data = null;
375 if (duration) {376 if (duration) {
376 const durationStr = moment.duration(duration).locale(getCurrentLocale()).humanize({ s: 50, ss: 3 });377 const durationStr = moment.duration(duration).locale(getCurrentLocale()).humanize({ s: 50, ss: 3 });
377 const secondsStr = moment.duration(duration).asSeconds();378 const secondsStr = moment.duration(duration).asSeconds();
378 element.innerHTML = t`Thought for <span title="${secondsStr} seconds">${durationStr}</span>`;379
380 const span = document.createElement('span');
381 span.title = t`${secondsStr} seconds`;
382 span.textContent = durationStr;
383
384 element.textContent = t`Thought for `;
385 element.appendChild(span);
386 data = String(secondsStr);
379 } else if (this.state === ReasoningState.Thinking) {387 } else if (this.state === ReasoningState.Thinking) {
380 element.textContent = t`Thinking...`;388 element.textContent = t`Thinking...`;
389 data = null;
381 } else {390 } else {
382 element.textContent = t`Thought for some time`;391 element.textContent = t`Thought for some time`;
392 data = 'unknown';
383 }393 }
394
395 this.messageReasoningDetailsDom.dataset.duration = data;
396 element.dataset.duration = data;
384 }397 }
385}398}
386399
@@ -711,7 +724,7 @@ function setReasoningEventHandlers() {
711 e.stopPropagation();724 e.stopPropagation();
712 e.preventDefault();725 e.preventDefault();
713726
714 const confirm = await Popup.show.confirm(t`Are you sure you want to clear the reasoning?`, t`Visible message contents will stay intact.`);727 const confirm = await Popup.show.confirm(t`Remove Reasoning`, t`Are you sure you want to clear the reasoning?<br />Visible message contents will stay intact.`);
715728
716 if (!confirm) {729 if (!confirm) {
717 return;730 return;