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.

1.6 KB
Raw Blame
'use client';

import { Flexbox, Markdown, Text } from '@lobehub/ui';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';

import Avatar from '@/components/Avatar';
import { DEFAULT_INBOX_AVATAR } from '@/const/index';
import { conversationSelectors, useConversationStore } from '@/features/Conversation';
import { type SuggestMode } from '@/features/SuggestQuestions';
import { useAgentStore } from '@/store/agent';
import { agentByIdSelectors } from '@/store/agent/selectors';

import SuggestionChips from './SuggestionChips';

interface AgentBuilderWelcomeProps {
  disabled?: boolean;
  mode?: SuggestMode;
}

const AgentBuilderWelcome = memo<AgentBuilderWelcomeProps>(
  ({ disabled, mode = 'agentBuilder' }) => {
    const { t } = useTranslation('chat');
    const agentId = useConversationStore(conversationSelectors.agentId);
    const agent = useAgentStore(agentByIdSelectors.getAgentConfigById(agentId));

    return (
      <>
        <Flexbox flex={1} />
        <Flexbox
          gap={12}
          width={'100%'}
          style={{
            paddingBottom: 16,
          }}
        >
          <Avatar avatar={agent?.avatar || DEFAULT_INBOX_AVATAR} shape={'square'} size={78} />
          <Text fontSize={24} weight={'bold'}>
            {t('agentBuilder.title')}
          </Text>
          <Markdown fontSize={14} variant={'chat'}>
            {t('agentBuilder.welcome')}
          </Markdown>
          <SuggestionChips builderAgentId={agentId} count={3} disabled={disabled} mode={mode} />
        </Flexbox>
      </>
    );
  },
);

export default AgentBuilderWelcome;