forked from open-webui/open-webui
Merge branch 'dev' into feat/customizable-title-prompt-length
This commit is contained in:
commit
a938ffb586
16 changed files with 187 additions and 43 deletions
|
@ -493,4 +493,25 @@ export const templatePrompt = (template: string, prompt: string) => {
|
|||
}
|
||||
|
||||
return template;
|
||||
|
||||
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(' ');
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue