Fix resetting reasoning duration correctly

eb6a158781cf3b8660cdc1ecd06d7bbecea4dbe3

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +4 -0Ignore whitespace
public/script.js+4 -0
@@ -5930,6 +5930,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
5930 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();5930 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
5931 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();5931 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
5932 chat[chat.length - 1]['extra']['reasoning'] = reasoning;5932 chat[chat.length - 1]['extra']['reasoning'] = reasoning;
5933 chat[chat.length - 1]['extra']['reasoning_duration'] = null;
5933 if (power_user.message_token_count_enabled) {5934 if (power_user.message_token_count_enabled) {
5934 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];5935 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];
5935 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);5936 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);
@@ -5952,6 +5953,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
5952 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();5953 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
5953 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();5954 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
5954 chat[chat.length - 1]['extra']['reasoning'] = reasoning;5955 chat[chat.length - 1]['extra']['reasoning'] = reasoning;
5956 chat[chat.length - 1]['extra']['reasoning_duration'] = null;
5955 if (power_user.message_token_count_enabled) {5957 if (power_user.message_token_count_enabled) {
5956 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];5958 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];
5957 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);5959 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);
@@ -5971,6 +5973,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
5971 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();5973 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
5972 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();5974 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
5973 chat[chat.length - 1]['extra']['reasoning'] += reasoning;5975 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.
5974 if (power_user.message_token_count_enabled) {5977 if (power_user.message_token_count_enabled) {
5975 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];5978 const tokenCountText = (reasoning || '') + chat[chat.length - 1]['mes'];
5976 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);5979 chat[chat.length - 1]['extra']['token_count'] = await getTokenCountAsync(tokenCountText, 0);
@@ -5990,6 +5993,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
5990 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();5993 chat[chat.length - 1]['extra']['api'] = getGeneratingApi();
5991 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();5994 chat[chat.length - 1]['extra']['model'] = getGeneratingModel();
5992 chat[chat.length - 1]['extra']['reasoning'] = reasoning;5995 chat[chat.length - 1]['extra']['reasoning'] = reasoning;
5996 chat[chat.length - 1]['extra']['reasoning_duration'] = null;
5993 if (power_user.trim_spaces) {5997 if (power_user.trim_spaces) {
5994 getMessage = getMessage.trim();5998 getMessage = getMessage.trim();
5995 }5999 }