Changed param order, saved a tree

fb5f3e0f97602682c4aec498a318b4c589f30a5f

bmen25124 <bmen25124@gmail.com>

1 files changed, +5 -7Showing whitespace changes
public/script.js+5 -7
@@ -2477,7 +2477,7 @@ export function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll
24772477 timestamp: timestamp,
24782478 extra: mes.extra,
24792479 tokenCount: mes.extra?.token_count ?? 0,
24802480 ...formatGenerationTimer(mes.gen_started, mes.gen_finished, mes.extra?.token_count, mes.extra?.time_to_first_tokenreasoning_duration, mes.extra?.reasoning_durationtime_to_first_token),
24812481 };
24822482
24832483 const renderedMessage = getMessageFromTemplate(params);
@@ -2597,15 +2597,15 @@ export function formatCharacterAvatar(characterAvatar) {
25972597 * @param {Date} gen_started Date when generation was started
25982598 * @param {Date} gen_finished Date when generation was finished
25992599 * @param {number} tokenCount Number of tokens generated (0 if not available)
2600- * @param {number | null} timeToFirstToken Time to first token
26012600 * @param {number?} [reasoningDuration=null] Reasoning duration (null if no reasoning was done)
2601+ * @param {number?} [timeToFirstToken=null] Time to first token
26022602 * @returns {Object} Object containing the formatted timer value and title
26032603 * @example
26042604 * const { timerValue, timerTitle } = formatGenerationTimer(gen_started, gen_finished, tokenCount);
26052605 * console.log(timerValue); // 1.2s
26062606 * 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
26072607 */
26082608function formatGenerationTimer(gen_started, gen_finished, tokenCount, timeToFirstTokenreasoningDuration = null, reasoningDurationtimeToFirstToken = null) {
26092609 if (!gen_started || !gen_finished) {
26102610 return {};
26112611 }
@@ -3160,9 +3160,7 @@ class StreamingProcessor {
31603160 this.abortController = new AbortController();
31613161 this.firstMessageText = '...';
31623162 this.timeStarted = timeStarted;
3163- /**
3163+ /** @type {number?} */
3164- * @type {number?}
3165- */
31663164 this.timeToFirstToken = null;
31673165 this.createdAt = new Date();
31683166 this.continueMessage = type === 'continue' ? continueMessage : '';
@@ -3295,7 +3293,7 @@ class StreamingProcessor {
32953293 this.messageTextDom.innerHTML = formattedText;
32963294 }
32973295
32983296 const timePassed = formatGenerationTimer(this.timeStarted, currentTime, currentTokenCount, this.timeToFirstToken, this.reasoningHandler.getDuration(), this.timeToFirstToken);
32993297 if (this.messageTimerDom instanceof HTMLElement) {
33003298 this.messageTimerDom.textContent = timePassed.timerValue;
33013299 this.messageTimerDom.title = timePassed.timerTitle;