Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(agent): add style presets to profile artwork generation (#17986)

Arvin Xucb393218e64f
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 151803d6f1c..66b3a365727 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -694,6 +694,13 @@
"settingAgent.artwork.generatingHint": "This usually takes about 60 seconds. You can keep editing while it finishes.",
"settingAgent.artwork.retry": "Try again",
"settingAgent.artwork.sizeExceeded": "Image must be smaller than 1 MB",
+ "settingAgent.artwork.style.clay": "3D Clay",
+ "settingAgent.artwork.style.editorial": "Editorial Illustration",
+ "settingAgent.artwork.style.geometric": "Flat Geometric",
+ "settingAgent.artwork.style.photographic": "Minimal Photography",
+ "settingAgent.artwork.style.riso": "Retro Print",
+ "settingAgent.artwork.style.watercolor": "Watercolor",
+ "settingAgent.artwork.styleMenu": "Generation style",
"settingAgent.artwork.uploadFailed": "Could not upload the image. Try again.",
"settingAgent.avatar.sizeExceeded": "Image size exceeds 1MB limit, please choose a smaller image",
"settingAgent.avatar.title": "Avatar",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index 1ce5e79d531..aa33eace8e5 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -694,6 +694,13 @@
"settingAgent.artwork.generatingHint": "通常需要约 60 秒,生成期间可以继续编辑其他内容",
"settingAgent.artwork.retry": "重试",
"settingAgent.artwork.sizeExceeded": "图片大小不能超过 1 MB",
+ "settingAgent.artwork.style.clay": "3D 黏土",
+ "settingAgent.artwork.style.editorial": "编辑插画",
+ "settingAgent.artwork.style.geometric": "扁平几何",
+ "settingAgent.artwork.style.photographic": "极简摄影",
+ "settingAgent.artwork.style.riso": "复古版画",
+ "settingAgent.artwork.style.watercolor": "水彩手绘",
+ "settingAgent.artwork.styleMenu": "生成风格",
"settingAgent.artwork.uploadFailed": "暂时无法上传图片,请重试",
"settingAgent.avatar.sizeExceeded": "图片大小超过 1MB 限制,请选择更小的图片",
"settingAgent.avatar.title": "助理头像",
diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.ts
index ffd50e7ff72..cd94777d222 100644
--- a/packages/locales/src/default/setting.ts
+++ b/packages/locales/src/default/setting.ts
@@ -752,6 +752,13 @@ export default {
'This usually takes about 60 seconds. You can keep editing while it finishes.',
'settingAgent.artwork.retry': 'Try again',
'settingAgent.artwork.sizeExceeded': 'Image must be smaller than 1 MB',
+ 'settingAgent.artwork.style.clay': '3D Clay',
+ 'settingAgent.artwork.style.editorial': 'Editorial Illustration',
+ 'settingAgent.artwork.style.geometric': 'Flat Geometric',
+ 'settingAgent.artwork.style.photographic': 'Minimal Photography',
+ 'settingAgent.artwork.style.riso': 'Retro Print',
+ 'settingAgent.artwork.style.watercolor': 'Watercolor',
+ 'settingAgent.artwork.styleMenu': 'Generation style',
'settingAgent.artwork.uploadFailed': 'Could not upload the image. Try again.',
'settingAgent.backgroundColor.title': 'Background Color',
'settingAgent.description.desc': 'A brief introduction to your agent, not for character setting',
diff --git a/packages/prompts/src/prompts/agentArtwork/index.test.ts b/packages/prompts/src/prompts/agentArtwork/index.test.ts
index bf0493d3f7b..65d14e94999 100644
--- a/packages/prompts/src/prompts/agentArtwork/index.test.ts
+++ b/packages/prompts/src/prompts/agentArtwork/index.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { buildAgentArtworkPrompt } from './index';
+import { AGENT_ARTWORK_STYLES, buildAgentArtworkPrompt } from './index';
describe('buildAgentArtworkPrompt', () => {
it('injects escaped Agent identity and description into the avatar prompt', () => {
@@ -53,4 +53,52 @@ describe('buildAgentArtworkPrompt', () => {
expect(prompt).toContain('attached existing profile background as the visual source of truth');
expect(prompt).toContain('same identity system');
});
+
+ it('defaults to the editorial style direction', () => {
+ const prompt = buildAgentArtworkPrompt({ id: 'agent-1', kind: 'avatar' });
+
+ expect(prompt).toContain('polished editorial illustration');
+ });
+
+ it('renders a distinct direction for every style preset', () => {
+ const prompts = AGENT_ARTWORK_STYLES.map((style) =>
+ buildAgentArtworkPrompt({ id: 'agent-1', kind: 'background', style }),
+ );
+
+ expect(new Set(prompts).size).toBe(AGENT_ARTWORK_STYLES.length);
+ expect(prompts.find((p) => p.includes('watercolor'))).toBeTruthy();
+ expect(prompts.find((p) => p.includes('risograph'))).toBeTruthy();
+ });
+
+ it('applies the chosen style to both avatar and background prompts', () => {
+ const avatar = buildAgentArtworkPrompt({ id: 'agent-1', kind: 'avatar', style: 'clay' });
+ const background = buildAgentArtworkPrompt({
+ id: 'agent-1',
+ kind: 'background',
+ style: 'clay',
+ });
+
+ expect(avatar).toContain('clay-style scene');
+ expect(background).toContain('clay-style scene');
+ });
+
+ it('steers the motif away from generic technology clichés in every prompt', () => {
+ for (const kind of ['avatar', 'background'] as const) {
+ const prompt = buildAgentArtworkPrompt({ id: 'agent-1', kind });
+
+ expect(prompt).toContain('Avoid generic AI and technology clichés');
+ }
+ });
+
+ it('keeps the style direction authoritative over the reference image style', () => {
+ const prompt = buildAgentArtworkPrompt({
+ id: 'designer',
+ kind: 'background',
+ referenceImageUrl: 'https://example.com/avatar.png',
+ style: 'watercolor',
+ });
+
+ expect(prompt).toContain('hand-painted watercolor');
+ expect(prompt).not.toContain('illustration style');
+ });
});
diff --git a/packages/prompts/src/prompts/agentArtwork/index.ts b/packages/prompts/src/prompts/agentArtwork/index.ts
index 8b4e9c867f9..8706c3ab90a 100644
--- a/packages/prompts/src/prompts/agentArtwork/index.ts
+++ b/packages/prompts/src/prompts/agentArtwork/index.ts
@@ -2,12 +2,47 @@ import { escapeXmlAttr, escapeXmlContent } from '../search/xmlEscape';
export type AgentArtworkKind = 'avatar' | 'background';
+export const AGENT_ARTWORK_STYLES = [
+ 'editorial',
+ 'geometric',
+ 'clay',
+ 'watercolor',
+ 'riso',
+ 'photographic',
+] as const;
+
+export type AgentArtworkStyle = (typeof AGENT_ARTWORK_STYLES)[number];
+
+export const DEFAULT_AGENT_ARTWORK_STYLE: AgentArtworkStyle = 'editorial';
+
+const STYLE_DIRECTIONS: Record<AgentArtworkStyle, string> = {
+ clay: 'Render it as a soft 3D clay-style scene with rounded forms, matte materials, gentle studio lighting, and warm pastel colors.',
+ editorial:
+ 'Render it as polished editorial illustration with a calm premium color palette and high contrast.',
+ geometric:
+ 'Render it as flat geometric illustration built from bold simple shapes, crisp edges, and a confident limited palette in the spirit of mid-century poster design.',
+ photographic:
+ 'Render it as a minimalist still-life photograph of tangible objects and materials with soft natural light and a restrained color palette.',
+ riso: 'Render it as a retro risograph print with two or three flat ink colors, visible grain, slight misregistration, and bold graphic shapes.',
+ watercolor:
+ 'Render it as a hand-painted watercolor piece with visible paper texture, soft pigment washes, and loose organic edges.',
+};
+
+/**
+ * Image models collapse "AI agent" semantics into the same starry-space /
+ * particle / circuit imagery by default, so every profile ends up looking
+ * alike. Steering the motif toward the agent's own domain is what keeps the
+ * style presets visually distinct from each other.
+ */
+const MOTIF_DIRECTION = `Ground the imagery in the agent's specific domain and personality. Avoid generic AI and technology clichés — starry space scenes, glowing particles, circuit boards, neural-network lines, holographic grids — unless the agent's subject matter is explicitly about them.`;
+
export interface AgentArtworkPromptInput {
description?: string | null;
id: string;
kind: AgentArtworkKind;
name?: string | null;
referenceImageUrl?: string | null;
+ style?: AgentArtworkStyle | null;
systemRole?: string | null;
title?: string | null;
}
@@ -40,26 +75,30 @@ export const buildAgentArtworkPrompt = (input: AgentArtworkPromptInput): string
systemRole: input.systemRole?.slice(0, 1200),
title: input.title,
});
+ const styleDirection = STYLE_DIRECTIONS[input.style ?? DEFAULT_AGENT_ARTWORK_STYLE];
if (input.kind === 'avatar') {
+ // The reference paragraph preserves palette / materials / motifs but not the
+ // rendering style itself — the user may regenerate with a different preset,
+ // and the style direction above must stay authoritative.
const referenceDirection = input.referenceImageUrl?.trim()
- ? `\n\nUse the attached existing profile background as the visual source of truth. Preserve its dominant color palette, illustration style, materials, lighting, atmosphere, and recurring motifs while distilling them into a single avatar subject. The avatar must feel designed as part of the same identity system, not merely depict a related topic.`
+ ? `\n\nUse the attached existing profile background as the visual source of truth. Preserve its dominant color palette, materials, lighting, atmosphere, and recurring motifs while distilling them into a single avatar subject. The avatar must feel designed as part of the same identity system, not merely depict a related topic.`
: '';
return `Create a distinctive square profile icon for the AI agent described below.
${agentContext}
-Translate the agent's identity, purpose, and personality into one coherent visual concept. Use a single centered subject, a simple silhouette, polished editorial illustration, calm colors, and high contrast. Fill the entire square canvas edge to edge with the artwork: use a full-bleed composition with no white background, no white matte, no empty margin, no padding, no frame, and no border. No words, no letters, and no logo. The result must remain clear as a small app avatar.${referenceDirection}`;
+Translate the agent's identity, purpose, and personality into one coherent visual concept. Use a single centered subject with a simple silhouette. ${styleDirection} ${MOTIF_DIRECTION} Fill the entire square canvas edge to edge with the artwork: use a full-bleed composition with no white background, no white matte, no empty margin, no padding, no frame, and no border. No words, no letters, and no logo. The result must remain clear as a small app avatar.${referenceDirection}`;
}
const referenceDirection = input.referenceImageUrl?.trim()
- ? `\n\nUse the attached existing avatar as the visual source of truth. Preserve its dominant color palette, illustration style, materials, lighting, atmosphere, and recurring motifs, then expand that visual world into a wide environment. Do not enlarge, repeat, or place the avatar itself in the cover. The cover and avatar must feel designed as one identity system.`
+ ? `\n\nUse the attached existing avatar as the visual source of truth. Preserve its dominant color palette, materials, lighting, atmosphere, and recurring motifs, then expand that visual world into a wide environment. Do not enlarge, repeat, or place the avatar itself in the cover. The cover and avatar must feel designed as one identity system.`
: '';
return `Create a wide cinematic profile cover for the AI agent described below.
${agentContext}
-Translate the agent's identity, purpose, and personality into an abstract editorial environment. Use a calm premium visual language, generous negative space, and a balanced composition. Do not use a person portrait, words, letters, a logo, or a border.${referenceDirection}`;
+Translate the agent's identity, purpose, and personality into an abstract environment. ${styleDirection} ${MOTIF_DIRECTION} Use generous negative space and a balanced composition. Do not use a person portrait, words, letters, a logo, or a border.${referenceDirection}`;
};
diff --git a/src/features/AgentProfileArtwork/index.tsx b/src/features/AgentProfileArtwork/index.tsx
index 733912d27a1..23ed272df5c 100644
--- a/src/features/AgentProfileArtwork/index.tsx
+++ b/src/features/AgentProfileArtwork/index.tsx
@@ -1,9 +1,14 @@
'use client';
+import {
+ AGENT_ARTWORK_STYLES,
+ type AgentArtworkStyle,
+ DEFAULT_AGENT_ARTWORK_STYLE,
+} from '@lobechat/prompts';
import { ActionIcon, Alert, Avatar, Center, Flexbox, Icon, Text, Tooltip } from '@lobehub/ui';
-import { Button, toast } from '@lobehub/ui/base-ui';
+import { Button, type DropdownItem, DropdownMenu, toast } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
-import { ImageIcon, Trash2, UploadIcon, WandSparkles } from 'lucide-react';
+import { Check, ImageIcon, MoreHorizontal, Trash2, UploadIcon, WandSparkles } from 'lucide-react';
import { memo, useCallback, useId, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -52,10 +57,11 @@ const styles = createStaticStyles(({ css }) => ({
overflow: hidden;
+ /* The cover bleeds flush to the pane edges, so rounded corners would leave
+ bare notches in the two narrow strips where it meets them. */
width: calc(100% + 32px);
height: 160px;
margin-inline: -16px;
- border-radius: ${cssVar.borderRadiusLG};
background: transparent;
background-position: center;
@@ -100,9 +106,6 @@ const styles = createStaticStyles(({ css }) => ({
emptyBackgroundHint: css`
color: ${cssVar.colorTextSecondary};
`,
- generatedAction: css`
- width: 100%;
- `,
generatedPreview: css`
position: relative;
@@ -199,6 +202,9 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
const backgroundInputId = useId();
const [avatarUploading, setAvatarUploading] = useState(false);
const [backgroundUploading, setBackgroundUploading] = useState(false);
+ const [artworkStyle, setArtworkStyle] = useState<AgentArtworkStyle>(
+ DEFAULT_AGENT_ARTWORK_STYLE,
+ );
const generating = generation?.status === 'generating' ? generation.kind : null;
const generationError = generation?.status === 'error' ? generation.kind : null;
const backgroundGenerationActive = generation?.kind === 'background';
@@ -237,7 +243,7 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
);
const generateArtwork = useCallback(
- async (kind: 'avatar' | 'background') => {
+ async (kind: 'avatar' | 'background', style: AgentArtworkStyle) => {
if (!canEdit || !canGenerate) return;
try {
@@ -247,6 +253,7 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
kind,
name,
referenceImageUrl: kind === 'background' ? avatar : backgroundUrl,
+ style,
systemRole,
title,
});
@@ -268,6 +275,68 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
],
);
+ // The generate buttons fire directly with the remembered style; the style
+ // menu lives behind a separate "…" trigger beside them. Picking a style
+ // there also generates, and the pick is remembered for both artwork kinds
+ // so avatar and cover stay one system.
+ const buildStyleItems = useCallback(
+ (kind: 'avatar' | 'background'): DropdownItem[] =>
+ AGENT_ARTWORK_STYLES.map((style) => ({
+ icon: style === artworkStyle ? Check : undefined,
+ key: style,
+ label: t(`settingAgent.artwork.style.${style}`),
+ onClick: () => {
+ setArtworkStyle(style);
+ void generateArtwork(kind, style);
+ },
+ })),
+ [artworkStyle, generateArtwork, t],
+ );
+
+ // On the existing-cover hover bar every artwork action folds into the one
+ // "…" menu: regenerate, the style presets, and remove.
+ const buildBackgroundMenuItems = useCallback((): DropdownItem[] => {
+ const items: DropdownItem[] = [];
+
+ if (canGenerate) {
+ items.push(
+ {
+ icon: WandSparkles,
+ key: 'generate',
+ label: t('settingAgent.artwork.background.generate'),
+ onClick: () => void generateArtwork('background', artworkStyle),
+ },
+ {
+ children: buildStyleItems('background'),
+ key: 'styles',
+ label: t('settingAgent.artwork.styleMenu'),
+ type: 'group',
+ },
+ );
+ }
+
+ if (backgroundUrl) {
+ if (items.length > 0) items.push({ type: 'divider' });
+ items.push({
+ danger: true,
+ icon: Trash2,
+ key: 'remove',
+ label: t('settingAgent.artwork.background.remove'),
+ onClick: () => onBackgroundChange(null),
+ });
+ }
+
+ return items;
+ }, [
+ artworkStyle,
+ backgroundUrl,
+ buildStyleItems,
+ canGenerate,
+ generateArtwork,
+ onBackgroundChange,
+ t,
+ ]);
+
return (
<div style={{ paddingBlockEnd: 36, position: 'relative' }}>
<div
@@ -304,7 +373,7 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
<Button
icon={WandSparkles}
size={'small'}
- onClick={() => void generateArtwork('background')}
+ onClick={() => void generateArtwork('background', artworkStyle)}
>
{t('settingAgent.artwork.retry')}
</Button>
@@ -327,14 +396,23 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
{t('settingAgent.artwork.background.upload')}
</Button>
{canGenerate ? (
- <Button
- icon={WandSparkles}
- loading={generating === 'background'}
- size={'small'}
- onClick={() => void generateArtwork('background')}
- >
- {t('settingAgent.artwork.background.generate')}
- </Button>
+ <>
+ <Button
+ icon={WandSparkles}
+ loading={generating === 'background'}
+ size={'small'}
+ onClick={() => void generateArtwork('background', artworkStyle)}
+ >
+ {t('settingAgent.artwork.background.generate')}
+ </Button>
+ <DropdownMenu items={() => buildStyleItems('background')}>
+ <Button
+ aria-label={t('settingAgent.artwork.styleMenu')}
+ icon={MoreHorizontal}
+ size={'small'}
+ />
+ </DropdownMenu>
+ </>
) : null}
</Flexbox>
</Flexbox>
@@ -355,21 +433,11 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
onClick={openBackgroundFilePicker}
/>
</Tooltip>
- {canGenerate ? (
- <Tooltip title={t('settingAgent.artwork.background.generate')}>
- <ActionIcon
- glass
- icon={WandSparkles}
- loading={generating === 'background'}
- onClick={() => void generateArtwork('background')}
- />
- </Tooltip>
- ) : null}
- {backgroundUrl ? (
- <Tooltip title={t('settingAgent.artwork.background.remove')}>
- <ActionIcon glass icon={Trash2} onClick={() => onBackgroundChange(null)} />
- </Tooltip>
- ) : null}
+ <Tooltip title={t('more', { ns: 'common' })}>
+ <DropdownMenu items={() => buildBackgroundMenuItems()}>
+ <ActionIcon glass icon={MoreHorizontal} loading={generating === 'background'} />
+ </DropdownMenu>
+ </Tooltip>
</Flexbox>
) : null}
</div>
@@ -426,13 +494,21 @@ export const AgentProfileArtwork = memo<AgentProfileArtworkProps>(
) : null}
</Center>
{generating !== 'avatar' ? (
- <Button
- className={styles.generatedAction}
- icon={WandSparkles}
- onClick={() => void generateArtwork('avatar')}
- >
- {t('settingAgent.artwork.avatar.generateAction')}
- </Button>
+ <Flexbox horizontal gap={8}>
+ <Button
+ icon={WandSparkles}
+ style={{ flex: 1 }}
+ onClick={() => void generateArtwork('avatar', artworkStyle)}
+ >
+ {t('settingAgent.artwork.avatar.generateAction')}
+ </Button>
+ <DropdownMenu items={() => buildStyleItems('avatar')}>
+ <Button
+ aria-label={t('settingAgent.artwork.styleMenu')}
+ icon={MoreHorizontal}
+ />
+ </DropdownMenu>
+ </Flexbox>
) : null}
{generationError === 'avatar' ? (
<Alert