Added time to first token for swipe
| @@ -3273,7 +3273,13 @@ class StreamingProcessor { | |||
| 3273 | 3273 | ||
| 3274 | if ((this.type == 'swipe' || this.type === 'continue') && Array.isArray(chat[messageId]['swipes'])) { | 3274 | if ((this.type == 'swipe' || this.type === 'continue') && Array.isArray(chat[messageId]['swipes'])) { |
| 3275 | chat[messageId]['swipes'][chat[messageId]['swipe_id']] = processedText; | 3275 | chat[messageId]['swipes'][chat[messageId]['swipe_id']] = processedText; |
| 3276 | chat[messageId]['swipe_info'][chat[messageId]['swipe_id']] = { 'send_date': chat[messageId]['send_date'], 'gen_started': chat[messageId]['gen_started'], 'gen_finished': chat[messageId]['gen_finished'], 'extra': JSON.parse(JSON.stringify(chat[messageId]['extra'])) }; | 3276 | chat[messageId]['swipe_info'][chat[messageId]['swipe_id']] = { |
| 3277 | 'send_date': chat[messageId]['send_date'], | ||
| 3278 | 'gen_started': chat[messageId]['gen_started'], | ||
| 3279 | 'gen_finished': chat[messageId]['gen_finished'], | ||
| 3280 | 'time_to_first_token': chat[messageId]['time_to_first_token'], | ||
| 3281 | 'extra': JSON.parse(JSON.stringify(chat[messageId]['extra'])) | ||
| 3282 | }; | ||
| 3277 | } | 3283 | } |
| 3278 | 3284 | ||
| 3279 | const formattedText = messageFormatting( | 3285 | const formattedText = messageFormatting( |
| @@ -3364,7 +3370,12 @@ class StreamingProcessor { | |||
| 3364 | if (this.type !== 'swipe' && this.type !== 'impersonate') { | 3370 | if (this.type !== 'swipe' && this.type !== 'impersonate') { |
| 3365 | if (Array.isArray(chat[messageId]['swipes']) && chat[messageId]['swipes'].length === 1 && chat[messageId]['swipe_id'] === 0) { | 3371 | if (Array.isArray(chat[messageId]['swipes']) && chat[messageId]['swipes'].length === 1 && chat[messageId]['swipe_id'] === 0) { |
| 3366 | chat[messageId]['swipes'][0] = chat[messageId]['mes']; | 3372 | chat[messageId]['swipes'][0] = chat[messageId]['mes']; |
| 3367 | chat[messageId]['swipe_info'][0] = { 'send_date': chat[messageId]['send_date'], 'gen_started': chat[messageId]['gen_started'], 'gen_finished': chat[messageId]['gen_finished'], 'extra': JSON.parse(JSON.stringify(chat[messageId]['extra'])) }; | 3373 | chat[messageId]['swipe_info'][0] = { |
| 3374 | 'send_date': chat[messageId]['send_date'], | ||
| 3375 | 'gen_started': chat[messageId]['gen_started'], | ||
| 3376 | 'gen_finished': chat[messageId]['gen_finished'], | ||
| 3377 | 'time_to_first_token': chat[messageId]['time_to_first_token'], | ||
| 3378 | 'extra': JSON.parse(JSON.stringify(chat[messageId]['extra'])) }; | ||
| 3368 | } | 3379 | } |
| 3369 | } | 3380 | } |
| 3370 | } | 3381 | } |
| @@ -6078,6 +6089,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes, | |||
| 6078 | send_date: item['send_date'], | 6089 | send_date: item['send_date'], |
| 6079 | gen_started: item['gen_started'], | 6090 | gen_started: item['gen_started'], |
| 6080 | gen_finished: item['gen_finished'], | 6091 | gen_finished: item['gen_finished'], |
| 6092 | time_to_first_token: item['time_to_first_token'], | ||
| 6081 | extra: JSON.parse(JSON.stringify(item['extra'])), | 6093 | extra: JSON.parse(JSON.stringify(item['extra'])), |
| 6082 | }; | 6094 | }; |
| 6083 | } else { | 6095 | } else { |
| @@ -6088,6 +6100,7 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes, | |||
| 6088 | send_date: chat[chat.length - 1]['send_date'], | 6100 | send_date: chat[chat.length - 1]['send_date'], |
| 6089 | gen_started: chat[chat.length - 1]['gen_started'], | 6101 | gen_started: chat[chat.length - 1]['gen_started'], |
| 6090 | gen_finished: chat[chat.length - 1]['gen_finished'], | 6102 | gen_finished: chat[chat.length - 1]['gen_finished'], |
| 6103 | time_to_first_token: chat[chat.length - 1]['time_to_first_token'], | ||
| 6091 | extra: JSON.parse(JSON.stringify(chat[chat.length - 1]['extra'])), | 6104 | extra: JSON.parse(JSON.stringify(chat[chat.length - 1]['extra'])), |
| 6092 | }; | 6105 | }; |
| 6093 | } | 6106 | } |
| @@ -8837,7 +8850,13 @@ const swipe_right = () => { | |||
| 8837 | chat[chat.length - 1]['swipes'] = []; // empty the array | 8850 | chat[chat.length - 1]['swipes'] = []; // empty the array |
| 8838 | chat[chat.length - 1]['swipe_info'] = []; | 8851 | chat[chat.length - 1]['swipe_info'] = []; |
| 8839 | chat[chat.length - 1]['swipes'][0] = chat[chat.length - 1]['mes']; //assign swipe array with last message from chat | 8852 | chat[chat.length - 1]['swipes'][0] = chat[chat.length - 1]['mes']; //assign swipe array with last message from chat |
| 8840 | chat[chat.length - 1]['swipe_info'][0] = { 'send_date': chat[chat.length - 1]['send_date'], 'gen_started': chat[chat.length - 1]['gen_started'], 'gen_finished': chat[chat.length - 1]['gen_finished'], 'extra': JSON.parse(JSON.stringify(chat[chat.length - 1]['extra'])) }; | 8853 | chat[chat.length - 1]['swipe_info'][0] = { |
| 8854 | 'send_date': chat[chat.length - 1]['send_date'], | ||
| 8855 | 'gen_started': chat[chat.length - 1]['gen_started'], | ||
| 8856 | 'gen_finished': chat[chat.length - 1]['gen_finished'], | ||
| 8857 | 'time_to_first_token': chat[chat.length - 1]['time_to_first_token'], | ||
| 8858 | 'extra': JSON.parse(JSON.stringify(chat[chat.length - 1]['extra'])) | ||
| 8859 | }; | ||
| 8841 | //assign swipe info array with last message from chat | 8860 | //assign swipe info array with last message from chat |
| 8842 | } | 8861 | } |
| 8843 | if (chat.length === 1 && chat[0]['swipe_id'] !== undefined && chat[0]['swipe_id'] === chat[0]['swipes'].length - 1) { // if swipe_right is called on the last alternate greeting, loop back around | 8862 | if (chat.length === 1 && chat[0]['swipe_id'] !== undefined && chat[0]['swipe_id'] === chat[0]['swipes'].length - 1) { // if swipe_right is called on the last alternate greeting, loop back around |