diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte
index 7aa6f65ce..3789faaa9 100644
--- a/src/lib/components/chat/Messages/ResponseMessage.svelte
+++ b/src/lib/components/chat/Messages/ResponseMessage.svelte
@@ -18,6 +18,7 @@
import { synthesizeOpenAISpeech } from '$lib/apis/openai';
import { imageGenerations } from '$lib/apis/images';
import {
+ approximateToHumanReadable,
extractSentences,
revertSanitizedResponseContent,
sanitizeResponseContent
@@ -122,7 +123,10 @@
eval_count: ${message.info.eval_count ?? 'N/A'}
eval_duration: ${
Math.round(((message.info.eval_duration ?? 0) / 1000000) * 100) / 100 ?? 'N/A'
- }ms`,
+ }ms
+ approximate_total: ${approximateToHumanReadable(
+ message.info.total_duration
+ )}`,
allowHTML: true
});
}
diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts
index e9a4e229b..338430bb5 100644
--- a/src/lib/utils/index.ts
+++ b/src/lib/utils/index.ts
@@ -467,3 +467,25 @@ export const blobToFile = (blob, fileName) => {
const file = new File([blob], fileName, { type: blob.type });
return file;
};
+
+export const approximateToHumanReadable = (nanoseconds: number) => {
+ const seconds = Math.floor((nanoseconds / 1e9) % 60);
+ const minutes = Math.floor((nanoseconds / 6e10) % 60);
+ const hours = Math.floor((nanoseconds / 3.6e12) % 24);
+
+ const results: string[] = [];
+
+ if (seconds >= 0) {
+ results.push(`${seconds}s`);
+ }
+
+ if (minutes > 0) {
+ results.push(`${minutes}m`);
+ }
+
+ if (hours > 0) {
+ results.push(`${hours}h`);
+ }
+
+ return results.reverse().join(' ');
+};