Fix resetting reasoning duration correctly

eb6a158781cf3b8660cdc1ecd06d7bbecea4dbe3

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +4 -0Showing whitespace changes
public/script.js+4 -0
@@ -5930,6 +5930,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
59305930 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
59315931 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
59325932 chat[chat.length - 1]['extra']['reasoning'] = reasoning;
5933+ chat[chat.length - 1]['extra']['reasoning_duration'] = null;
59335934 if (power_user.message_token_count_enabled) {
59345935 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];
59355936 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);
@@ -5952,6 +5953,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
59525953 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
59535954 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
59545955 chat[chat.length - 1]['extra']['reasoning'] = reasoning;
5956+ chat[chat.length - 1]['extra']['reasoning_duration'] = null;
59555957 if (power_user.message_token_count_enabled) {
59565958 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];
59575959 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);
@@ -5971,6 +5973,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
59715973 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
59725974 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
59735975 chat[chat.length - 1]['extra']['reasoning'] += reasoning;
5976+ // We don't know if the reasoning duration extended, so we don't update it here on purpose.
59745977 if (power_user.message_token_count_enabled) {
59755978 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];
59765979 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);
@@ -5990,6 +5993,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
59905993 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
59915994 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
59925995 chat[chat.length - 1]['extra']['reasoning'] = reasoning;
5996+ chat[chat.length - 1]['extra']['reasoning_duration'] = null;
59935997 if (power_user.trim_spaces) {
59945998 getMessage = getMessage.trim();
59955999 }