@gientech/modual 1.4.7 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{GientechStreamReader-4496nAm0.js → GientechStreamReader-BE_oxQLt.js} +2 -2
- package/dist/assets/Input-CNqIA41v.js +236 -0
- package/dist/assets/index-Bof0D4vl.js +1088 -0
- package/dist/assets/{index-BVENTW1Q.js → index-C5RhLYRh.js} +1 -1
- package/dist/assets/index-COcmK9my.js +1 -0
- package/dist/assets/index-CysDmrpo.js +1798 -0
- package/dist/assets/{index-7rZAt9P3.js → index-DP8Ki8qW.js} +1 -1
- package/dist/assets/index-pybYlMAT.js +11 -0
- package/dist/assets/{plus-CrtEUXaQ.js → plus-CzbYbK8K.js} +1 -1
- package/dist/assets/style3.css +1 -1
- package/dist/assets/worker-BbpylX7l.js +13 -0
- package/dist/assets/{x-Dr3EBTzJ.js → x-DdRafKQU.js} +1 -1
- package/dist/chat.d.ts +17 -0
- package/dist/chat.js +3830 -52
- package/dist/database.js +2 -2
- package/dist/databaseId.js +1 -11
- package/dist/databaseTable.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -14
- package/dist/modelManage.js +1 -1
- package/dist/package.json +1 -1
- package/dist/sensitive.js +1 -1
- package/dist/streamFilesReader.js +1 -1
- package/package.json +6 -6
- package/scripts/README.md +133 -133
- package/scripts/build-demo.js +88 -88
- package/scripts/demo-selector.js +216 -216
- package/scripts/preview-demo.js +130 -130
- package/scripts/run-demo.bat +34 -34
- package/src/assets/img/close.png +0 -0
- package/src/assets/img/database.png +0 -0
- package/src/assets/img/downLoad.png +0 -0
- package/src/assets/img/graphIcon.png +0 -0
- package/src/assets/img/pdf.png +0 -0
- package/src/assets/img/singleQa.png +0 -0
- package/src/assets/img/webSearch.png +0 -0
- package/src/examples/chat/index.tsx +5 -29
- package/src/main.tsx.backup +2 -2
- package/src/modules/chat/ReferenceBar.tsx +13 -0
- package/src/modules/chat/constants.tsx +29 -6
- package/src/modules/chat/index.tsx +126 -4
- package/src/utils/gientechCommon/components/ReferenceListDrawer.tsx +542 -0
- package/src/utils/gientechCommon/components/hooks/useAichatEvent.ts +10 -0
- package/src/utils/gientechCommon/components/referenceCom/DeleteModal.tsx +75 -0
- package/src/utils/gientechCommon/components/referenceCom/DrawerContent.tsx +136 -0
- package/src/utils/gientechCommon/components/referenceCom/DrawerDatabase.tsx +110 -0
- package/src/utils/gientechCommon/components/referenceCom/DrawerGraphPreview.tsx +86 -0
- package/src/utils/gientechCommon/components/referenceCom/DrawerPreview.tsx +73 -0
- package/src/utils/gientechCommon/components/referenceCom/DrawerTitle.tsx +26 -0
- package/src/utils/gientechCommon/components/referenceCom/RenameModal.tsx +86 -0
- package/src/utils/gientechCommon/components/referenceCom/TagCom.tsx +30 -0
- package/src/utils/gientechCommon/components/style.css +3 -0
- package/src/utils/gientechCommon/components/utils/index.ts +326 -0
- package/src/utils/testconfigs/index.ts +1 -1
- package/stats.html +1 -1
- package/dist/assets/AppLoading-mci3gLZt.js +0 -414
- package/dist/assets/index-Bb8_WB-l.js +0 -1
- package/dist/assets/index-BpJ9Bm5x.js +0 -21
- package/dist/assets/index-CNxDI4h-.js +0 -1078
- package/dist/assets/index-CWzpBU29.js +0 -1
- package/dist/assets/index-D1m34Ij7.js +0 -1429
- package/dist/assets/index-_gBtdXQV.js +0 -585
- package/dist/assets/style4.css +0 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { uid } from 'uid';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { dealMinioUrl, getFileName, getFilePath, getFileType, getInitialZoom } from '../utils';
|
|
4
|
+
import { GientechStreamReader } from '@gientech/modual/streamFilesReader';
|
|
5
|
+
export const DrawerContent = ({
|
|
6
|
+
content,
|
|
7
|
+
onClose,
|
|
8
|
+
token,
|
|
9
|
+
}: {
|
|
10
|
+
content: {
|
|
11
|
+
file_source: string;
|
|
12
|
+
contents: any[];
|
|
13
|
+
curMark: string;
|
|
14
|
+
file_type: string;
|
|
15
|
+
title: string;
|
|
16
|
+
metadata: any;
|
|
17
|
+
pdfPages: number | undefined;
|
|
18
|
+
url: string;
|
|
19
|
+
parse_url: string;
|
|
20
|
+
} | null;
|
|
21
|
+
onClose: any;
|
|
22
|
+
token: string;
|
|
23
|
+
}) => {
|
|
24
|
+
const getAnnotations: any = (content: any) => {
|
|
25
|
+
if (!content?.metadata) return;
|
|
26
|
+
const fileType = getFileType(content, '');
|
|
27
|
+
const { page_number, page_size, position, offset, chunk_type } = content.metadata;
|
|
28
|
+
if (fileType === 'markdown_table') {
|
|
29
|
+
if (offset?.length) {
|
|
30
|
+
return {
|
|
31
|
+
annotations: [{ id: uid(), offsets: offset }],
|
|
32
|
+
initialPage: 1,
|
|
33
|
+
};
|
|
34
|
+
} else {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
if (!page_size || !position) {
|
|
39
|
+
console.log('%c缺少文件size或者文件坐标', 'color: red');
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
const pageSizes = Array.isArray(page_size) ? page_size : JSON.parse(page_size);
|
|
43
|
+
if (!pageSizes.length) {
|
|
44
|
+
console.log('%c缺少文件size', 'color: red');
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
const positions = Array.isArray(position) ? position : JSON.parse(position);
|
|
48
|
+
if (!positions.length || !page_number) {
|
|
49
|
+
console.log('%c缺少文件坐标或者文件页数', 'color: red');
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
const anno = positions.map((item: any, index: number) => {
|
|
53
|
+
return {
|
|
54
|
+
id: uid(),
|
|
55
|
+
pageNumber: page_number[index],
|
|
56
|
+
x: +(item[0][0] / pageSizes[0][0]).toFixed(4),
|
|
57
|
+
y: +(item[0][1] / pageSizes[0][1]).toFixed(4),
|
|
58
|
+
width: +((item[1][0] - item[0][0]) / pageSizes[0][0]).toFixed(4),
|
|
59
|
+
height: +((item[2][1] - item[0][1]) / pageSizes[0][1]).toFixed(4),
|
|
60
|
+
content: '',
|
|
61
|
+
color: chunk_type === 'image' ? '#60f74f' : '#4FC3F7',
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
return { annotations: anno, initialPage: page_number[0] };
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const curData = useMemo(() => {
|
|
69
|
+
console.log('content88888888888', content);
|
|
70
|
+
if (content && token) {
|
|
71
|
+
console.log('content999', content);
|
|
72
|
+
const { annotations, initialPage } = getAnnotations(content);
|
|
73
|
+
const curContent = {
|
|
74
|
+
...content,
|
|
75
|
+
metadata: {
|
|
76
|
+
source: content?.metadata?.source || content.parse_url || content.url,
|
|
77
|
+
page_size: content?.metadata?.page_size,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const filePath = dealMinioUrl(getFilePath(curContent));
|
|
82
|
+
return {
|
|
83
|
+
filePath,
|
|
84
|
+
fileName: getFileName(curContent),
|
|
85
|
+
fileType: getFileType(curContent, filePath),
|
|
86
|
+
totalPages: curContent.pdfPages || 0,
|
|
87
|
+
token,
|
|
88
|
+
annotations,
|
|
89
|
+
initialPage,
|
|
90
|
+
initialZoom: getInitialZoom(598, curContent),
|
|
91
|
+
};
|
|
92
|
+
} else {
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
}, [content]);
|
|
96
|
+
|
|
97
|
+
const renderFileCom = useMemo(() => {
|
|
98
|
+
if (!curData.filePath) return <></>;
|
|
99
|
+
console.log('curData', curData);
|
|
100
|
+
return (
|
|
101
|
+
<GientechStreamReader
|
|
102
|
+
initialZoom={curData.initialZoom || 100}
|
|
103
|
+
convertedFilePath={curData.filePath}
|
|
104
|
+
fileName={curData.fileName}
|
|
105
|
+
fileType={curData.fileType}
|
|
106
|
+
initialPage={curData.initialPage}
|
|
107
|
+
totalPages={curData.totalPages}
|
|
108
|
+
authorization={curData.token}
|
|
109
|
+
annotations={curData.annotations}
|
|
110
|
+
streamApiUrl="/proxy/index/knowledgeBase/file/stream"
|
|
111
|
+
eventsEmit={name => {
|
|
112
|
+
switch (name) {
|
|
113
|
+
case 'viewer:close':
|
|
114
|
+
onClose();
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}}
|
|
118
|
+
tools={{
|
|
119
|
+
close: true,
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}, [curData]);
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<div
|
|
127
|
+
style={{
|
|
128
|
+
fontFamily: 'Source Han Sans CN',
|
|
129
|
+
fontSize: '12px',
|
|
130
|
+
}}
|
|
131
|
+
className="h-full w-full"
|
|
132
|
+
>
|
|
133
|
+
{renderFileCom}
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { getUrlPrefix } from '../utils';
|
|
2
|
+
import { Empty, Table, Pagination } from 'antd';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
const DrawerDatabase = ({ curFileInfo }: any) => {
|
|
7
|
+
const [pageNo, setPageNo] = useState(1);
|
|
8
|
+
const [pageSize, setPageSize] = useState(10);
|
|
9
|
+
const [columns, setColumn] = useState([]);
|
|
10
|
+
const [dataList, setDataList] = useState([]);
|
|
11
|
+
const [totalData, setTotalData] = useState(0);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const url = curFileInfo?.metadata?.fetchUrl || curFileInfo?.fetchUrl;
|
|
15
|
+
if (url) {
|
|
16
|
+
toGetDataBaseData(url);
|
|
17
|
+
}
|
|
18
|
+
}, [curFileInfo, pageNo, pageSize]);
|
|
19
|
+
|
|
20
|
+
const getDataBaseData = async ({ url, params }: any) => {
|
|
21
|
+
try {
|
|
22
|
+
const res = await axios.get(
|
|
23
|
+
`${getUrlPrefix()}${url}?${new URLSearchParams(params).toString()}`
|
|
24
|
+
);
|
|
25
|
+
const data = res?.data;
|
|
26
|
+
if (data) {
|
|
27
|
+
const { columns, dataList, totalData } = data;
|
|
28
|
+
setColumn(
|
|
29
|
+
(columns?.slice(1) || []).map((col: any) => ({
|
|
30
|
+
title: col.businessName,
|
|
31
|
+
dataIndex: col.physicalName,
|
|
32
|
+
key: col.physicalName,
|
|
33
|
+
}))
|
|
34
|
+
);
|
|
35
|
+
setDataList(dataList || []);
|
|
36
|
+
setTotalData(totalData || []);
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.log('error', error);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const toGetDataBaseData = async (url: string) => {
|
|
44
|
+
getDataBaseData({
|
|
45
|
+
url: `${url}`,
|
|
46
|
+
params: {
|
|
47
|
+
pageNo,
|
|
48
|
+
pageSize,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const renderTitle = () => {
|
|
54
|
+
const { file, metadata } = curFileInfo;
|
|
55
|
+
const { dataSourceType, databaseName, tableName, businessTableName } = metadata;
|
|
56
|
+
if (dataSourceType == 'DataTable') {
|
|
57
|
+
return `${databaseName} - ${businessTableName}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (dataSourceType == 'DirectDB') {
|
|
61
|
+
return `${databaseName} - ${tableName}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return file;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<div className="h-[52px] leading-[52px] font-bold text-[16px] px-[15px] overflow-hidden border-t-none border-l-none border-b-[1px] border-solid border-[rgb(222,226,230)]">
|
|
70
|
+
{renderTitle()}
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
{columns?.length > 0 ? (
|
|
74
|
+
<div>
|
|
75
|
+
<div className="p-4 overflow-auto h-[calc(100vh-120px)]">
|
|
76
|
+
<Table
|
|
77
|
+
columns={columns}
|
|
78
|
+
dataSource={dataList}
|
|
79
|
+
pagination={false}
|
|
80
|
+
scroll={{ x: 'max-content' }}
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
<div className="flex justify-end px-[18px]">
|
|
84
|
+
<Pagination
|
|
85
|
+
current={pageNo}
|
|
86
|
+
pageSize={pageSize}
|
|
87
|
+
responsive
|
|
88
|
+
simple
|
|
89
|
+
total={totalData}
|
|
90
|
+
showSizeChanger
|
|
91
|
+
showQuickJumper
|
|
92
|
+
onChange={(page, size) => {
|
|
93
|
+
setPageNo(page);
|
|
94
|
+
setPageSize(size || 10);
|
|
95
|
+
}}
|
|
96
|
+
onShowSizeChange={(current, size) => {
|
|
97
|
+
setPageNo(1);
|
|
98
|
+
setPageSize(size);
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
) : (
|
|
104
|
+
<Empty />
|
|
105
|
+
)}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default DrawerDatabase;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { KnowledgeGraphPreview, registerPreviewViewer } from '@mxmweb/nodegraph';
|
|
4
|
+
import DrawerTitle from './DrawerTitle';
|
|
5
|
+
registerPreviewViewer();
|
|
6
|
+
|
|
7
|
+
const DrawerGraphPreview = ({
|
|
8
|
+
curFileInfo,
|
|
9
|
+
onClose,
|
|
10
|
+
token,
|
|
11
|
+
}: {
|
|
12
|
+
curFileInfo: any;
|
|
13
|
+
onClose: any;
|
|
14
|
+
token: string;
|
|
15
|
+
}) => {
|
|
16
|
+
const config = {
|
|
17
|
+
title: '',
|
|
18
|
+
subtitle: '',
|
|
19
|
+
backgroundColor: '#f8f9fa',
|
|
20
|
+
showGrid: true,
|
|
21
|
+
showLegend: false,
|
|
22
|
+
showTooltip: true,
|
|
23
|
+
showFullscreen: false,
|
|
24
|
+
showMinimap: false,
|
|
25
|
+
};
|
|
26
|
+
const [graphList, setGraphList] = useState<any>({
|
|
27
|
+
nodeList: [],
|
|
28
|
+
edgeList: [],
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
console.log('curFileInfo', curFileInfo);
|
|
33
|
+
}, [curFileInfo]);
|
|
34
|
+
|
|
35
|
+
const getGraphData = async (curFileInfo: any) => {
|
|
36
|
+
if (!curFileInfo?.id || !curFileInfo?.cyphers || !curFileInfo?.fetchUrl) return;
|
|
37
|
+
try {
|
|
38
|
+
const { cyphers, fetchUrl, id } = curFileInfo || {};
|
|
39
|
+
console.log('getGraphData params', cyphers, fetchUrl, id);
|
|
40
|
+
|
|
41
|
+
const res = await axios.post(
|
|
42
|
+
fetchUrl,
|
|
43
|
+
{ cyphers, ontologyId: id },
|
|
44
|
+
{
|
|
45
|
+
headers: { Authorization: token },
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
console.log('getGraphData res', res);
|
|
49
|
+
setGraphList(res?.data || {});
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.log('error', error);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
getGraphData(curFileInfo);
|
|
56
|
+
}, [curFileInfo]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div>
|
|
60
|
+
<DrawerTitle title={curFileInfo?.graphName} setOpen={onClose} />
|
|
61
|
+
<div style={{ width: '100%', height: 'calc(100vh - 60px)' }}>
|
|
62
|
+
<KnowledgeGraphPreview
|
|
63
|
+
centerNode={{
|
|
64
|
+
vid: curFileInfo?.traceNode?.vid,
|
|
65
|
+
}}
|
|
66
|
+
data={graphList}
|
|
67
|
+
layout={{ type: 'force', linkDistance: 190 }}
|
|
68
|
+
title={config.title}
|
|
69
|
+
subtitle={config.subtitle}
|
|
70
|
+
backgroundColor={config.backgroundColor}
|
|
71
|
+
showGrid={config.showGrid}
|
|
72
|
+
showLegend={config.showLegend}
|
|
73
|
+
showTooltip={config.showTooltip}
|
|
74
|
+
showFullscreen={config.showFullscreen}
|
|
75
|
+
showMinimap={config.showMinimap}
|
|
76
|
+
customPlugins={{}}
|
|
77
|
+
onReady={(graph: any) => {
|
|
78
|
+
console.log('KnowledgeGraphPreview ready:', graph);
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default DrawerGraphPreview;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { dealMinioUrl, getFileName, getFilePath, getFileType, getInitialZoom } from '../utils';
|
|
3
|
+
import { GientechStreamReader } from '@gientech/modual/streamFilesReader';
|
|
4
|
+
|
|
5
|
+
const DrawerPreview = ({
|
|
6
|
+
curFileInfo,
|
|
7
|
+
onClose,
|
|
8
|
+
token,
|
|
9
|
+
}: {
|
|
10
|
+
curFileInfo: any;
|
|
11
|
+
onClose: any;
|
|
12
|
+
token: string;
|
|
13
|
+
}) => {
|
|
14
|
+
const curData = useMemo(() => {
|
|
15
|
+
if (curFileInfo && token) {
|
|
16
|
+
console.log('content999', curFileInfo);
|
|
17
|
+
const content = {
|
|
18
|
+
file_source: curFileInfo.url || curFileInfo.parse_url || curFileInfo.parsedFilePath,
|
|
19
|
+
file_type: curFileInfo.file_type,
|
|
20
|
+
metadata: {
|
|
21
|
+
source: curFileInfo.filePath || curFileInfo.url || curFileInfo?.metadata?.source || '',
|
|
22
|
+
page_size: curFileInfo?.metadata?.page_size,
|
|
23
|
+
},
|
|
24
|
+
pdfPages: curFileInfo.pdfPages,
|
|
25
|
+
};
|
|
26
|
+
const filePath = dealMinioUrl(getFilePath(content));
|
|
27
|
+
return {
|
|
28
|
+
filePath,
|
|
29
|
+
fileName: getFileName(content),
|
|
30
|
+
fileType: getFileType(content, filePath),
|
|
31
|
+
totalPages: content.pdfPages || 0,
|
|
32
|
+
token,
|
|
33
|
+
initialZoom: getInitialZoom(document.getElementById('pdfBox')?.clientWidth || 0, content),
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
}, [curFileInfo]);
|
|
39
|
+
|
|
40
|
+
const renderFileCom = useMemo(() => {
|
|
41
|
+
console.log('curData', curData);
|
|
42
|
+
if (!curData.filePath) return <></>;
|
|
43
|
+
return (
|
|
44
|
+
<GientechStreamReader
|
|
45
|
+
initialZoom={curData.initialZoom || 100}
|
|
46
|
+
convertedFilePath={curData.filePath}
|
|
47
|
+
fileName={curData.fileName}
|
|
48
|
+
fileType={curData.fileType}
|
|
49
|
+
initialPage={1}
|
|
50
|
+
totalPages={curData.totalPages}
|
|
51
|
+
authorization={curData.token}
|
|
52
|
+
streamApiUrl="/proxy/index/knowledgeBase/file/stream"
|
|
53
|
+
eventsEmit={type => {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case 'viewer:close':
|
|
56
|
+
onClose();
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}}
|
|
60
|
+
tools={{
|
|
61
|
+
close: true,
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}, [curData]);
|
|
66
|
+
return (
|
|
67
|
+
<div id="pdfBox" className="h-full overflow-y-auto">
|
|
68
|
+
{renderFileCom}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default DrawerPreview;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Close from '../../../../assets/img/close.png';
|
|
2
|
+
const DrawerTitle = ({ title, setOpen }: { title: string; setOpen: (arg: boolean) => void }) => {
|
|
3
|
+
return (
|
|
4
|
+
<div
|
|
5
|
+
style={{
|
|
6
|
+
width: '100%',
|
|
7
|
+
height: '60px',
|
|
8
|
+
borderBottom: '1px solid #EBEBEB',
|
|
9
|
+
padding: '20px',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
justifyContent: 'space-between',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
fontSize: '16px',
|
|
14
|
+
fontWeight: 600,
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<div>{title}</div>
|
|
18
|
+
<img
|
|
19
|
+
src={Close}
|
|
20
|
+
style={{ width: '16px', height: '16px', cursor: 'pointer' }}
|
|
21
|
+
onClick={() => setOpen(false)}
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export default DrawerTitle;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { BorderBottomOutlined } from "@ant-design/icons";
|
|
2
|
+
import { Button, ConfigProvider, Form, Input, Modal } from "antd";
|
|
3
|
+
import { useForm } from "antd/es/form/Form";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
|
|
6
|
+
export const RenameModal = ({
|
|
7
|
+
isModalOpen,
|
|
8
|
+
handleOk,
|
|
9
|
+
handleCancel,
|
|
10
|
+
data
|
|
11
|
+
}: any) => {
|
|
12
|
+
const modalStyles = {
|
|
13
|
+
header: {
|
|
14
|
+
height: "60px",
|
|
15
|
+
borderBottom: "1px solid #F0F0F0",
|
|
16
|
+
display: "flex",
|
|
17
|
+
paddingLeft: "24px",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
marginBottom: "16px"
|
|
20
|
+
},
|
|
21
|
+
title: { fontSize: "16px" },
|
|
22
|
+
body: { padding: "0 24px" },
|
|
23
|
+
mask: {},
|
|
24
|
+
footer: { marginTop: "0px", padding: "0 24px 16px 24px" },
|
|
25
|
+
content: { padding: 0 }
|
|
26
|
+
};
|
|
27
|
+
const [rename_form] = useForm();
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!isModalOpen) {
|
|
30
|
+
rename_form.resetFields();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
rename_form.setFieldValue("new_name", data?.label);
|
|
34
|
+
}, [data, isModalOpen]);
|
|
35
|
+
return (
|
|
36
|
+
<ConfigProvider
|
|
37
|
+
modal={{
|
|
38
|
+
styles: modalStyles
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<Modal
|
|
42
|
+
title={<div className="text-[16px]">编辑会话名称</div>}
|
|
43
|
+
closeIcon={null}
|
|
44
|
+
open={isModalOpen}
|
|
45
|
+
width={520}
|
|
46
|
+
centered
|
|
47
|
+
className="[&:[.ant-modal-content]]:bg-red"
|
|
48
|
+
footer={
|
|
49
|
+
<div className="mt-[16px] flex justify-end">
|
|
50
|
+
<Button
|
|
51
|
+
children="取消"
|
|
52
|
+
onClick={handleCancel}
|
|
53
|
+
className="mr-[8px]"
|
|
54
|
+
/>
|
|
55
|
+
<Button
|
|
56
|
+
children="确认"
|
|
57
|
+
onClick={async () => {
|
|
58
|
+
try {
|
|
59
|
+
const data = await rename_form.validateFields();
|
|
60
|
+
handleOk("ok_rename", data);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.log(e);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}}
|
|
66
|
+
type="primary"
|
|
67
|
+
className="border-none"
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
}
|
|
71
|
+
>
|
|
72
|
+
<Form form={rename_form}>
|
|
73
|
+
<Form.Item
|
|
74
|
+
name="new_name"
|
|
75
|
+
rules={[
|
|
76
|
+
{ required: true, message: "请输入" },
|
|
77
|
+
{ max: 100, message: "最大字数限制100" }
|
|
78
|
+
]}
|
|
79
|
+
>
|
|
80
|
+
<Input />
|
|
81
|
+
</Form.Item>
|
|
82
|
+
</Form>
|
|
83
|
+
</Modal>
|
|
84
|
+
</ConfigProvider>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { bgColor, textColor } from '../ReferenceListDrawer';
|
|
2
|
+
|
|
3
|
+
const TagCom = ({ i, item, j, clickTag }: any) => {
|
|
4
|
+
console.log('j in tag', j);
|
|
5
|
+
console.log('i in tag', i);
|
|
6
|
+
console.log('item in tag', item);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
key={j.id}
|
|
11
|
+
style={{
|
|
12
|
+
minWidth: '16px',
|
|
13
|
+
height: '16px',
|
|
14
|
+
backgroundColor: bgColor[item.key],
|
|
15
|
+
margin: '0 4px',
|
|
16
|
+
color: textColor[item.key],
|
|
17
|
+
display: 'flex',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
borderRadius: '2px',
|
|
21
|
+
fontSize: '12px',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
}}
|
|
24
|
+
onClick={() => clickTag && clickTag(i, j, item)}
|
|
25
|
+
>
|
|
26
|
+
{j.index}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
export default TagCom;
|