diff --git a/app/components/base/copy-btn/index.tsx b/app/components/base/copy-btn/index.tsx index 5159a96..92a01f3 100644 --- a/app/components/base/copy-btn/index.tsx +++ b/app/components/base/copy-btn/index.tsx @@ -4,7 +4,8 @@ import { t } from 'i18next' import { debounce } from 'lodash-es' import copy from 'copy-to-clipboard' import s from './style.module.css' -import Tooltip from '@/app/components/base/tooltip' +// import Tooltip from '@/app/components/base/tooltip' +import { Tooltip } from 'antd'; type ICopyBtnProps = { value: string @@ -31,8 +32,7 @@ const CopyBtn = ({ return (
{ return (
void; + onOk: (selectedOption: number | null, feedbackText: string) => Promise; onCancel: () => void; } @@ -14,12 +14,20 @@ const FeedbackModal: React.FC = ({ open, onOk, onCancel }) = const [selectedOption, setSelectedOption] = useState(null); const [feedbackText, setFeedbackText] = useState(''); const { t } = useTranslation() - const handleOk = () => { + const [confirmLoading, setConfirmLoading] = useState(false); + + const handleOk = async () => { if (!feedbackText) { message.warning('请填写反馈建议'); return; } - onOk(selectedOption, feedbackText); + setConfirmLoading(true) + try { + await onOk(selectedOption, feedbackText); + } finally { + setConfirmLoading(false) + } + }; return ( @@ -30,6 +38,7 @@ const FeedbackModal: React.FC = ({ open, onOk, onCancel }) = onCancel={onCancel} okText={`${t('common.operation.confirm')}`} cancelText={`${t('common.operation.cancel')}`} + confirmLoading={confirmLoading} > {/*
{ } setIsFeedbackModalVisible(false) }} - // feedbackText={} /> ), }; diff --git a/app/components/chat/answer/operation.tsx b/app/components/chat/answer/operation.tsx index cd7570a..df8d298 100644 --- a/app/components/chat/answer/operation.tsx +++ b/app/components/chat/answer/operation.tsx @@ -3,6 +3,7 @@ import { memo, useMemo, useState, + useCallback } from 'react' import { useTranslation } from 'react-i18next' import type { ChatItem } from '../../types' @@ -19,8 +20,9 @@ import { ThumbsDown, ThumbsUp, } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback' -import Tooltip from '@/app/components/base/tooltip' +// import Tooltip from '@/app/components/base/tooltip' import Log from '@/app/components/chat/log' +import { message, Popconfirm, Tooltip } from 'antd'; interface OperationProps { item: ChatItem @@ -80,6 +82,14 @@ const Operation: FC = ({ } } + const confirmCancelCallback = useCallback(async () => { + try { + await handleFeedback(null) + } finally { + message.success(localFeedback!.rating === 'like' ? `${t('appDebug.operation.cancelAgree')}成功` : `${t('appDebug.operation.cancelDisagree')}成功`) + } + }, [handleFeedback]) + const operationWidth = useMemo(() => { let width = 0 if (!isOpeningStatement) @@ -171,7 +181,7 @@ const Operation: FC = ({ { config?.supportFeedback && !localFeedback?.rating && onFeedback && !isOpeningStatement && (
- +
handleFeedback('like')} @@ -180,7 +190,7 @@ const Operation: FC = ({
= ({ { config?.supportFeedback && localFeedback?.rating && onFeedback && !isOpeningStatement && ( -
handleFeedback(null)} + - { - localFeedback.rating === 'like' && ( - - ) - } - { - localFeedback.rating === 'dislike' && ( - - ) - } -
+ + +
) }