index.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /* eslint-disable jsx-a11y/no-static-element-interactions */
  2. import React from 'react';
  3. import BaseComponent from '../_base/baseComponent';
  4. import { AIChatInputProps, AIChatInputState, Skill, Attachment, Reference, Content, LeftMenuChangeProps } from './interface';
  5. import { noop, isEqual } from 'lodash';
  6. import { cssClasses, numbers } from '@douyinfe/semi-foundation/aiChatInput/constants';
  7. import { Popover, Tooltip, Upload, Progress } from '../index';
  8. import { IconSendMsgStroked, IconFile, IconCode, IconCrossStroked,
  9. IconPaperclip, IconArrowUp, IconStop, IconClose, IconTemplateStroked,
  10. IconMusic, IconVideo, IconPdf, IconWord, IconExcel,
  11. IconSize
  12. } from '@douyinfe/semi-icons';
  13. import '@douyinfe/semi-foundation/aiChatInput/aiChatInput.scss';
  14. import HorizontalScroller from './horizontalScroller';
  15. import cls from 'classnames';
  16. import { getAttachmentType, isImageType, getContentType, getCustomSlotAttribute } from '@douyinfe/semi-foundation/aiChatInput/utils';
  17. import Configure from './configure';
  18. import RichTextInput from './richTextInput';
  19. import { Editor, FocusPosition } from '@tiptap/core';
  20. import { getUuidShort } from '@douyinfe/semi-foundation/utils/uuid';
  21. import { throttle } from 'lodash';
  22. import AIChatInputFoundation, { AIChatInputAdapter } from '@douyinfe/semi-foundation/aiChatInput/foundation';
  23. import { NodeSelection, TextSelection } from 'prosemirror-state';
  24. import { Node } from 'prosemirror-model';
  25. import ConfigContext, { ContextValue } from '../configProvider/context';
  26. import getConfigureItem from './configure/getConfigureItem';
  27. import { MessageContent } from '@douyinfe/semi-foundation/aiChatInput/interface';
  28. import { Content as TiptapContent } from "@tiptap/core";
  29. import { Locale } from '../locale/interface';
  30. import LocaleConsumer from '../locale/localeConsumer';
  31. import SkillItem from './skillItem';
  32. import SuggestionItem from './suggestionItem';
  33. export { getConfigureItem };
  34. export * from './interface';
  35. const prefixCls = cssClasses.PREFIX;
  36. class AIChatInput extends BaseComponent<AIChatInputProps, AIChatInputState> {
  37. static __SemiComponentName__ = "AIChatInput";
  38. static Configure = Configure;
  39. static contextType = ConfigContext;
  40. static getCustomSlotAttribute = getCustomSlotAttribute;
  41. private clickOutsideHandler: (e: Event) => void | null;
  42. static defaultProps: Partial<AIChatInputProps> = {
  43. onContentChange: noop,
  44. onStopGenerate: noop,
  45. showReference: true,
  46. showUploadFile: true,
  47. generating: false,
  48. dropdownMatchTriggerWidth: true,
  49. round: true,
  50. topSlotPosition: 'top',
  51. }
  52. constructor(props: AIChatInputProps) {
  53. super(props);
  54. this.editor = null;
  55. const defaultAttachment = props?.uploadProps?.defaultFileList ?? [];
  56. this.state = {
  57. popupKey: 1,
  58. templateVisible: false,
  59. skillVisible: false,
  60. suggestionVisible: false,
  61. attachments: defaultAttachment,
  62. content: null,
  63. popupWidth: null,
  64. skill: {} as Skill,
  65. activeSkillIndex: 0,
  66. activeSuggestionIndex: 0,
  67. /**
  68. * richTextInit 用于标识富文本编辑区是否初始化完成,会影响初始化时发送按钮是否可以点击
  69. * richTextInit is used to identify whether the rich text editing area has been initialized,
  70. * which will affect whether the send button can be clicked during initialization.
  71. */
  72. richTextInit: false,
  73. };
  74. this.triggerRef = React.createRef();
  75. this.popUpOptionListID = getUuidShort();
  76. this.foundation = new AIChatInputFoundation(this.adapter);
  77. this.transformedContent = [];
  78. this.uploadRef = React.createRef();
  79. this.configureRef = React.createRef();
  80. this.richTextDIVRef = React.createRef<HTMLDivElement>();
  81. this.suggestionPanelRef = React.createRef<HTMLDivElement>();
  82. this.clickOutsideHandler = null;
  83. }
  84. editor: Editor;
  85. triggerRef: React.RefObject<HTMLDivElement>;
  86. configureRef: React.RefObject<Configure>;
  87. popUpOptionListID: string;
  88. foundation: AIChatInputFoundation;
  89. transformedContent: Content[];
  90. context: ContextValue;
  91. uploadRef: React.RefObject<Upload>;
  92. richTextDIVRef = React.createRef<HTMLDivElement>();
  93. suggestionPanelRef = React.createRef<HTMLDivElement>();
  94. get adapter(): AIChatInputAdapter<AIChatInputProps, AIChatInputState> {
  95. return {
  96. ...super.adapter,
  97. reposPopover: throttle(() => {
  98. const { templateVisible } = this.state;
  99. if (templateVisible) {
  100. this.setState({
  101. popupKey: this.state.popupKey + 1,
  102. });
  103. }
  104. }, 200),
  105. setContent: (content: string) => {
  106. this.editor.commands.setContent(content);
  107. },
  108. clearContent: () => {
  109. this.setContent('');
  110. },
  111. clearAttachments: () => {
  112. this.setState({
  113. attachments: [],
  114. });
  115. },
  116. focusEditor: (pos?: FocusPosition) => {
  117. this.editor?.commands.focus(pos || 'end');
  118. },
  119. getTriggerWidth: () => {
  120. const el = this.triggerRef.current;
  121. return el && el.getBoundingClientRect().width;
  122. },
  123. getEditor: () => this.editor,
  124. getPopupID: () => this.popUpOptionListID,
  125. notifyContentChange: (result: Content[]) => {
  126. this.transformedContent = result;
  127. this.props.onContentChange?.(result);
  128. },
  129. notifyConfigureChange: (value: LeftMenuChangeProps, changedValue: LeftMenuChangeProps) => {
  130. this.props.onConfigureChange?.(value, changedValue);
  131. },
  132. manualUpload: (files: File[]) => {
  133. const uploadComponent = this.uploadRef.current;
  134. if (uploadComponent) {
  135. uploadComponent.insert(files);
  136. }
  137. },
  138. notifyMessageSend: (props: MessageContent) => {
  139. this.props.onMessageSend?.(props);
  140. },
  141. notifyStopGenerate: () => {
  142. this.props.onStopGenerate?.();
  143. },
  144. getRichTextDiv: () => this.richTextDIVRef?.current,
  145. registerClickOutsideHandler: cb => {
  146. const clickOutsideHandler = (e: Event) => {
  147. const optionsDom = this.suggestionPanelRef && this.suggestionPanelRef.current;
  148. const triggerDom = this.triggerRef && this.triggerRef.current;
  149. const target = e.target as Element;
  150. const path = e.composedPath && e.composedPath() || [target];
  151. if (
  152. optionsDom &&
  153. (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) &&
  154. triggerDom &&
  155. !triggerDom.contains(target) &&
  156. !(path.includes(triggerDom) || path.includes(optionsDom))
  157. ) {
  158. cb(e);
  159. }
  160. };
  161. this.clickOutsideHandler = clickOutsideHandler;
  162. document.addEventListener('mousedown', clickOutsideHandler, false);
  163. },
  164. unregisterClickOutsideHandler: () => {
  165. if (this.clickOutsideHandler) {
  166. document.removeEventListener('mousedown', this.clickOutsideHandler, false);
  167. }
  168. },
  169. handleReferenceDelete: (reference: Reference) => {
  170. this.props.onReferenceDelete?.(reference);
  171. },
  172. handleReferenceClick: (reference: Reference) => {
  173. this.props.onReferenceClick?.(reference);
  174. },
  175. isSelectionText: (selection: Selection) => {
  176. return selection instanceof TextSelection;
  177. },
  178. createSelection: (node: Node, pos: number) => {
  179. return NodeSelection.create(node, pos);
  180. },
  181. notifyFocus: (event: any) => {
  182. this.props.onFocus?.(event);
  183. },
  184. notifyBlur: (event: any) => {
  185. this.props.onBlur?.(event);
  186. },
  187. getConfigureValue: () => {
  188. return this.configureRef?.current?.getConfigureValue();
  189. }
  190. };
  191. }
  192. componentDidUpdate(prevProps: Readonly<AIChatInputProps>): void {
  193. const { suggestions } = this.props;
  194. if (!isEqual(suggestions, prevProps.suggestions)) {
  195. const newVisible = (suggestions && suggestions.length > 0) ? true : false;
  196. newVisible ? this.foundation.showSuggestionPanel() :
  197. this.foundation.hideSuggestionPanel();
  198. }
  199. if (this.props.generating && (this.props.generating !== prevProps.generating)) {
  200. this.adapter.clearContent();
  201. this.adapter.clearAttachments();
  202. }
  203. }
  204. componentWillUnmount(): void {
  205. this.foundation.destroy();
  206. }
  207. // ref method
  208. setContent = (content: TiptapContent) => {
  209. this.adapter.setContent(content);
  210. };
  211. // ref method
  212. focusEditor = (pos: FocusPosition) => {
  213. this.adapter.focusEditor(pos);
  214. }
  215. // ref method & inner method
  216. changeTemplateVisible = (value: boolean) => {
  217. this.foundation.changeTemplateVisible(value);
  218. }
  219. // ref method & inner method
  220. getEditor = () => this.editor;
  221. // ref method
  222. deleteContent(content: Content) {
  223. this.foundation.handleDeleteContent(content);
  224. }
  225. setEditor = (editor: Editor) => {
  226. this.editor = editor;
  227. }
  228. setContentWhileSaveTool = (content: string) => {
  229. const { skill } = this.state;
  230. let realContent = '';
  231. if (!skill) {
  232. realContent = `<p>${content}</p>`;
  233. } else {
  234. realContent = `<p><skill-slot data-value=${skill.label ?? 'test'}></skill-slot>${content}</p>`;
  235. }
  236. this.setContent(realContent);
  237. }
  238. renderTemplate() {
  239. const { skill } = this.state;
  240. const { renderTemplate, templatesStyle, templatesCls } = this.props;
  241. const { popupWidth } = this.state;
  242. return <div
  243. className={cls(`${prefixCls}-template`, {
  244. [templatesCls]: templatesCls,
  245. })}
  246. style={{ width: popupWidth, maxHeight: 500, ...templatesStyle }}
  247. >
  248. {renderTemplate?.(skill, this.setContent)}
  249. </div>;
  250. }
  251. renderSkill() {
  252. const { popupWidth } = this.state;
  253. const { skills, renderSkillItem } = this.props;
  254. return <div
  255. id={`${prefixCls}-skill-${this.popUpOptionListID}`}
  256. className={`${prefixCls}-skill`}
  257. style={{ width: popupWidth, maxHeight: numbers.SKILL_MAX_HEIGHT }}
  258. >
  259. {
  260. skills?.map((item, index) => (<SkillItem
  261. index={index}
  262. isActive={this.state.activeSkillIndex === index}
  263. key={item.key || item.value}
  264. skill={item}
  265. renderSkillItem={renderSkillItem}
  266. onClick={this.foundation.handleSkillSelect}
  267. onMouseEnter={this.foundation.setActiveSkillIndex}
  268. />))
  269. }
  270. </div>;
  271. }
  272. renderSuggestions() {
  273. const { suggestions, renderSuggestionItem } = this.props;
  274. const { popupWidth, activeSuggestionIndex } = this.state;
  275. return (<div
  276. id={`${prefixCls}-suggestion-${this.popUpOptionListID}`}
  277. className={`${prefixCls}-suggestion`}
  278. style={{ width: popupWidth, maxHeight: numbers.SUGGESTION_MAX_HEIGHT }}
  279. ref={this.suggestionPanelRef}
  280. >
  281. {
  282. suggestions.map((item, index) => (
  283. <SuggestionItem
  284. index={index}
  285. key={typeof item === 'string' ? item : (item && 'content' in item ? item.content : index)}
  286. suggestion={item}
  287. isActive={activeSuggestionIndex === index}
  288. renderSuggestionItem={renderSuggestionItem}
  289. onClick={this.foundation.handleSuggestionSelect}
  290. onMouseEnter={this.foundation.setActiveSuggestionIndex}
  291. />
  292. ))
  293. }
  294. </div>
  295. );
  296. }
  297. renderPopoverContent() {
  298. const { templateVisible, skillVisible, suggestionVisible } = this.state;
  299. if (templateVisible) {
  300. return this.renderTemplate();
  301. } else if (skillVisible) {
  302. return this.renderSkill();
  303. } else if (suggestionVisible) {
  304. return this.renderSuggestions();
  305. } else {
  306. return null;
  307. }
  308. }
  309. handleReferenceDelete = (reference: Reference) => {
  310. const { onReferenceDelete } = this.props;
  311. onReferenceDelete(reference);
  312. }
  313. getIconByType(type: string, size: IconSize = 'small') {
  314. let iconNode: React.ReactNode;
  315. if (type === 'text') {
  316. return null;
  317. }
  318. switch (type) {
  319. case 'file':
  320. case 'word':
  321. iconNode = <IconWord size={size} />;
  322. break;
  323. case 'code':
  324. iconNode = <IconCode size={size} />;
  325. break;
  326. case 'excel':
  327. iconNode = <IconExcel size={size} />;
  328. break;
  329. case 'video':
  330. iconNode = <IconVideo size={size} />;
  331. break;
  332. case 'audio':
  333. iconNode = <IconMusic size={size} />;
  334. break;
  335. case 'pdf':
  336. iconNode = <IconPdf size={size} />;
  337. break;
  338. default:
  339. iconNode = <IconFile size={size} />;
  340. break;
  341. }
  342. return iconNode;
  343. }
  344. getReferenceIconByType(type: string) {
  345. let iconNode = this.getIconByType(type);
  346. return <span className={`${prefixCls}-ref-icon ${prefixCls}-ref-icon-${type} ${prefixCls}-reference-icon`}>
  347. {iconNode}
  348. </span>;
  349. }
  350. getAttachmentIconByType(type: string) {
  351. let iconNode = this.getIconByType(type, 'large');
  352. return <span className={`${prefixCls}-attachment-icon ${prefixCls}-ref-icon ${prefixCls}-ref-icon-${type}`}>
  353. {iconNode}
  354. </span>;
  355. }
  356. renderReference() {
  357. const { references = [], renderReference } = this.props;
  358. if (references.length === 0 ) {
  359. return null;
  360. }
  361. return <div className={`${prefixCls}-references`}>
  362. {references.map(item => {
  363. if (renderReference) {
  364. return renderReference(item);
  365. }
  366. const { id, type, content, name, url } = item;
  367. const isImage = isImageType(item);
  368. const signIconType = getContentType(getAttachmentType(item));
  369. // eslint-disable-next-line jsx-a11y/click-events-have-key-events
  370. return <div
  371. key={id}
  372. className={`${prefixCls}-reference`}
  373. onClick={() => { this.foundation.handleReferenceClick(item);}}
  374. >
  375. <IconSendMsgStroked />
  376. <span className={`${prefixCls}-reference-content`}>
  377. {type !== 'text' && ( isImage ? <img className={`${prefixCls}-reference-img`} src={url} alt={name}></img> :
  378. this.getReferenceIconByType(signIconType))}
  379. <span className={`${prefixCls}-reference-name`}>{type === 'text' ? content : name}</span>
  380. </span>
  381. <IconCrossStroked
  382. size="small"
  383. className={`${prefixCls}-reference-delete`}
  384. onClick={(e) => {
  385. this.handleReferenceDelete(item);
  386. e.stopPropagation();
  387. }}
  388. />
  389. </div>;
  390. })}
  391. </div>;
  392. }
  393. // ref method
  394. deleteUploadFile = (item: Attachment) => {
  395. this.foundation.handleUploadFileDelete(item);
  396. }
  397. renderAttachment() {
  398. const { attachments = [] } = this.state;
  399. if (attachments.length === 0) {
  400. return null;
  401. }
  402. return <HorizontalScroller prefix={`${prefixCls}`}>
  403. {attachments?.map((item: Attachment, index: number) => {
  404. const isImage = isImageType(item);
  405. const realType = getAttachmentType(item);
  406. const signIconType = getContentType(realType);
  407. const { uid, name, url, size, percent, status } = item;
  408. const showPercent = !(percent === 100 || typeof percent === 'undefined') && status === 'uploading';
  409. return <div className={`${prefixCls}-attachment`} key={uid}>
  410. {isImage ? <img className={`${prefixCls}-attachment-img`} src={url} alt={name}></img>
  411. : this.getAttachmentIconByType(signIconType)
  412. }
  413. <div className={`${prefixCls}-attachment-content`}>
  414. <div className={`${prefixCls}-attachment-content-name`}>{name}</div>
  415. <div className={`${prefixCls}-attachment-content-size`}>{`${realType} ${size}`}</div>
  416. </div>
  417. {showPercent && <Progress
  418. type="circle"
  419. width={30}
  420. className={`${prefixCls}-attachment-progress`}
  421. percent={percent}
  422. showInfo={false}
  423. aria-label="upload progress"
  424. />}
  425. <IconClose
  426. className={`${prefixCls}-attachment-delete`}
  427. size="small"
  428. onClick={() => { this.foundation.handleUploadFileDelete(item);}}
  429. />
  430. </div>;
  431. }
  432. )}
  433. </HorizontalScroller>;
  434. }
  435. renderTopArea() {
  436. const { references, topSlotPosition, renderTopSlot, showReference, showUploadFile } = this.props;
  437. const { attachments } = this.state;
  438. const topSlot = renderTopSlot?.({
  439. references,
  440. attachments,
  441. content: this.transformedContent,
  442. handleUploadFileDelete: this.foundation.handleUploadFileDelete,
  443. handleReferenceDelete: this.handleReferenceDelete,
  444. });
  445. return <>
  446. {topSlotPosition === 'top' && topSlot}
  447. {showReference && this.renderReference()}
  448. {topSlotPosition === 'middle' && topSlot}
  449. {showUploadFile && this.renderAttachment()}
  450. {topSlotPosition === 'bottom' && topSlot}
  451. </>;
  452. }
  453. renderLeftFooter = () => {
  454. const { renderConfigureArea, round, showTemplateButton } = this.props;
  455. const { skill = {} } = this.state;
  456. const { hasTemplate } = skill as Skill;
  457. return <LocaleConsumer componentName="AIChatInput">
  458. {(locale: Locale['AIChatInput']) => (
  459. <div className={`${prefixCls}-footer-configure`}>
  460. <Configure
  461. ref={this.configureRef}
  462. round={round}
  463. onChange={this.foundation.onConfigureChange}
  464. >
  465. {renderConfigureArea?.()}
  466. {(showTemplateButton || hasTemplate) && <Configure.Button
  467. key={"template"}
  468. field="template"
  469. onClick={this.changeTemplateVisible}
  470. icon={<IconTemplateStroked />}
  471. >{locale.template}</Configure.Button>}
  472. </Configure>
  473. </div>)}
  474. </LocaleConsumer>;
  475. }
  476. renderUploadButton = () => {
  477. const { uploadTipProps, uploadProps } = this.props;
  478. const { attachments } = this.state;
  479. const { className, onChange, renderFileItem, children, ...rest } = uploadProps;
  480. const realUploadProps = {
  481. ...rest,
  482. onChange: this.foundation.onUploadChange,
  483. };
  484. const uploadNode = <Upload
  485. ref={this.uploadRef}
  486. fileList={attachments}
  487. listType="none"
  488. {...realUploadProps}
  489. key='upload'
  490. >
  491. <button className={`${prefixCls}-footer-action-button ${prefixCls}-footer-action-upload`} >
  492. <IconPaperclip />
  493. </button>
  494. </Upload>;
  495. return uploadTipProps ? <Tooltip {...uploadTipProps} key='upload'><span>{uploadNode}</span></Tooltip> : uploadNode;
  496. }
  497. renderSendButton = () => {
  498. const { generating } = this.props;
  499. const canSend = this.foundation.canSend();
  500. return <button
  501. key="send"
  502. className={cls(`${prefixCls}-footer-action-button`, {
  503. [`${prefixCls}-footer-action-send`]: !generating,
  504. [`${prefixCls}-footer-action-stop`]: generating,
  505. [`${prefixCls}-footer-action-send-disabled`]: !generating && !canSend,
  506. })}
  507. onClick={this.foundation.handleSend}
  508. >
  509. {generating ? <IconStop /> : <IconArrowUp />}
  510. </button>;
  511. }
  512. renderRightFooter = () => {
  513. const { renderActionArea } = this.props;
  514. const actionCls = `${prefixCls}-footer-action`;
  515. const actionNode = [
  516. this.renderUploadButton(),
  517. this.renderSendButton(),
  518. ];
  519. if (renderActionArea) {
  520. return renderActionArea({
  521. menuItem: actionNode,
  522. className: actionCls
  523. });
  524. }
  525. return <div className={actionCls}>
  526. {actionNode}
  527. </div>;
  528. }
  529. renderFooter = () => {
  530. const round = this.props.round;
  531. return <div className={cls(`${prefixCls}-footer`, { [`${prefixCls}-footer-round`]: round })}>
  532. {this.renderLeftFooter()}
  533. {this.renderRightFooter()}
  534. </div>;
  535. }
  536. render() {
  537. const { direction } = this.context;
  538. const defaultPosition = direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
  539. const { style, className, popoverProps, placeholder, extensions, defaultContent } = this.props;
  540. const { templateVisible, skillVisible, suggestionVisible, popupKey } = this.state;
  541. return (
  542. <Popover
  543. position={defaultPosition}
  544. {...popoverProps}
  545. rePosKey={popupKey}
  546. className={cls({
  547. [`${prefixCls}-popover-suggestion`]: suggestionVisible,
  548. [`${prefixCls}-popover-skill`]: skillVisible,
  549. [`${prefixCls}-popover-template`]: templateVisible,
  550. })}
  551. content={this.renderPopoverContent()}
  552. visible={templateVisible || skillVisible || suggestionVisible}
  553. trigger="custom"
  554. disableArrowKeyDown={true}
  555. >
  556. {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
  557. <div
  558. className={cls(prefixCls, { [className]: className })}
  559. style={style}
  560. ref={this.triggerRef}
  561. onClick={this.foundation.handleContainerClick}
  562. onMouseDown={this.foundation.handleContainerMouseDown}
  563. >
  564. {this.renderTopArea()}
  565. <RichTextInput
  566. innerRef={this.richTextDIVRef}
  567. defaultContent={defaultContent}
  568. placeholder={placeholder}
  569. onKeyDown={this.foundation.handleKeyDown}
  570. setEditor={this.setEditor}
  571. onChange={this.foundation.handleContentChange}
  572. extensions={extensions}
  573. handleKeyDown={this.foundation.handRichTextArealKeyDown}
  574. onPaste={this.foundation.handlePaste}
  575. onFocus={this.foundation.handleFocus}
  576. onBlur={this.foundation.handleBlur}
  577. handleCreate={this.foundation.handleCreate}
  578. />
  579. {this.renderFooter()}
  580. </div>
  581. </Popover>
  582. );
  583. }
  584. }
  585. export default AIChatInput;