From 68f1a6be895dcb99dde62ff1d23fd12174ff279a Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Wed, 2 Dec 2026 11:38:00 +0100 Subject: [PATCH] fix(web/claw): name the human on their own chat rows Every row the reader wrote said "you" under an avatar holding a bare Y, even with the profile set: the chat panel never read GET /v1/user, so the name and picture appeared only in the account row at the bottom of the sidebar, and the transcript contradicted it. The panel takes the profile now. Its rows label themselves with the name on the interactive and phone keys, "you" only until one is set, and the avatar renders the picture when there is one and the name's first letter otherwise. A dispatch row keeps its own label and initial: it speaks for the trigger that started it, not for the reader. nuxt typecheck passes; against the mock claw a profile named "Ada Lovelace" with a picture renders on its rows, and clearing the profile falls back to "you" and Y. --- web/claw/app/app.vue | 2 ++ web/claw/app/components/ChatPanel.vue | 35 +++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/web/claw/app/app.vue b/web/claw/app/app.vue index 7095cfc..37aeae4 100644 --- a/web/claw/app/app.vue +++ b/web/claw/app/app.vue @@ -1081,6 +1081,8 @@ onUnmounted(() => { :prepend-count="prependCount" :identity="identity" :avatar-url="identityAvatarUrl" + :user="userProfile" + :user-avatar-url="userAvatarUrl" @older="loadOlder" @send="send" @open-providers="go({ view: 'settings', section: 'providers' })" diff --git a/web/claw/app/components/ChatPanel.vue b/web/claw/app/components/ChatPanel.vue index 6b846c5..44aa27e 100644 --- a/web/claw/app/components/ChatPanel.vue +++ b/web/claw/app/components/ChatPanel.vue @@ -42,6 +42,11 @@ const props = defineProps<{ prependCount?: number identity?: { name: string | null } | null avatarUrl?: string | null + /** The human's profile: the name their own rows carry, while unset the + * generic `you` stands in. */ + user?: { name: string | null; avatar: boolean } | null + /** The picture from `GET /v1/user/avatar`, as an object URL. */ + userAvatarUrl?: string | null }>() const agentName = computed(() => props.identity?.name?.trim() || 'rhema') @@ -59,7 +64,9 @@ const readOnlyNote = computed(() => * web surface or on the phone; every other key's are the prompt its * dispatch was started with. */ const userLabel = computed(() => - /^(interactive|phone):/.test(props.activeKey) ? 'you' : 'dispatch', + /^(interactive|phone):/.test(props.activeKey) + ? props.user?.name?.trim() || 'you' + : 'dispatch', ) /** Whether the key has a stream at all. A snapshot answers a page once @@ -423,9 +430,17 @@ function messageSegments(text: string, pastes: PasteSpan[] = []): MessageSegment const displayName = computed(() => props.activeKey.replace(/^interactive:/, '') || 'Chat') -/** The letter in the human row's avatar; the dispatch row speaks for - * its trigger, so it gets its own initial. */ -const userInitial = computed(() => (userLabel.value === 'you' ? 'Y' : 'D')) +/** The letter in the human row's avatar, the name's first letter; the + * dispatch row speaks for its trigger, so it keeps `D`. */ +const userInitial = computed( + () => (Array.from(userLabel.value)[0] ?? 'Y').toUpperCase(), +) + +/** The picture beside the human's rows. A dispatch row speaks for the + * trigger that started it, not for the human, so it never gets theirs. */ +const userRowAvatar = computed(() => + userLabel.value === 'dispatch' ? null : props.userAvatarUrl, +) // The dispatch internals live behind the info modal, not in the header. const infoOpen = ref(false) @@ -514,7 +529,10 @@ function streamTone(status: StreamStatus): 'ok' | 'warn' | 'error' {