11import React , { ChangeEvent , useEffect , useState } from 'react' ;
22import styles from './index.less' ;
33import AIImg from '@/assets/img/ai.svg' ;
4- import { Input } from 'antd' ;
4+ import { Checkbox , Dropdown , Input , Popover } from 'antd' ;
55import i18n from '@/i18n/' ;
6+ import Iconfont from '@/components/Iconfont' ;
67
78interface IProps {
89 value ?: string ;
910 result ?: string ;
11+ tables ?: string [ ] ;
12+ selectedTables ?: string [ ] ;
1013 onPressEnter : ( value : string ) => void ;
14+ onSelectTables : ( tables : ( string | number | boolean ) [ ] ) => void ;
1115}
1216
1317function ChatInput ( props : IProps ) {
@@ -17,13 +21,33 @@ function ChatInput(props: IProps) {
1721 }
1822 } ;
1923
24+ const renderSelectTable = ( ) => {
25+ const { tables, selectedTables, onSelectTables } = props ;
26+ return tables && tables . length ? (
27+ < div >
28+ < Checkbox . Group
29+ options = { tables || [ ] }
30+ value = { selectedTables }
31+ onChange = { ( v ) => {
32+ onSelectTables && onSelectTables ( v ) ;
33+ } }
34+ />
35+ </ div >
36+ ) : (
37+ < div > 暂无表</ div >
38+ ) ;
39+ } ;
40+
2041 const renderSuffix = ( ) => {
2142 const remainCnt = 10 ;
2243 return (
2344 < div className = { styles . suffixBlock } >
24- < div className = { styles . remainBlock } >
25- { i18n ( 'chat.input.remain' , remainCnt ) }
45+ < div className = { styles . tableSelectBlock } >
46+ < Popover content = { renderSelectTable ( ) } placement = "bottom" >
47+ < Iconfont code = "" />
48+ </ Popover >
2649 </ div >
50+ < div className = { styles . remainBlock } > { i18n ( 'chat.input.remain' , remainCnt ) } </ div >
2751 </ div >
2852 ) ;
2953 } ;
0 commit comments