Skip to content

Commit

Permalink
Add null check for actions in chat guide component
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Feb 8, 2025
1 parent b773842 commit 054548c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/xgen/components/chat/guide/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,18 @@ const Index = (props: IProps) => {
{text && <Text assistant_id={assistant_id} chat_id={chat_id} text={text} />}
</div>
<div className={styles.actions}>
{actions.map((action: ButtonProps, index: number) => (
<button
key={index}
className={clsx(styles.button, styles[action.style || 'default'])}
onClick={() => runAction(action)}
>
{action.icon && <Icon name={action.icon} size={16} />}
<span>{action.title || 'Cancel'}</span>
</button>
))}
{actions &&
actions.length > 0 &&
actions.map((action: ButtonProps, index: number) => (
<button
key={index}
className={clsx(styles.button, styles[action.style || 'default'])}
onClick={() => runAction(action)}
>
{action.icon && <Icon name={action.icon} size={16} />}
<span>{action.title || 'Cancel'}</span>
</button>
))}
</div>
</div>
)
Expand Down

0 comments on commit 054548c

Please sign in to comment.