setIsHovered(true)}
31 | onMouseLeave={() => setIsHovered(false)}
32 | >
33 |
39 |
:
}
45 | />
46 | {props.resource &&
47 | props.resource.map((item, index) => (
48 |
57 | ))}
58 | {!isUserContent &&
59 | (props.content === '' ? (
60 |
61 | ) : (
62 |
63 | ))}
64 | {isUserContent &&
}
65 |
66 | {!isUserContent && (
67 |
68 | {isHovered && (
69 |
70 | {
73 | message.success('复制成功');
74 | copyContent(props.content);
75 | }}
76 | />
77 |
78 | )}
79 | {isHovered && (
80 |
81 |
82 |
83 | )}
84 |
85 | )}
86 |
87 | );
88 | };
89 |
90 | export default ChatMessage;
91 |
--------------------------------------------------------------------------------
/know-hub-ai-ui/src/component/ChatMessage/index.css:
--------------------------------------------------------------------------------
1 | .message-box {
2 | margin: 5px;
3 | display: flex;
4 | flex-direction: column;
5 | }
6 |
7 | .content-container {
8 | min-height: 40px;
9 | padding: 10px;
10 | border-radius: 12px;
11 | background-color: var(--antd-wave-shadow-color);
12 | display: flex;
13 | flex-direction: column;
14 | justify-content: end;
15 | max-width: 100%;
16 | white-space: pre-wrap;
17 | word-wrap: break-word;
18 | word-break: break-word;
19 | font-size: 18px;
20 | }
21 |
22 | .assistant-tool {
23 | height: 25px;
24 | display: flex;
25 | gap: 10px;
26 | margin: 0px 0px 0px 10px;
27 | }
28 |
--------------------------------------------------------------------------------
/know-hub-ai-ui/src/component/ChatMessage/index.ts:
--------------------------------------------------------------------------------
1 | import ChatMessage from './ChatMessage';
2 |
3 | export default ChatMessage;
4 |
--------------------------------------------------------------------------------
/know-hub-ai-ui/src/component/ChatWindow/index.css:
--------------------------------------------------------------------------------
1 | .chat-window-box {
2 | width: 1200px;
3 | height: 100%;
4 | border-radius: 10px;
5 | display: flex;
6 | flex-direction: column;
7 | justify-content: space-between;
8 | align-items: center;
9 | box-shadow: 0 1px 1px 0px rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
10 | }
11 |
--------------------------------------------------------------------------------
/know-hub-ai-ui/src/component/ChatWindow/index.ts:
--------------------------------------------------------------------------------
1 | import ChatWindow from './ChatWindow';
2 |
3 | export default ChatWindow;
4 |
--------------------------------------------------------------------------------
/know-hub-ai-ui/src/component/KnowledgeForm/KnowledgeForm.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | ModalForm,
3 | ProFormText,
4 | ProFormTextArea,
5 | } from '@ant-design/pro-components';
6 | import { Button } from 'antd';
7 | import { ReactNode } from 'react';
8 |
9 | interface Props {
10 | type: 'add' | 'update';
11 | title: string;
12 | btnIcon?: ReactNode;
13 | btnName: string;
14 | serverOptions?: { label: string; value: string }[];
15 | onFinish: (formData: any) => Promise