feat(ui): times on injects and every spoken message

This commit is contained in:
hh
2026-09-02 04:52:26 +02:00
parent 74843451a4
commit b6d111a610
+15 -2
View File
@@ -251,15 +251,27 @@
{@const newMinute = {@const newMinute =
message.ts && message.ts &&
minuteOf(message.ts) !== minuteOf(messages[index - 1]?.ts)} minuteOf(message.ts) !== minuteOf(messages[index - 1]?.ts)}
{@const spoken =
message.role === "user" ||
parts.some((b) => b.type === "text" && Boolean(b.text))}
{#if newDay} {#if newDay}
<p class="label-quiet self-center pt-2"> <p class="label-quiet self-center pt-2">
{fmtDateTime(message.ts).replace(DAY_TIME, "")} {fmtDateTime(message.ts).replace(DAY_TIME, "")}
</p> </p>
{/if} {/if}
{#if system} {#if system}
<div class="flex min-w-0 items-start justify-center gap-2">
{#if message.ts}
<span
class="tabular shrink-0 py-1 text-[11px] text-muted-foreground opacity-60"
title={fmtDateTime(message.ts)}
>
{minuteOf(message.ts)}
</span>
{/if}
<button <button
aria-expanded={openSystem.has(index)} aria-expanded={openSystem.has(index)}
class="@md:max-w-[75ch] max-w-full self-center rounded-md px-2 py-1 text-left font-mono text-muted-foreground text-xs hover:bg-accent" class="@md:max-w-[75ch] min-w-0 max-w-full rounded-md px-2 py-1 text-left font-mono text-muted-foreground text-xs hover:bg-accent"
onclick={() => toggleSystem(index)} onclick={() => toggleSystem(index)}
type="button" type="button"
> >
@@ -271,6 +283,7 @@
> >
{/if} {/if}
</button> </button>
</div>
{:else if !(isResultOnly && !showResults)} {:else if !(isResultOnly && !showResults)}
<div <div
class={cn( class={cn(
@@ -278,7 +291,7 @@
message.role === "user" && !isResultOnly && "items-end" message.role === "user" && !isResultOnly && "items-end"
)} )}
> >
{#if message.ts && newMinute && !isResultOnly} {#if message.ts && (newMinute || spoken) && !isResultOnly}
<span <span
class="tabular px-1 text-[11px] text-muted-foreground opacity-60 transition-opacity group-hover:opacity-100" class="tabular px-1 text-[11px] text-muted-foreground opacity-60 transition-opacity group-hover:opacity-100"
title={fmtDateTime(message.ts)} title={fmtDateTime(message.ts)}