问答助手完成子组件反对填写反馈建议模态框确认按钮loading加载,增加confirmLoading状态,并改确认事件为异步,传递至父组件
问答助手解决Popconfirm气泡确认框不触发的问题,为Dify二次开发问答助手前端的Tooltip导致及Popconfirm需在Button按钮的上一级才可触发,将Dify的Tooltip更换成Ant Design的Tooltip,此气泡确认框的作用为取消赞成及取消反对时进行确认,而不是直接取消
This commit is contained in:
@@ -6,7 +6,7 @@ const { TextArea } = Input;
|
||||
|
||||
interface FeedbackModalProps {
|
||||
open: boolean;
|
||||
onOk: (selectedOption: number | null, feedbackText: string) => void;
|
||||
onOk: (selectedOption: number | null, feedbackText: string) => Promise<void>;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,20 @@ const FeedbackModal: React.FC<FeedbackModalProps> = ({ open, onOk, onCancel }) =
|
||||
const [selectedOption, setSelectedOption] = useState<number | null>(null);
|
||||
const [feedbackText, setFeedbackText] = useState<string>('');
|
||||
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<FeedbackModalProps> = ({ open, onOk, onCancel }) =
|
||||
onCancel={onCancel}
|
||||
okText={`${t('common.operation.confirm')}`}
|
||||
cancelText={`${t('common.operation.cancel')}`}
|
||||
confirmLoading={confirmLoading}
|
||||
>
|
||||
{/* <div>
|
||||
<Checkbox
|
||||
|
||||
@@ -690,7 +690,6 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
|
||||
}
|
||||
setIsFeedbackModalVisible(false)
|
||||
}}
|
||||
// feedbackText={}
|
||||
/>
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user