feat: let the messages I send appear immediately in the chat window and remove rewrite configuration from nginx proxy (#86)

* feat: remove rewrite configuration from nginx proxy

* feat: let the messages I send appear immediately in the chat window
This commit is contained in:
balibabu
2024-02-29 14:26:59 +08:00
committed by GitHub
parent 0429107e80
commit 14633df880
2 changed files with 117 additions and 70 deletions

View File

@ -10,10 +10,8 @@ import reactStringReplace from 'react-string-replace';
import {
useFetchConversationOnMount,
useGetFileIcon,
useScrollToBottom,
useSendMessage,
} from '../hooks';
import { IClientConversation } from '../interface';
import Image from '@/components/image';
import NewDocumentLink from '@/components/new-document-link';
@ -187,17 +185,24 @@ const MessageItem = ({
const ChatContainer = () => {
const [value, setValue] = useState('');
const conversation: IClientConversation = useFetchConversationOnMount();
const {
ref,
currentConversation: conversation,
addNewestConversation,
} = useFetchConversationOnMount();
const { sendMessage } = useSendMessage();
const loading = useOneNamespaceEffectsLoading('chatModel', [
'completeConversation',
]);
const ref = useScrollToBottom();
useGetFileIcon();
const handlePressEnter = () => {
setValue('');
sendMessage(value);
if (!loading) {
setValue('');
addNewestConversation(value);
sendMessage(value);
}
};
const handleInputChange: ChangeEventHandler<HTMLInputElement> = (e) => {