mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 21:25:53 +08:00
Fix: type-script new change (#5159)
### What problem does this PR solve? ``` fixed type-script on MessageInput change to TextArea ``` _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
9c9f2dbe3f
commit
e2448fb6dd
@ -30,12 +30,12 @@ import get from 'lodash/get';
|
|||||||
import { Paperclip } from 'lucide-react';
|
import { Paperclip } from 'lucide-react';
|
||||||
import {
|
import {
|
||||||
ChangeEventHandler,
|
ChangeEventHandler,
|
||||||
|
KeyboardEventHandler,
|
||||||
memo,
|
memo,
|
||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
KeyboardEventHandler,
|
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import FileIcon from '../file-icon';
|
import FileIcon from '../file-icon';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
@ -64,7 +64,7 @@ interface IProps {
|
|||||||
sendDisabled: boolean;
|
sendDisabled: boolean;
|
||||||
sendLoading: boolean;
|
sendLoading: boolean;
|
||||||
onPressEnter(documentIds: string[]): void;
|
onPressEnter(documentIds: string[]): void;
|
||||||
onInputChange: ChangeEventHandler<HTMLInputElement>;
|
onInputChange: ChangeEventHandler<HTMLTextAreaElement>;
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
uploadMethod?: string;
|
uploadMethod?: string;
|
||||||
isShared?: boolean;
|
isShared?: boolean;
|
||||||
@ -216,7 +216,9 @@ const MessageInput = ({
|
|||||||
placeholder={t('sendPlaceholder')}
|
placeholder={t('sendPlaceholder')}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={classNames({ [styles.inputWrapper]: fileList.length === 0 })}
|
className={classNames({
|
||||||
|
[styles.inputWrapper]: fileList.length === 0,
|
||||||
|
})}
|
||||||
onKeyDown={handleInputKeyDown}
|
onKeyDown={handleInputKeyDown}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
autoSize={{ minRows: 1, maxRows: 6 }}
|
autoSize={{ minRows: 1, maxRows: 6 }}
|
||||||
|
@ -284,7 +284,7 @@ export const useScrollToBottom = (messages?: unknown) => {
|
|||||||
export const useHandleMessageInputChange = () => {
|
export const useHandleMessageInputChange = () => {
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
|
|
||||||
const handleInputChange: ChangeEventHandler<HTMLInputElement> = (e) => {
|
const handleInputChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {
|
||||||
const value = e.target.value;
|
const value = e.target.value;
|
||||||
const nextValue = value.replaceAll('\\n', '\n').replaceAll('\\t', '\t');
|
const nextValue = value.replaceAll('\\n', '\n').replaceAll('\\t', '\t');
|
||||||
setValue(nextValue);
|
setValue(nextValue);
|
||||||
|
@ -341,7 +341,7 @@ export const useSelectNextMessages = () => {
|
|||||||
export const useHandleMessageInputChange = () => {
|
export const useHandleMessageInputChange = () => {
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
|
|
||||||
const handleInputChange: ChangeEventHandler<HTMLInputElement> = (e) => {
|
const handleInputChange: ChangeEventHandler<HTMLTextAreaElement> = (e) => {
|
||||||
const value = e.target.value;
|
const value = e.target.value;
|
||||||
const nextValue = value.replaceAll('\\n', '\n').replaceAll('\\t', '\t');
|
const nextValue = value.replaceAll('\\n', '\n').replaceAll('\\t', '\t');
|
||||||
setValue(nextValue);
|
setValue(nextValue);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import MessageItem from '@/components/message-item';
|
import MessageItem from '@/components/message-item';
|
||||||
import { MessageType } from '@/constants/chat';
|
import { MessageType } from '@/constants/chat';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
|
||||||
import { useGetFileIcon } from '@/pages/chat/hooks';
|
import { useGetFileIcon } from '@/pages/chat/hooks';
|
||||||
import { buildMessageItemReference } from '@/pages/chat/utils';
|
import { buildMessageItemReference } from '@/pages/chat/utils';
|
||||||
import { Button, Flex, Input, Spin } from 'antd';
|
import { Flex, Spin } from 'antd';
|
||||||
|
|
||||||
import { useSendNextMessage } from './hooks';
|
import { useSendNextMessage } from './hooks';
|
||||||
|
|
||||||
|
import MessageInput from '@/components/message-input';
|
||||||
import PdfDrawer from '@/components/pdf-drawer';
|
import PdfDrawer from '@/components/pdf-drawer';
|
||||||
import { useClickDrawer } from '@/components/pdf-drawer/hooks';
|
import { useClickDrawer } from '@/components/pdf-drawer/hooks';
|
||||||
import { useFetchFlow } from '@/hooks/flow-hooks';
|
import { useFetchFlow } from '@/hooks/flow-hooks';
|
||||||
@ -29,7 +29,6 @@ const FlowChatBox = () => {
|
|||||||
const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } =
|
const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } =
|
||||||
useClickDrawer();
|
useClickDrawer();
|
||||||
useGetFileIcon();
|
useGetFileIcon();
|
||||||
const { t } = useTranslate('chat');
|
|
||||||
const { data: userInfo } = useFetchUserInfo();
|
const { data: userInfo } = useFetchUserInfo();
|
||||||
const { data: canvasInfo } = useFetchFlow();
|
const { data: canvasInfo } = useFetchFlow();
|
||||||
|
|
||||||
@ -67,21 +66,15 @@ const FlowChatBox = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div ref={ref} />
|
<div ref={ref} />
|
||||||
</Flex>
|
</Flex>
|
||||||
<Input
|
<MessageInput
|
||||||
size="large"
|
showUploadIcon={false}
|
||||||
placeholder={t('sendPlaceholder')}
|
|
||||||
value={value}
|
value={value}
|
||||||
suffix={
|
sendLoading={sendLoading}
|
||||||
<Button
|
disabled={false}
|
||||||
type="primary"
|
sendDisabled={sendLoading}
|
||||||
onClick={handlePressEnter}
|
conversationId=""
|
||||||
loading={sendLoading}
|
|
||||||
>
|
|
||||||
{t('send')}
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
onPressEnter={handlePressEnter}
|
onPressEnter={handlePressEnter}
|
||||||
onChange={handleInputChange}
|
onInputChange={handleInputChange}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
<PdfDrawer
|
<PdfDrawer
|
||||||
|
@ -16,7 +16,6 @@ const ChatDrawer = ({ visible, hideModal }: IModalProps<any>) => {
|
|||||||
getContainer={false}
|
getContainer={false}
|
||||||
width={getDrawerWidth()}
|
width={getDrawerWidth()}
|
||||||
mask={false}
|
mask={false}
|
||||||
// zIndex={10000}
|
|
||||||
>
|
>
|
||||||
<FlowChatBox></FlowChatBox>
|
<FlowChatBox></FlowChatBox>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user