Skip to content

Commit

Permalink
🐛 fix: fix onResetMessage (#3)
Browse files Browse the repository at this point in the history
* feat: support onResetMessage funtion

* fix tets

* 修复 bug
  • Loading branch information
chenshuai2144 authored Oct 25, 2023
1 parent 4ca3bbf commit 078f277
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ProChat/components/InputArea/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const useStyles = createStyles(({ css, token }) => ({
}));

export const ActionBar = () => {
const [dispatchMessage] = useStore((s) => [s.dispatchMessage]);
const [clearMessage] = useStore((s) => [s.clearMessage]);

const { styles, theme } = useStyles();

Expand All @@ -33,7 +33,7 @@ export const ActionBar = () => {
okButtonProps={{ danger: true }}
okText={'清空会话'}
onConfirm={() => {
dispatchMessage({ type: 'resetMessages' });
clearMessage();
}}
>
<ActionIcon title={'清空当前会话'} icon={Trash2} />
Expand Down
8 changes: 7 additions & 1 deletion src/ProChat/demos/default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ export default () => {
const theme = useTheme();
return (
<div style={{ background: theme.colorBgLayout }}>
<ProChat request={'/api/chat'} config={example.config} />
<ProChat
request={'/api/chat'}
config={example.config}
onResetMessage={async () => {
console.log('数据清空');
}}
/>
</div>
);
};

0 comments on commit 078f277

Please sign in to comment.