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' {