mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-04 11:24:00 +08:00
### What problem does this PR solve? feat: Add FeedbackModal #2088 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
99af1cbeac
commit
b4a5d83b44
37
web/src/components/message-item/feedback-modal.tsx
Normal file
37
web/src/components/message-item/feedback-modal.tsx
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { Form, Input, Modal } from 'antd';
|
||||||
|
|
||||||
|
import { IModalProps } from '@/interfaces/common';
|
||||||
|
|
||||||
|
type FieldType = {
|
||||||
|
username?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const FeedbackModal = ({ visible, hideModal }: IModalProps<any>) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
const handleOk = async () => {
|
||||||
|
const ret = await form.validateFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal title="Feedback" open={visible} onOk={handleOk} onCancel={hideModal}>
|
||||||
|
<Form
|
||||||
|
name="basic"
|
||||||
|
labelCol={{ span: 0 }}
|
||||||
|
wrapperCol={{ span: 24 }}
|
||||||
|
style={{ maxWidth: 600 }}
|
||||||
|
autoComplete="off"
|
||||||
|
form={form}
|
||||||
|
>
|
||||||
|
<Form.Item<FieldType>
|
||||||
|
name="username"
|
||||||
|
rules={[{ required: true, message: 'Please input your username!' }]}
|
||||||
|
>
|
||||||
|
<Input.TextArea rows={8} placeholder="Please input your username!" />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FeedbackModal;
|
53
web/src/components/message-item/group-button.tsx
Normal file
53
web/src/components/message-item/group-button.tsx
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import CopyToClipboard from '@/components/copy-to-clipboard';
|
||||||
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
|
import {
|
||||||
|
DeleteOutlined,
|
||||||
|
DislikeOutlined,
|
||||||
|
LikeOutlined,
|
||||||
|
SoundOutlined,
|
||||||
|
SyncOutlined,
|
||||||
|
} from '@ant-design/icons';
|
||||||
|
import { Radio } from 'antd';
|
||||||
|
import FeedbackModal from './feedback-modal';
|
||||||
|
|
||||||
|
export const AssistantGroupButton = () => {
|
||||||
|
const { visible, hideModal, showModal } = useSetModalState();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Radio.Group size="small">
|
||||||
|
<Radio.Button value="a">
|
||||||
|
<CopyToClipboard text="xxx"></CopyToClipboard>
|
||||||
|
</Radio.Button>
|
||||||
|
<Radio.Button value="b">
|
||||||
|
<SoundOutlined />
|
||||||
|
</Radio.Button>
|
||||||
|
<Radio.Button value="c">
|
||||||
|
<LikeOutlined />
|
||||||
|
</Radio.Button>
|
||||||
|
<Radio.Button value="d" onClick={showModal}>
|
||||||
|
<DislikeOutlined />
|
||||||
|
</Radio.Button>
|
||||||
|
</Radio.Group>
|
||||||
|
{visible && (
|
||||||
|
<FeedbackModal visible={visible} hideModal={hideModal}></FeedbackModal>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const UserGroupButton = () => {
|
||||||
|
return (
|
||||||
|
<Radio.Group size="small">
|
||||||
|
<Radio.Button value="a">
|
||||||
|
<CopyToClipboard text="xxx"></CopyToClipboard>
|
||||||
|
</Radio.Button>
|
||||||
|
<Radio.Button value="b">
|
||||||
|
<SyncOutlined />
|
||||||
|
</Radio.Button>
|
||||||
|
<Radio.Button value="c">
|
||||||
|
<DeleteOutlined />
|
||||||
|
</Radio.Button>
|
||||||
|
</Radio.Group>
|
||||||
|
);
|
||||||
|
};
|
@ -13,10 +13,11 @@ import {
|
|||||||
} from '@/hooks/document-hooks';
|
} from '@/hooks/document-hooks';
|
||||||
import MarkdownContent from '@/pages/chat/markdown-content';
|
import MarkdownContent from '@/pages/chat/markdown-content';
|
||||||
import { getExtension, isImage } from '@/utils/document-util';
|
import { getExtension, isImage } from '@/utils/document-util';
|
||||||
import { Avatar, Button, Flex, List, Typography } from 'antd';
|
import { Avatar, Button, Flex, List, Space, Typography } from 'antd';
|
||||||
import FileIcon from '../file-icon';
|
import FileIcon from '../file-icon';
|
||||||
import IndentedTreeModal from '../indented-tree/modal';
|
import IndentedTreeModal from '../indented-tree/modal';
|
||||||
import NewDocumentLink from '../new-document-link';
|
import NewDocumentLink from '../new-document-link';
|
||||||
|
import { AssistantGroupButton, UserGroupButton } from './group-button';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
@ -109,7 +110,15 @@ const MessageItem = ({
|
|||||||
<AssistantIcon></AssistantIcon>
|
<AssistantIcon></AssistantIcon>
|
||||||
)}
|
)}
|
||||||
<Flex vertical gap={8} flex={1}>
|
<Flex vertical gap={8} flex={1}>
|
||||||
<b>{isAssistant ? '' : nickname}</b>
|
<Space>
|
||||||
|
{isAssistant ? (
|
||||||
|
<AssistantGroupButton></AssistantGroupButton>
|
||||||
|
) : (
|
||||||
|
<UserGroupButton></UserGroupButton>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* <b>{isAssistant ? '' : nickname}</b> */}
|
||||||
|
</Space>
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
isAssistant ? styles.messageText : styles.messageUserText
|
isAssistant ? styles.messageText : styles.messageUserText
|
||||||
|
Loading…
x
Reference in New Issue
Block a user