feat: Submit Feedback #2088 (#2134)

### What problem does this PR solve?

feat: Submit Feedback #2088

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-28 16:39:21 +08:00
committed by GitHub
parent f843dd05e5
commit 54f7c6ea8e
10 changed files with 185 additions and 26 deletions

View File

@ -1,5 +1,4 @@
import CopyToClipboard from '@/components/copy-to-clipboard';
import { useSetModalState } from '@/hooks/common-hooks';
import {
DeleteOutlined,
DislikeOutlined,
@ -8,21 +7,33 @@ import {
SyncOutlined,
} from '@ant-design/icons';
import { Radio } from 'antd';
import { useCallback } from 'react';
import FeedbackModal from './feedback-modal';
import { useSendFeedback } from './hooks';
export const AssistantGroupButton = () => {
const { visible, hideModal, showModal } = useSetModalState();
interface IProps {
messageId: string;
content: string;
}
export const AssistantGroupButton = ({ messageId, content }: IProps) => {
const { visible, hideModal, showModal, onFeedbackOk, loading } =
useSendFeedback(messageId);
const handleLike = useCallback(() => {
onFeedbackOk({ thumbup: true });
}, [onFeedbackOk]);
return (
<>
<Radio.Group size="small">
<Radio.Button value="a">
<CopyToClipboard text="xxx"></CopyToClipboard>
<CopyToClipboard text={content}></CopyToClipboard>
</Radio.Button>
<Radio.Button value="b">
<SoundOutlined />
</Radio.Button>
<Radio.Button value="c">
<Radio.Button value="c" onClick={handleLike}>
<LikeOutlined />
</Radio.Button>
<Radio.Button value="d" onClick={showModal}>
@ -30,7 +41,12 @@ export const AssistantGroupButton = () => {
</Radio.Button>
</Radio.Group>
{visible && (
<FeedbackModal visible={visible} hideModal={hideModal}></FeedbackModal>
<FeedbackModal
visible={visible}
hideModal={hideModal}
onOk={onFeedbackOk}
loading={loading}
></FeedbackModal>
)}
</>
);