Files
supersonic/webapp/packages/chat-sdk/src/Chat/components/AgentTip/index.tsx

49 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import LeftAvatar from '../CopilotAvatar';
import Message from '../Message';
import styles from './style.module.less';
import { AgentType } from '../../type';
import { isMobile } from '../../../utils/utils';
type Props = {
currentAgent?: AgentType;
onSendMsg: (value: string) => void;
};
const AgentTip: React.FC<Props> = ({ currentAgent, onSendMsg }) => {
if (!currentAgent) {
return null;
}
return (
<div className={styles.agentTip}>
{!isMobile && <LeftAvatar />}
<Message position="left" bubbleClassName={styles.agentTipMsg}>
<div className={styles.title}>
{currentAgent.name}
</div>
<div className={styles.content}>
<div className={styles.examples}>
{currentAgent.examples?.length > 0 ? (
currentAgent.examples.map(example => (
<div
key={example}
className={styles.example}
onClick={() => {
onSendMsg(example);
}}
>
{example}
</div>
))
) : (
<div className={styles.example}>{currentAgent.description}</div>
)}
</div>
</div>
</Message>
</div>
);
};
export default AgentTip;