From 26cd7f7e8f914105ab49e7099fb3b750cf1bbb79 Mon Sep 17 00:00:00 2001 From: wenyongda Date: Wed, 23 Jul 2025 17:28:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E7=AD=94=E5=8A=A9=E6=89=8B=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=AD=90=E7=BB=84=E4=BB=B6=E5=8F=8D=E5=AF=B9=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E5=8F=8D=E9=A6=88=E5=BB=BA=E8=AE=AE=E6=A8=A1=E6=80=81?= =?UTF-8?q?=E6=A1=86=E7=A1=AE=E8=AE=A4=E6=8C=89=E9=92=AEloading=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=EF=BC=8C=E5=A2=9E=E5=8A=A0confirmLoading=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8C=E5=B9=B6=E6=94=B9=E7=A1=AE=E8=AE=A4=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E4=B8=BA=E5=BC=82=E6=AD=A5=EF=BC=8C=E4=BC=A0=E9=80=92?= =?UTF-8?q?=E8=87=B3=E7=88=B6=E7=BB=84=E4=BB=B6=20=E9=97=AE=E7=AD=94?= =?UTF-8?q?=E5=8A=A9=E6=89=8B=E8=A7=A3=E5=86=B3Popconfirm=E6=B0=94?= =?UTF-8?q?=E6=B3=A1=E7=A1=AE=E8=AE=A4=E6=A1=86=E4=B8=8D=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=B8=BADify=E4=BA=8C?= =?UTF-8?q?=E6=AC=A1=E5=BC=80=E5=8F=91=E9=97=AE=E7=AD=94=E5=8A=A9=E6=89=8B?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E7=9A=84Tooltip=E5=AF=BC=E8=87=B4=E5=8F=8APo?= =?UTF-8?q?pconfirm=E9=9C=80=E5=9C=A8Button=E6=8C=89=E9=92=AE=E7=9A=84?= =?UTF-8?q?=E4=B8=8A=E4=B8=80=E7=BA=A7=E6=89=8D=E5=8F=AF=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=EF=BC=8C=E5=B0=86Dify=E7=9A=84Tooltip=E6=9B=B4=E6=8D=A2?= =?UTF-8?q?=E6=88=90Ant=20Design=E7=9A=84Tooltip=EF=BC=8C=E6=AD=A4?= =?UTF-8?q?=E6=B0=94=E6=B3=A1=E7=A1=AE=E8=AE=A4=E6=A1=86=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E7=94=A8=E4=B8=BA=E5=8F=96=E6=B6=88=E8=B5=9E=E6=88=90=E5=8F=8A?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=8F=8D=E5=AF=B9=E6=97=B6=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/base/copy-btn/index.tsx | 6 +- app/components/base/regenerate-btn/index.tsx | 5 +- .../chat-with-history/FeedbackModal.tsx | 15 ++++- app/components/chat-with-history/hooks.tsx | 1 - app/components/chat/answer/operation.tsx | 64 ++++++++++++------- 5 files changed, 60 insertions(+), 31 deletions(-) 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' && ( - - ) - } -
+ + +
) }