fix: disable sending messages if both application and conversation are empty and add loading to all pages (#134)

* feat: add loading to all pages

* fix: disable sending messages if both application and conversation are empty

* feat: add chatSpin class to Spin of chat
This commit is contained in:
balibabu
2024-03-20 11:13:51 +08:00
committed by GitHub
parent d38e92aac8
commit 78727c8809
24 changed files with 629 additions and 473 deletions

View File

@ -30,6 +30,7 @@ import {
useClickDrawer,
useFetchConversationOnMount,
useGetFileIcon,
useGetSendButtonDisabled,
useSendMessage,
} from '../hooks';
@ -248,11 +249,15 @@ const ChatContainer = () => {
addNewestConversation,
removeLatestMessage,
} = useFetchConversationOnMount();
const { handleInputChange, handlePressEnter, value, loading } =
useSendMessage(conversation, addNewestConversation, removeLatestMessage);
const {
handleInputChange,
handlePressEnter,
value,
loading: sendLoading,
} = useSendMessage(conversation, addNewestConversation, removeLatestMessage);
const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } =
useClickDrawer();
const disabled = useGetSendButtonDisabled();
useGetFileIcon();
return (
@ -284,8 +289,14 @@ const ChatContainer = () => {
size="large"
placeholder="Message Resume Assistant..."
value={value}
disabled={disabled}
suffix={
<Button type="primary" onClick={handlePressEnter} loading={loading}>
<Button
type="primary"
onClick={handlePressEnter}
loading={sendLoading}
disabled={disabled}
>
Send
</Button>
}