Add thinking time to gen timer tooltip
| @@ -2459,7 +2459,7 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll | ||
| 2459 | 2459 | timestamp: timestamp, |
| 2460 | 2460 | extra: mes.extra, |
| 2461 | 2461 | tokenCount: mes.extra?.token_count ?? 0, |
| 2462 | 2462 | ...formatGenerationTimer(mes.gen_started, mes.gen_finished, mes.extra?.token_count, mes.extra?.reasoning_duration), |
| 2463 | 2463 | }; |
| 2464 | 2464 | |
| 2465 | 2465 | const renderedMessage = getMessageFromTemplate(params); |
| @@ -2579,13 +2579,14 @@ export function formatCharacterAvatar(characterAvatar) { | ||
| 2579 | 2579 | * @param {Date} gen_started Date when generation was started |
| 2580 | 2580 | * @param {Date} gen_finished Date when generation was finished |
| 2581 | 2581 | * @param {number} tokenCount Number of tokens generated (0 if not available) |
| 2582 | + * @param {number?} [reasoningDuration=null] Reasoning duration (null if no reasoning was done) | |
| 2582 | 2583 | * @returns {Object} Object containing the formatted timer value and title |
| 2583 | 2584 | * @example |
| 2584 | 2585 | * const { timerValue, timerTitle } = formatGenerationTimer(gen_started, gen_finished, tokenCount); |
| 2585 | 2586 | * console.log(timerValue); // 1.2s |
| 2586 | 2587 | * console.log(timerTitle); // Generation queued: 12:34:56 7 Jan 2021\nReply received: 12:34:57 7 Jan 2021\nTime to generate: 1.2 seconds\nToken rate: 5 t/s |
| 2587 | 2588 | */ |
| 2588 | 2589 | function formatGenerationTimer(gen_started, gen_finished, tokenCount, reasoningDuration = null) { |
| 2589 | 2590 | if (!gen_started || !gen_finished) { |
| 2590 | 2591 | return {}; |
| 2591 | 2592 | } |
| @@ -2599,6 +2600,7 @@ function formatGenerationTimer(gen_started, gen_finished, tokenCount) { | ||
| 2599 | 2600 | `Generation queued: ${start.format(dateFormat)}`, |
| 2600 | 2601 | `Reply received: ${finish.format(dateFormat)}`, |
| 2601 | 2602 | `Time to generate: ${seconds} seconds`, |
| 2603 | + reasoningDuration > 0 ? `Time to think: ${reasoningDuration / 1000} seconds` : '', | |
| 2602 | 2604 | tokenCount > 0 ? `Token rate: ${Number(tokenCount / seconds).toFixed(1)} t/s` : '', |
| 2603 | 2605 | ].join('\n'); |
| 2604 | 2606 | |
| @@ -3310,7 +3312,7 @@ class StreamingProcessor { | ||
| 3310 | 3312 | this.messageTextDom.innerHTML = formattedText; |
| 3311 | 3313 | } |
| 3312 | 3314 | |
| 3313 | 3315 | const timePassed = formatGenerationTimer(this.timeStarted, currentTime, currentTokenCount, this.#reasoningDuration()); |
| 3314 | 3316 | if (this.messageTimerDom instanceof HTMLElement) { |
| 3315 | 3317 | this.messageTimerDom.textContent = timePassed.timerValue; |
| 3316 | 3318 | this.messageTimerDom.title = timePassed.timerTitle; |