Skip to content

Commit ec44383

Browse files
Merge pull request #9932 from gitbutlerapp/pass-user-avatar-to-codegen-message
Use the users real profile picture
2 parents 0e172fd + c60b31b commit ec44383

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

apps/desktop/src/components/codegen/CodegenClaudeMessage.svelte

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
message: Message;
99
onApproval?: (id: string) => Promise<void>;
1010
onRejection?: (id: string) => Promise<void>;
11+
userAvatarUrl?: string;
1112
};
12-
const { message, onApproval, onRejection }: Props = $props();
13-
13+
const { message, onApproval, onRejection, userAvatarUrl }: Props = $props();
1414
let toolCallsExpanded = $state(false);
1515
1616
const toolDisplayLimit = 3;
@@ -25,12 +25,7 @@
2525
</script>
2626

2727
{#if message.type === 'user'}
28-
<CodegenMessage
29-
content={message.message}
30-
avatarUrl="https://avatars.githubusercontent.com/u/70?v=4"
31-
side="right"
32-
bubble
33-
/>
28+
<CodegenMessage content={message.message} avatarUrl={userAvatarUrl} side="right" bubble />
3429
{:else if message.type === 'claude'}
3530
<CodegenMessage content={message.message} side="left">
3631
{#snippet extraContent()}

apps/desktop/src/components/codegen/CodegenMessage.svelte

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { Avatar, Markdown } from '@gitbutler/ui';
2+
import { Avatar, Icon, Markdown } from '@gitbutler/ui';
33
import type { Snippet } from 'svelte';
44
55
type Props = {
@@ -17,6 +17,10 @@
1717
<div class="message-avatar">
1818
{#if avatarUrl}
1919
<Avatar size="large" srcUrl={avatarUrl} tooltip="" />
20+
{:else if side === 'right'}
21+
<div class="user-icon">
22+
<Icon name="profile" size={22} />
23+
</div>
2024
{:else}
2125
{@render happyPC()}
2226
{/if}
@@ -103,4 +107,15 @@
103107
gap: 16px;
104108
text-wrap: wrap;
105109
}
110+
111+
.user-icon {
112+
display: flex;
113+
align-items: center;
114+
justify-content: center;
115+
width: 32px;
116+
height: 32px;
117+
border-radius: 16px;
118+
background: var(--clr-theme-pop-element);
119+
color: var(--clr-theme-pop-on-element);
120+
}
106121
</style>

apps/desktop/src/components/codegen/CodegenPage.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { SETTINGS_SERVICE } from '$lib/config/appSettingsV2';
1818
import { STACK_SERVICE } from '$lib/stacks/stackService.svelte';
1919
import { combineResults } from '$lib/state/helpers';
20+
import { USER } from '$lib/user/user';
2021
import { inject } from '@gitbutler/shared/context';
2122
import { Badge, Button } from '@gitbutler/ui';
2223
@@ -28,6 +29,7 @@
2829
const claudeCodeService = inject(CLAUDE_CODE_SERVICE);
2930
const stackService = inject(STACK_SERVICE);
3031
const settingsService = inject(SETTINGS_SERVICE);
32+
const user = inject(USER);
3133
3234
const stacks = $derived(stackService.stacks(projectId));
3335
const permissionRequests = $derived(claudeCodeService.permissionRequests({ projectId }));
@@ -159,7 +161,12 @@
159161
>
160162
{#snippet children([events, permissionRequests], { projectId: _projectId })}
161163
{#each formatMessages(events, permissionRequests) as message}
162-
<CodegenClaudeMessage {message} {onApproval} {onRejection} />
164+
<CodegenClaudeMessage
165+
{message}
166+
{onApproval}
167+
{onRejection}
168+
userAvatarUrl={$user?.picture}
169+
/>
163170
{/each}
164171
{@const lastUserMessageSent = lastUserMessageSentAt(events)}
165172
{#if currentStatus(events) === 'running' && lastUserMessageSent}

0 commit comments

Comments
 (0)