Skip to content

Commit

Permalink
🚩 feat: update some way
Browse files Browse the repository at this point in the history
  • Loading branch information
ONLY-yours committed Jul 1, 2024
1 parent 47e1b34 commit 1de3d69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
18 changes: 6 additions & 12 deletions src/ProChat/container/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { ProInputArea, ProInputAreaProps } from '@ant-design/pro-chat';
import { ConfigProvider } from 'antd';
import ChatList from '../components/ChatList';
import ChatScrollAnchor from '../components/ScrollAnchor';
import { useStore } from '../store';
import useProChatLocale from '../hooks/useProChatLocale';
import { useStore } from '../store';
import { useOverrideStyles } from './OverrideStyle';
import { ProChatChatReference } from './StoreUpdater';
import { ProChatProps } from './index';
Expand Down Expand Up @@ -102,15 +102,7 @@ const App = memo<ConversationProps>(
const [height, setHeight] = useState('100%' as string | number);
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const { localeObject } = useProChatLocale();
const [sendMessage, isLoading, placeholder, inputAreaProps, clearMessage, stopGenerateMessage] =
useStore((s) => [
s.sendMessage,
!!s.chatLoadingId,
s.placeholder,
s.inputAreaProps,
s.clearMessage,
s.stopGenerateMessage,
]);
const [sendMessage, clearMessage] = useStore((s) => [s.sendMessage, s.clearMessage]);

useEffect(() => {
// 保证 ref 永远存在
Expand Down Expand Up @@ -186,10 +178,12 @@ const App = memo<ConversationProps>(
inputRender={inputRender}
sendMessage={sendMessage}
sendShortcutKey="enter"
extra={['image', 'audio']}
clearMessage={clearMessage}
stopGenerateMessage={function (): void {
throw new Error('Function not implemented.');
} } isLoading={false} />
}}
isLoading={false}
/>
}
</div>
)}
Expand Down
4 changes: 1 addition & 3 deletions src/ProInputArea/components/ControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ActionIcon from '@/ActionIcon';
import useProChatLocale from '@/ProChat/hooks/useProChatLocale';
import { ConfigProvider, Popconfirm } from 'antd';
import { createStyles, cx } from 'antd-style';
import { Globe, RotateCw, Trash2 } from 'lucide-react';
import { Trash2 } from 'lucide-react';
import { Flexbox } from 'react-layout-kit';
// import { useStore } from '../ProChat/store';

Expand Down Expand Up @@ -41,8 +41,6 @@ export const ActionBar = ({
>
<ActionIcon title={localeObject.clearCurrentDialogue} icon={Trash2} />
</Popconfirm>,
<ActionIcon key={'regenerate'} title={localeObject.regenerate} icon={RotateCw} />,
<ActionIcon key={'connectNetwork'} title={localeObject.connectNetwork} icon={Globe} />,
];

return (
Expand Down
2 changes: 1 addition & 1 deletion src/ProInputArea/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export const ProInputArea = ({
<Flexbox gap={8} padding={16} className={cx(styles.container, `${prefixClass}`, className)}>
<Flexbox horizontal justify="space-between">
<ExtraModel className={`${prefixClass}-extra`} extra={extra} />
<ControlPanel className={`${prefixClass}-action-bar`} />
<ControlPanel className={`${prefixClass}-action-bar`} clearMessage={clearMessage} />
</Flexbox>
<Flexbox
horizontal
Expand Down

0 comments on commit 1de3d69

Please sign in to comment.