| 372 | 372 | #updateReasoningTimeUI() { |
| 373 | 373 | const element = this.messageReasoningHeaderDom; |
| 374 | 374 | const duration = this.getDuration(); |
| 375 | + let data = null; |
| 375 | 376 | if (duration) { |
| 376 | 377 | const durationStr = moment.duration(duration).locale(getCurrentLocale()).humanize({ s: 50, ss: 3 }); |
| 377 | 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 | 387 | } else if (this.state === ReasoningState.Thinking) { |
| 380 | 388 | element.textContent = t`Thinking...`; |
| 389 | + data = null; |
| 381 | 390 | } else { |
| 382 | 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 | } |
| 386 | 399 | |