forked from open-webui/open-webui
		
	feat: message ts display
This commit is contained in:
		
							parent
							
								
									59724ea9d8
								
							
						
					
					
						commit
						4ec81a897e
					
				
					 5 changed files with 22 additions and 7 deletions
				
			
		|  | @ -1,3 +1,3 @@ | ||||||
| <div class=" self-center font-bold mb-0.5 capitalize"> | <div class=" self-center font-bold mb-0.5 capitalize line-clamp-1"> | ||||||
| 	<slot /> | 	<slot /> | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
|  | 	import dayjs from 'dayjs'; | ||||||
| 	import { marked } from 'marked'; | 	import { marked } from 'marked'; | ||||||
| 
 | 
 | ||||||
| 	import tippy from 'tippy.js'; | 	import tippy from 'tippy.js'; | ||||||
|  | @ -219,6 +220,12 @@ | ||||||
| 					>{message.model ? ` ${message.model}` : ''}</span | 					>{message.model ? ` ${message.model}` : ''}</span | ||||||
| 				> | 				> | ||||||
| 			{/if} | 			{/if} | ||||||
|  | 
 | ||||||
|  | 			{#if message.timestamp} | ||||||
|  | 				<span class=" invisible group-hover:visible text-gray-400 text-xs font-normal"> | ||||||
|  | 					{dayjs(message.timestamp * 1000).format('DD/MM/YYYY HH:MM')} | ||||||
|  | 				</span> | ||||||
|  | 			{/if} | ||||||
| 		</Name> | 		</Name> | ||||||
| 
 | 
 | ||||||
| 		{#if message.content === ''} | 		{#if message.content === ''} | ||||||
|  |  | ||||||
|  | @ -1,4 +1,6 @@ | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
|  | 	import dayjs from 'dayjs'; | ||||||
|  | 
 | ||||||
| 	import { tick } from 'svelte'; | 	import { tick } from 'svelte'; | ||||||
| 	import Name from './Name.svelte'; | 	import Name from './Name.svelte'; | ||||||
| 	import ProfileImage from './ProfileImage.svelte'; | 	import ProfileImage from './ProfileImage.svelte'; | ||||||
|  | @ -61,6 +63,12 @@ | ||||||
| 				{:else} | 				{:else} | ||||||
| 					You | 					You | ||||||
| 				{/if} | 				{/if} | ||||||
|  | 
 | ||||||
|  | 				{#if message.timestamp} | ||||||
|  | 					<span class=" invisible group-hover:visible text-gray-400 text-xs font-normal"> | ||||||
|  | 						{dayjs(message.timestamp * 1000).format('DD/MM/YYYY HH:MM')} | ||||||
|  | 					</span> | ||||||
|  | 				{/if} | ||||||
| 			</Name> | 			</Name> | ||||||
| 		</div> | 		</div> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -146,7 +146,7 @@ | ||||||
| 				user: _user ?? undefined, | 				user: _user ?? undefined, | ||||||
| 				content: userPrompt, | 				content: userPrompt, | ||||||
| 				files: files.length > 0 ? files : undefined, | 				files: files.length > 0 ? files : undefined, | ||||||
| 				timestamp: Date.now() | 				timestamp: Math.floor(Date.now() / 1000) // Unix epoch | ||||||
| 			}; | 			}; | ||||||
| 
 | 
 | ||||||
| 			// Add message to history and Set currentId to messageId | 			// Add message to history and Set currentId to messageId | ||||||
|  | @ -258,7 +258,7 @@ | ||||||
| 			role: 'assistant', | 			role: 'assistant', | ||||||
| 			content: '', | 			content: '', | ||||||
| 			model: model, | 			model: model, | ||||||
| 			timestamp: Date.now() | 			timestamp: Math.floor(Date.now() / 1000) // Unix epoch | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		// Add message to history and Set currentId to messageId | 		// Add message to history and Set currentId to messageId | ||||||
|  | @ -449,7 +449,7 @@ | ||||||
| 			role: 'assistant', | 			role: 'assistant', | ||||||
| 			content: '', | 			content: '', | ||||||
| 			model: model, | 			model: model, | ||||||
| 			timestamp: Date.now() | 			timestamp: Math.floor(Date.now() / 1000) // Unix epoch | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		history.messages[responseMessageId] = responseMessage; | 		history.messages[responseMessageId] = responseMessage; | ||||||
|  |  | ||||||
|  | @ -165,7 +165,7 @@ | ||||||
| 				user: _user ?? undefined, | 				user: _user ?? undefined, | ||||||
| 				content: userPrompt, | 				content: userPrompt, | ||||||
| 				files: files.length > 0 ? files : undefined, | 				files: files.length > 0 ? files : undefined, | ||||||
| 				timestamp: Date.now() | 				timestamp: Math.floor(Date.now() / 1000) // Unix epoch | ||||||
| 			}; | 			}; | ||||||
| 
 | 
 | ||||||
| 			// Add message to history and Set currentId to messageId | 			// Add message to history and Set currentId to messageId | ||||||
|  | @ -276,7 +276,7 @@ | ||||||
| 			role: 'assistant', | 			role: 'assistant', | ||||||
| 			content: '', | 			content: '', | ||||||
| 			model: model, | 			model: model, | ||||||
| 			timestamp: Date.now() | 			timestamp: Math.floor(Date.now() / 1000) // Unix epoch | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		// Add message to history and Set currentId to messageId | 		// Add message to history and Set currentId to messageId | ||||||
|  | @ -467,7 +467,7 @@ | ||||||
| 			role: 'assistant', | 			role: 'assistant', | ||||||
| 			content: '', | 			content: '', | ||||||
| 			model: model, | 			model: model, | ||||||
| 			timestamp: Date.now() | 			timestamp: Math.floor(Date.now() / 1000) // Unix epoch | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		history.messages[responseMessageId] = responseMessage; | 		history.messages[responseMessageId] = responseMessage; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy J. Baek
						Timothy J. Baek