This commit is contained in:
Archer
2023-12-11 15:12:14 +08:00
committed by GitHub
parent 84cf6b5658
commit d2d7eac9e0
105 changed files with 1091 additions and 801 deletions

View File

@@ -3,13 +3,15 @@ import { ModalBody, Textarea, ModalFooter, Button } from '@chakra-ui/react';
import MyModal from '../MyModal';
import { useRequest } from '@/web/common/hooks/useRequest';
import { useTranslation } from 'next-i18next';
import { userUpdateChatFeedback } from '@/web/core/chat/api';
import { updateChatUserFeedback } from '@/web/core/chat/api';
const FeedbackModal = ({
chatId,
chatItemId,
onSuccess,
onClose
}: {
chatId: string;
chatItemId: string;
onSuccess: (e: string) => void;
onClose: () => void;
@@ -19,14 +21,15 @@ const FeedbackModal = ({
const { mutate, isLoading } = useRequest({
mutationFn: async () => {
const val = ref.current?.value || 'N/A';
return userUpdateChatFeedback({
const val = ref.current?.value || t('core.chat.feedback.No Content');
return updateChatUserFeedback({
chatId,
chatItemId,
userFeedback: val
userBadFeedback: val
});
},
onSuccess() {
onSuccess(ref.current?.value || 'N/A');
onSuccess(ref.current?.value || t('core.chat.feedback.No Content'));
},
successToast: t('chat.Feedback Success'),
errorToast: t('chat.Feedback Failed')
@@ -40,11 +43,7 @@ const FeedbackModal = ({
title={t('chat.Feedback Modal')}
>
<ModalBody>
<Textarea
ref={ref}
rows={10}
placeholder={t('chat.Feedback Modal Tip') || 'chat.Feedback Modal Tip'}
/>
<Textarea ref={ref} rows={10} placeholder={t('chat.Feedback Modal Tip')} />
</ModalBody>
<ModalFooter>
<Button variant={'base'} mr={2} onClick={onClose}>