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(onboarding): add preset agent naming suggestions (#13931)

Innei6b6915d1477d
diff --git a/locales/en-US/onboarding.json b/locales/en-US/onboarding.json
index 521fd9f17ad..5f79aebbb7f 100644
--- a/locales/en-US/onboarding.json
+++ b/locales/en-US/onboarding.json
@@ -51,6 +51,26 @@
"agent.welcome.sentence.1": "So nice to meet you! Let’s get to know each other.",
"agent.welcome.sentence.2": "What kind of partner do you want me to be?",
"agent.welcome.sentence.3": "First, give me a name :)",
+ "agent.welcome.suggestion.items.1.name": "Lumi",
+ "agent.welcome.suggestion.items.1.prompt": "Let's call you Lumi first. Warm, thoughtful, and a little dreamy.",
+ "agent.welcome.suggestion.items.2.name": "Atlas",
+ "agent.welcome.suggestion.items.2.prompt": "How about Atlas? Steady, reliable, and good at getting things done.",
+ "agent.welcome.suggestion.items.3.name": "Momo",
+ "agent.welcome.suggestion.items.3.prompt": "Maybe Momo. Lighthearted, approachable, and easy to talk to.",
+ "agent.welcome.suggestion.items.4.name": "Nova",
+ "agent.welcome.suggestion.items.4.prompt": "Let's go with Nova. Sharp, imaginative, and full of fresh ideas.",
+ "agent.welcome.suggestion.items.5.name": "Milo",
+ "agent.welcome.suggestion.items.5.prompt": "Milo sounds good. Friendly, quick-minded, and quietly capable.",
+ "agent.welcome.suggestion.items.6.name": "Aster",
+ "agent.welcome.suggestion.items.6.prompt": "How about Aster? Clean, direct, and calm under pressure.",
+ "agent.welcome.suggestion.items.7.name": "Pixel",
+ "agent.welcome.suggestion.items.7.prompt": "Call you Pixel? Curious, product-minded, and detail-aware.",
+ "agent.welcome.suggestion.items.8.name": "Echo",
+ "agent.welcome.suggestion.items.8.prompt": "Maybe Echo. Patient, attentive, and always listening closely.",
+ "agent.welcome.suggestion.items.9.name": "Orbit",
+ "agent.welcome.suggestion.items.9.prompt": "Let's try Orbit. Feels like a long-term companion who grows with me.",
+ "agent.welcome.suggestion.switch": "Try another set",
+ "agent.welcome.suggestion.title": "Need a starting point? Pick one and we can refine it later.",
"agent.wrapUp.action": "I think we're good",
"agent.wrapUp.confirm.cancel": "Keep chatting",
"agent.wrapUp.confirm.content": "I'll save what we've covered so far. You can always come back and chat more later.",
diff --git a/locales/zh-CN/onboarding.json b/locales/zh-CN/onboarding.json
index 33f37d16265..0811222a57a 100644
--- a/locales/zh-CN/onboarding.json
+++ b/locales/zh-CN/onboarding.json
@@ -51,6 +51,26 @@
"agent.welcome.sentence.1": "很高兴认识你!让我们互相了解一下吧。",
"agent.welcome.sentence.2": "你希望我成为怎样的伙伴?",
"agent.welcome.sentence.3": "先给我起个名字吧 :)",
+ "agent.welcome.suggestion.items.1.name": "Lumi",
+ "agent.welcome.suggestion.items.1.prompt": "先叫你 Lumi 吧,温柔一点、细腻一点,像个月光系搭档。",
+ "agent.welcome.suggestion.items.2.name": "Atlas",
+ "agent.welcome.suggestion.items.2.prompt": "叫你 Atlas,稳一点、可靠一点,像个能扛事的伙伴。",
+ "agent.welcome.suggestion.items.3.name": "Momo",
+ "agent.welcome.suggestion.items.3.prompt": "先叫你 Momo,轻松一点、好亲近一点,聊天没有压力。",
+ "agent.welcome.suggestion.items.4.name": "Nova",
+ "agent.welcome.suggestion.items.4.prompt": "叫你 Nova 吧,希望你点子多一点、脑洞大一点。",
+ "agent.welcome.suggestion.items.5.name": "Milo",
+ "agent.welcome.suggestion.items.5.prompt": "叫你 Milo,聪明一点、机灵一点,但别太有距离感。",
+ "agent.welcome.suggestion.items.6.name": "Aster",
+ "agent.welcome.suggestion.items.6.prompt": "叫你 Aster,简洁直接一点,做事干净利落。",
+ "agent.welcome.suggestion.items.7.name": "Pixel",
+ "agent.welcome.suggestion.items.7.prompt": "叫你 Pixel,偏产品脑一点,注意细节,也有创造力。",
+ "agent.welcome.suggestion.items.8.name": "Echo",
+ "agent.welcome.suggestion.items.8.prompt": "叫你 Echo,耐心一点、会倾听一点,像长期搭档。",
+ "agent.welcome.suggestion.items.9.name": "Orbit",
+ "agent.welcome.suggestion.items.9.prompt": "叫你 Orbit 吧,感觉像能陪我长期一起成长的伙伴。",
+ "agent.welcome.suggestion.switch": "换一组",
+ "agent.welcome.suggestion.title": "一下子没灵感?先挑一个起点。",
"agent.wrapUp.action": "先这样吧",
"agent.wrapUp.confirm.cancel": "再聊聊",
"agent.wrapUp.confirm.content": "目前了解到的信息我都会保存,你随时都可以回来继续和我聊。",
diff --git a/src/features/Onboarding/Agent/NameSuggestions.test.tsx b/src/features/Onboarding/Agent/NameSuggestions.test.tsx
new file mode 100644
index 00000000000..db85c2d2e2f
--- /dev/null
+++ b/src/features/Onboarding/Agent/NameSuggestions.test.tsx
@@ -0,0 +1,72 @@
+import { fireEvent, render, screen } from '@testing-library/react';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+import NameSuggestions from './NameSuggestions';
+
+const translations: Record<string, string> = {
+ 'agent.welcome.suggestion.items.1.name': 'Lumi',
+ 'agent.welcome.suggestion.items.1.prompt': '叫你 Lumi 吧,温柔一点。',
+ 'agent.welcome.suggestion.items.2.name': 'Atlas',
+ 'agent.welcome.suggestion.items.2.prompt': '叫你 Atlas,稳一点。',
+ 'agent.welcome.suggestion.items.3.name': 'Momo',
+ 'agent.welcome.suggestion.items.3.prompt': '先叫你 Momo,轻松一点。',
+ 'agent.welcome.suggestion.items.4.name': 'Nova',
+ 'agent.welcome.suggestion.items.4.prompt': '叫你 Nova,想法大胆一点。',
+ 'agent.welcome.suggestion.items.5.name': 'Milo',
+ 'agent.welcome.suggestion.items.5.prompt': '叫你 Milo,像个聪明助手。',
+ 'agent.welcome.suggestion.items.6.name': 'Aster',
+ 'agent.welcome.suggestion.items.6.prompt': '叫你 Aster,简洁直接。',
+ 'agent.welcome.suggestion.items.7.name': 'Pixel',
+ 'agent.welcome.suggestion.items.7.prompt': '叫你 Pixel,偏产品一点。',
+ 'agent.welcome.suggestion.items.8.name': 'Echo',
+ 'agent.welcome.suggestion.items.8.prompt': '叫你 Echo,像个耐心搭档。',
+ 'agent.welcome.suggestion.items.9.name': 'Orbit',
+ 'agent.welcome.suggestion.items.9.prompt': '叫你 Orbit,长期陪我一起成长。',
+ 'agent.welcome.suggestion.switch': '换一组',
+ 'agent.welcome.suggestion.title': '没有灵感?先选一个起点。',
+};
+
+const sendMessage = vi.fn();
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({
+ t: (key: string) => translations[key] ?? key,
+ }),
+}));
+
+vi.mock('@/features/Conversation', () => ({
+ useConversationStore: (selector: (state: { sendMessage: unknown }) => unknown) =>
+ selector({
+ sendMessage,
+ }),
+}));
+
+describe('NameSuggestions', () => {
+ afterEach(() => {
+ vi.restoreAllMocks();
+ sendMessage.mockClear();
+ });
+
+ it('sends the selected preset prompt immediately', () => {
+ vi.spyOn(Math, 'random').mockReturnValue(0);
+
+ render(<NameSuggestions />);
+
+ fireEvent.click(screen.getByText('Lumi'));
+
+ expect(sendMessage).toHaveBeenCalledWith({ message: '叫你 Lumi 吧,温柔一点。 🌙' });
+ });
+
+ it('switches to another preset group when refreshed', () => {
+ vi.spyOn(Math, 'random').mockReturnValue(0);
+
+ render(<NameSuggestions />);
+
+ expect(screen.getByText('Lumi')).toBeInTheDocument();
+
+ fireEvent.click(screen.getByText('换一组'));
+
+ expect(screen.getByText('Nova')).toBeInTheDocument();
+ expect(screen.queryByText('Lumi')).not.toBeInTheDocument();
+ });
+});
diff --git a/src/features/Onboarding/Agent/NameSuggestions.tsx b/src/features/Onboarding/Agent/NameSuggestions.tsx
new file mode 100644
index 00000000000..053797a6197
--- /dev/null
+++ b/src/features/Onboarding/Agent/NameSuggestions.tsx
@@ -0,0 +1,161 @@
+import { ActionIcon, Block, Flexbox, FluentEmoji, Text } from '@lobehub/ui';
+import { cssVar } from 'antd-style';
+import { RefreshCw } from 'lucide-react';
+import { memo, useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useConversationStore } from '@/features/Conversation';
+
+interface SuggestionItem {
+ emoji: string;
+ id: string;
+ nameKey: string;
+ promptKey: string;
+}
+
+const suggestionGroups = [
+ [
+ {
+ emoji: '🌙',
+ id: 'lumi',
+ nameKey: 'agent.welcome.suggestion.items.1.name',
+ promptKey: 'agent.welcome.suggestion.items.1.prompt',
+ },
+ {
+ emoji: '🧭',
+ id: 'atlas',
+ nameKey: 'agent.welcome.suggestion.items.2.name',
+ promptKey: 'agent.welcome.suggestion.items.2.prompt',
+ },
+ {
+ emoji: '🍡',
+ id: 'momo',
+ nameKey: 'agent.welcome.suggestion.items.3.name',
+ promptKey: 'agent.welcome.suggestion.items.3.prompt',
+ },
+ ],
+ [
+ {
+ emoji: '🌌',
+ id: 'nova',
+ nameKey: 'agent.welcome.suggestion.items.4.name',
+ promptKey: 'agent.welcome.suggestion.items.4.prompt',
+ },
+ {
+ emoji: '🪄',
+ id: 'milo',
+ nameKey: 'agent.welcome.suggestion.items.5.name',
+ promptKey: 'agent.welcome.suggestion.items.5.prompt',
+ },
+ {
+ emoji: '🌿',
+ id: 'aster',
+ nameKey: 'agent.welcome.suggestion.items.6.name',
+ promptKey: 'agent.welcome.suggestion.items.6.prompt',
+ },
+ ],
+ [
+ {
+ emoji: '🧩',
+ id: 'pixel',
+ nameKey: 'agent.welcome.suggestion.items.7.name',
+ promptKey: 'agent.welcome.suggestion.items.7.prompt',
+ },
+ {
+ emoji: '🎧',
+ id: 'echo',
+ nameKey: 'agent.welcome.suggestion.items.8.name',
+ promptKey: 'agent.welcome.suggestion.items.8.prompt',
+ },
+ {
+ emoji: '🪐',
+ id: 'orbit',
+ nameKey: 'agent.welcome.suggestion.items.9.name',
+ promptKey: 'agent.welcome.suggestion.items.9.prompt',
+ },
+ ],
+] as const satisfies SuggestionItem[][];
+
+const getRandomGroupIndex = (currentIndex?: number) => {
+ const nextIndex = Math.floor(Math.random() * suggestionGroups.length);
+
+ if (currentIndex === undefined || suggestionGroups.length <= 1 || nextIndex !== currentIndex) {
+ return nextIndex;
+ }
+
+ return (nextIndex + 1) % suggestionGroups.length;
+};
+
+const NameSuggestions = memo(() => {
+ const { t } = useTranslation('onboarding');
+ const sendMessage = useConversationStore((s) => s.sendMessage);
+ const [groupIndex, setGroupIndex] = useState(() => getRandomGroupIndex());
+
+ const handleRefresh = useCallback(() => {
+ setGroupIndex((current) => getRandomGroupIndex(current));
+ }, []);
+
+ const handleSelect = useCallback(
+ async (prompt: string, emoji: string) => {
+ await sendMessage({ message: `${prompt} ${emoji}` });
+ },
+ [sendMessage],
+ );
+
+ return (
+ <Flexbox gap={12}>
+ <Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>
+ <Text type={'secondary'}>{t('agent.welcome.suggestion.title')}</Text>
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={4}
+ style={{ cursor: 'pointer' }}
+ onClick={handleRefresh}
+ >
+ <ActionIcon icon={RefreshCw} size={'small'} />
+ <Text fontSize={12} type={'secondary'}>
+ {t('agent.welcome.suggestion.switch')}
+ </Text>
+ </Flexbox>
+ </Flexbox>
+ <Flexbox
+ gap={12}
+ style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))' }}
+ >
+ {suggestionGroups[groupIndex].map((item) => {
+ const prompt = t(item.promptKey);
+
+ return (
+ <Block
+ clickable
+ shadow
+ key={item.id}
+ variant={'outlined'}
+ style={{
+ borderRadius: cssVar.borderRadiusLG,
+ boxShadow: '0 8px 16px -8px rgba(0,0,0,0.06)',
+ cursor: 'pointer',
+ }}
+ onClick={() => handleSelect(prompt, item.emoji)}
+ >
+ <Flexbox gap={8} padding={16}>
+ <FluentEmoji emoji={item.emoji} size={24} type={'anim'} />
+ <Text fontSize={15} weight={500}>
+ {t(item.nameKey)}
+ </Text>
+ <Text fontSize={13} type={'secondary'}>
+ {prompt}
+ </Text>
+ </Flexbox>
+ </Block>
+ );
+ })}
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+NameSuggestions.displayName = 'NameSuggestions';
+
+export default NameSuggestions;
diff --git a/src/features/Onboarding/Agent/Welcome.tsx b/src/features/Onboarding/Agent/Welcome.tsx
index 8e480537d12..ac4a488012e 100644
--- a/src/features/Onboarding/Agent/Welcome.tsx
+++ b/src/features/Onboarding/Agent/Welcome.tsx
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
import LobeMessage from '@/routes/onboarding/components/LobeMessage';
+import NameSuggestions from './NameSuggestions';
import { staticStyle } from './staticStyle';
interface WelcomeProps {
@@ -82,6 +83,7 @@ const Welcome = memo<WelcomeProps>(({ content }) => {
<Markdown fontSize={16} variant={'chat'}>
{content}
</Markdown>
+ <NameSuggestions />
</Flexbox>
</>
);
diff --git a/src/locales/default/onboarding.ts b/src/locales/default/onboarding.ts
index ca42d058473..c5128daaab0 100644
--- a/src/locales/default/onboarding.ts
+++ b/src/locales/default/onboarding.ts
@@ -55,6 +55,35 @@ export default {
'agent.welcome.guide.knowYou.title': 'Get to Know You',
'agent.welcome.guide.name.desc': 'Give me a name so this feels more personal from the start.',
'agent.welcome.guide.name.title': 'Name Me',
+ 'agent.welcome.suggestion.items.1.name': 'Lumi',
+ 'agent.welcome.suggestion.items.1.prompt':
+ 'Let’s call you Lumi first. Warm, thoughtful, and a little dreamy.',
+ 'agent.welcome.suggestion.items.2.name': 'Atlas',
+ 'agent.welcome.suggestion.items.2.prompt':
+ 'How about Atlas? Steady, reliable, and good at getting things done.',
+ 'agent.welcome.suggestion.items.3.name': 'Momo',
+ 'agent.welcome.suggestion.items.3.prompt':
+ 'Maybe Momo. Lighthearted, approachable, and easy to talk to.',
+ 'agent.welcome.suggestion.items.4.name': 'Nova',
+ 'agent.welcome.suggestion.items.4.prompt':
+ 'Let’s go with Nova. Sharp, imaginative, and full of fresh ideas.',
+ 'agent.welcome.suggestion.items.5.name': 'Milo',
+ 'agent.welcome.suggestion.items.5.prompt':
+ 'Milo sounds good. Friendly, quick-minded, and quietly capable.',
+ 'agent.welcome.suggestion.items.6.name': 'Aster',
+ 'agent.welcome.suggestion.items.6.prompt':
+ 'How about Aster? Clean, direct, and calm under pressure.',
+ 'agent.welcome.suggestion.items.7.name': 'Pixel',
+ 'agent.welcome.suggestion.items.7.prompt':
+ 'Call you Pixel? Curious, product-minded, and detail-aware.',
+ 'agent.welcome.suggestion.items.8.name': 'Echo',
+ 'agent.welcome.suggestion.items.8.prompt':
+ 'Maybe Echo. Patient, attentive, and always listening closely.',
+ 'agent.welcome.suggestion.items.9.name': 'Orbit',
+ 'agent.welcome.suggestion.items.9.prompt':
+ 'Let’s try Orbit. Feels like a long-term companion who grows with me.',
+ 'agent.welcome.suggestion.switch': 'Try another set',
+ 'agent.welcome.suggestion.title': 'Need a starting point? Pick one and we can refine it later.',
'agent.welcome.sentence.1': 'So nice to meet you! Let’s get to know each other.',
'agent.welcome.sentence.2': 'What kind of partner do you want me to be?',
'agent.welcome.sentence.3': 'First, give me a name :)',