enh: edited indicator

This commit is contained in:
Timothy Jaeryang Baek 2024-12-23 01:19:30 -07:00
parent fb3c297df2
commit ed44b21a78
2 changed files with 11 additions and 4 deletions

View File

@ -64,6 +64,8 @@ class MessageTable:
) -> Optional[MessageModel]: ) -> Optional[MessageModel]:
with get_db() as db: with get_db() as db:
id = str(uuid.uuid4()) id = str(uuid.uuid4())
ts = int(time.time_ns())
message = MessageModel( message = MessageModel(
**{ **{
"id": id, "id": id,
@ -72,8 +74,8 @@ class MessageTable:
"content": form_data.content, "content": form_data.content,
"data": form_data.data, "data": form_data.data,
"meta": form_data.meta, "meta": form_data.meta,
"created_at": int(time.time_ns()), "created_at": ts,
"updated_at": int(time.time_ns()), "updated_at": ts,
} }
) )

View File

@ -96,7 +96,7 @@
dir={$settings.chatDirection} dir={$settings.chatDirection}
> >
<div <div
class={`flex-shrink-0 ${($settings?.chatDirection ?? 'LTR') === 'LTR' ? 'mr-3' : 'ml-3'}`} class={`flex-shrink-0 ${($settings?.chatDirection ?? 'LTR') === 'LTR' ? 'mr-3' : 'ml-3'} w-8`}
> >
{#if showUserProfile} {#if showUserProfile}
<ProfileImage <ProfileImage
@ -189,7 +189,12 @@
</div> </div>
{:else} {:else}
<div class=" min-w-full markdown-prose"> <div class=" min-w-full markdown-prose">
<Markdown id={message.id} content={message.content} /> <Markdown
id={message.id}
content={message.content}
/>{#if message.created_at !== message.updated_at}<span class="text-gray-500 text-[10px]"
>(edited)</span
>{/if}
</div> </div>
{/if} {/if}
</div> </div>