feat: add avatar support for agent identity

- Add avatar field to IdentityConfig type
- Add avatar parsing in AgentIdentity from IDENTITY.md
- Add renderAvatar support for image avatars in webchat
- Add CSS styling for image avatars

Users can now configure a custom avatar for the assistant in the webchat
by setting 'identity.avatar' in the agent config or adding 'Avatar: path'
to IDENTITY.md. The avatar can be served from the assets folder.

Closes #TBD
This commit is contained in:
Dave Lauer
2026-01-20 14:45:58 -05:00
committed by Peter Steinberger
parent 0c3d46cb72
commit 754481716e
4 changed files with 18 additions and 2 deletions

View File

@@ -89,6 +89,12 @@
color: rgba(134, 142, 150, 1);
}
/* Image avatar support */
img.chat-avatar {
object-fit: cover;
object-position: center;
}
/* Minimal Bubble Design - dynamic width based on content */
.chat-bubble {
position: relative;

View File

@@ -105,7 +105,7 @@ export function renderMessageGroup(
`;
}
function renderAvatar(role: string) {
function renderAvatar(role: string, avatarUrl?: string) {
const normalized = normalizeRoleForGrouping(role);
const initial =
normalized === "user"
@@ -123,6 +123,12 @@ function renderAvatar(role: string) {
: normalized === "tool"
? "tool"
: "other";
// If avatar URL is provided for assistant, show image
if (avatarUrl && normalized === "assistant") {
return html`<img class="chat-avatar ${className}" src="${avatarUrl}" alt="Assistant" />`;
}
return html`<div class="chat-avatar ${className}">${initial}</div>`;
}