| 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  CloseCircleOutlined, | 
														 | 
														 | 
														  CloseCircleOutlined, | 
													
													
												
													
														 | 
														 | 
														  InfoCircleOutlined, | 
														 | 
														 | 
														  InfoCircleOutlined, | 
													
													
												
													
														 | 
														 | 
														  LoadingOutlined, | 
														 | 
														 | 
														  LoadingOutlined, | 
													
													
												
													
														 | 
														 | 
														  PaperClipOutlined, | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  SendOutlined, | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														} from '@ant-design/icons'; | 
														 | 
														 | 
														} from '@ant-design/icons'; | 
													
													
												
													
														 | 
														 | 
														import type { GetProp, UploadFile } from 'antd'; | 
														 | 
														 | 
														import type { GetProp, UploadFile } from 'antd'; | 
													
													
												
													
														 | 
														 | 
														import { | 
														 | 
														 | 
														import { | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  UploadProps, | 
														 | 
														 | 
														  UploadProps, | 
													
													
												
													
														 | 
														 | 
														} from 'antd'; | 
														 | 
														 | 
														} from 'antd'; | 
													
													
												
													
														 | 
														 | 
														import get from 'lodash/get'; | 
														 | 
														 | 
														import get from 'lodash/get'; | 
													
													
												
													
														 | 
														 | 
														import { CircleStop } from 'lucide-react'; | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														import { CircleStop, Paperclip, SendHorizontal } from 'lucide-react'; | 
													
													
												
													
														 | 
														 | 
														import { | 
														 | 
														 | 
														import { | 
													
													
												
													
														 | 
														 | 
														  ChangeEventHandler, | 
														 | 
														 | 
														  ChangeEventHandler, | 
													
													
												
													
														 | 
														 | 
														  memo, | 
														 | 
														 | 
														  memo, | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														
  | 
													
													
												
													
														 | 
														 | 
														  const isUploadingFile = fileList.some((x) => x.status === 'uploading'); | 
														 | 
														 | 
														  const isUploadingFile = fileList.some((x) => x.status === 'uploading'); | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														
  | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														  const handlePressEnter = useCallback(async () => { | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														    if (isUploadingFile) return; | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														    const ids = getFileIds(fileList.filter((x) => isUploadSuccess(x))); | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														
  | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														    onPressEnter(ids); | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														    setFileList([]); | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														  }, [fileList, onPressEnter, isUploadingFile]); | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														
  | 
													
													
												
													
														 | 
														 | 
														  const handleKeyDown = useCallback( | 
														 | 
														 | 
														  const handleKeyDown = useCallback( | 
													
													
												
													
														 | 
														 | 
														    async (event: React.KeyboardEvent<HTMLTextAreaElement>) => { | 
														 | 
														 | 
														    async (event: React.KeyboardEvent<HTMLTextAreaElement>) => { | 
													
													
												
													
														 | 
														 | 
														      // check if it was shift + enter | 
														 | 
														 | 
														      // check if it was shift + enter | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														    [sendDisabled, isUploadingFile, sendLoading, handlePressEnter], | 
														 | 
														 | 
														    [sendDisabled, isUploadingFile, sendLoading, handlePressEnter], | 
													
													
												
													
														 | 
														 | 
														  ); | 
														 | 
														 | 
														  ); | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														
  | 
													
													
												
													
														 | 
														 | 
														  const handlePressEnter = useCallback(async () => { | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														    if (isUploadingFile) return; | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														    const ids = getFileIds(fileList.filter((x) => isUploadSuccess(x))); | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														    onPressEnter(ids); | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														    setFileList([]); | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  }, [fileList, onPressEnter, isUploadingFile]); | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  const [isComposing, setIsComposing] = useState(false); | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  const handleCompositionStart = () => setIsComposing(true); | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  const handleCompositionEnd = () => setIsComposing(false); | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														
  | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														  const handleRemove = useCallback( | 
														 | 
														 | 
														  const handleRemove = useCallback( | 
													
													
												
													
														 | 
														 | 
														    async (file: UploadFile) => { | 
														 | 
														 | 
														    async (file: UploadFile) => { | 
													
													
												
													
														 | 
														 | 
														      const ids = get(file, 'response.data', []); | 
														 | 
														 | 
														      const ids = get(file, 'response.data', []); | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														        autoSize={{ minRows: 2, maxRows: 10 }} | 
														 | 
														 | 
														        autoSize={{ minRows: 2, maxRows: 10 }} | 
													
													
												
													
														 | 
														 | 
														        onKeyDown={handleKeyDown} | 
														 | 
														 | 
														        onKeyDown={handleKeyDown} | 
													
													
												
													
														 | 
														 | 
														        onChange={onInputChange} | 
														 | 
														 | 
														        onChange={onInputChange} | 
													
													
												
													
														 | 
														 | 
														        onCompositionStart={handleCompositionStart} | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														        onCompositionEnd={handleCompositionEnd} | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														      /> | 
														 | 
														 | 
														      /> | 
													
													
												
													
														 | 
														 | 
														      <Divider style={{ margin: '5px 30px 10px 0px' }} /> | 
														 | 
														 | 
														      <Divider style={{ margin: '5px 30px 10px 0px' }} /> | 
													
													
												
													
														 | 
														 | 
														      <Flex justify="space-between" align="center"> | 
														 | 
														 | 
														      <Flex justify="space-between" align="center"> | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														              }} | 
														 | 
														 | 
														              }} | 
													
													
												
													
														 | 
														 | 
														            > | 
														 | 
														 | 
														            > | 
													
													
												
													
														 | 
														 | 
														              <Button type={'primary'} disabled={disabled}> | 
														 | 
														 | 
														              <Button type={'primary'} disabled={disabled}> | 
													
													
												
													
														 | 
														 | 
														                <PaperClipOutlined /> | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														                <Paperclip className="size-4" /> | 
													
													
												
													
														 | 
														 | 
														              </Button> | 
														 | 
														 | 
														              </Button> | 
													
													
												
													
														 | 
														 | 
														            </Upload> | 
														 | 
														 | 
														            </Upload> | 
													
													
												
													
														 | 
														 | 
														          )} | 
														 | 
														 | 
														          )} | 
													
													
												
													
														 | 
														 | 
														          {sendLoading ? ( | 
														 | 
														 | 
														          {sendLoading ? ( | 
													
													
												
													
														 | 
														 | 
														            <Button onClick={handleStopOutputMessage}> | 
														 | 
														 | 
														            <Button onClick={handleStopOutputMessage}> | 
													
													
												
													
														 | 
														 | 
														              <CircleStop /> | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														              <CircleStop className="size-5" /> | 
													
													
												
													
														 | 
														 | 
														            </Button> | 
														 | 
														 | 
														            </Button> | 
													
													
												
													
														 | 
														 | 
														          ) : ( | 
														 | 
														 | 
														          ) : ( | 
													
													
												
													
														 | 
														 | 
														            <Button | 
														 | 
														 | 
														            <Button | 
													
													
												
											
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														              loading={sendLoading} | 
														 | 
														 | 
														              loading={sendLoading} | 
													
													
												
													
														 | 
														 | 
														              disabled={sendDisabled || isUploadingFile || sendLoading} | 
														 | 
														 | 
														              disabled={sendDisabled || isUploadingFile || sendLoading} | 
													
													
												
													
														 | 
														 | 
														            > | 
														 | 
														 | 
														            > | 
													
													
												
													
														 | 
														 | 
														              <SendOutlined /> | 
														 | 
														 | 
														 | 
													
													
												
													
														 | 
														 | 
														 | 
														 | 
														 | 
														              <SendHorizontal className="size-5" /> | 
													
													
												
													
														 | 
														 | 
														            </Button> | 
														 | 
														 | 
														            </Button> | 
													
													
												
													
														 | 
														 | 
														          )} | 
														 | 
														 | 
														          )} | 
													
													
												
													
														 | 
														 | 
														        </Flex> | 
														 | 
														 | 
														        </Flex> |