From c2bbd4e31cca73bb75c38791d06e58e2a061c760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E8=A5=BF?= Date: Thu, 28 May 2026 17:23:00 +0800 Subject: [PATCH] fix(desktop): keep workflow cancel in current window --- ui/desktop/src/components/ParameterInputModal.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ui/desktop/src/components/ParameterInputModal.tsx b/ui/desktop/src/components/ParameterInputModal.tsx index 78d07091165c..382634804ed7 100644 --- a/ui/desktop/src/components/ParameterInputModal.tsx +++ b/ui/desktop/src/components/ParameterInputModal.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; +import { useNavigate } from 'react-router-dom'; import { Parameter } from '../recipe'; import { Button } from './ui/button'; -import { getInitialWorkingDir } from '../utils/workingDir'; import { defineMessages, useIntl } from '../i18n'; const i18n = defineMessages({ @@ -69,6 +69,7 @@ const ParameterInputModal: React.FC = ({ initialValues, }) => { const intl = useIntl(); + const navigate = useNavigate(); const [inputValues, setInputValues] = useState>({}); const [validationErrors, setValidationErrors] = useState>({}); const [showCancelOptions, setShowCancelOptions] = useState(false); @@ -126,14 +127,7 @@ const ParameterInputModal: React.FC = ({ const handleCancelOption = (option: 'new-chat' | 'back-to-form'): void => { if (option === 'new-chat') { - try { - const workingDir = getInitialWorkingDir(); - window.electron.createChatWindow({ dir: workingDir }); - window.electron.hideWindow(); - } catch (error) { - console.error('Error creating new window:', error); - onClose(); - } + navigate('/pair'); } else { setShowCancelOptions(false); // Go back to the parameter form }