@@ -19,6 +19,7 @@ import TextArea from 'antd/es/input/TextArea';
1919import FileSelectorButton from './FileSelectorButton' ;
2020import { useMutation } from '@tanstack/react-query' ;
2121import first from 'lodash/first' ;
22+ import ResetIcon from './ResetIcon' ;
2223
2324const { Title } = Typography ;
2425
@@ -254,6 +255,33 @@ const Prompt = () => {
254255 setPrompt = { setPrompt }
255256 />
256257 }
258+ < RestoreDefaultBtn
259+ icon = { < ResetIcon /> }
260+ type = "link"
261+ onClick = { ( ) => {
262+ return Modal . warning ( {
263+ title : 'Restore Default Prompt' ,
264+ closable : true ,
265+ content : < > { 'Are you sure you want to restore to the default prompt? Your current prompt will be lost.' } </ > ,
266+ footer : (
267+ < ModalButtonGroup gap = { 8 } justify = 'end' >
268+ < Button onClick = { ( ) => Modal . destroyAll ( ) } > { 'Cancel' } </ Button >
269+ < Button
270+ onClick = { ( ) => {
271+ form . setFieldValue ( 'custom_prompt' , defaultPromptRef . current )
272+ Modal . destroyAll ( )
273+ } }
274+ type = 'primary'
275+ >
276+ { 'Confirm' }
277+ </ Button >
278+ </ ModalButtonGroup >
279+ ) ,
280+ maskClosable : true ,
281+ } )
282+ } } >
283+ { 'Restore' }
284+ </ RestoreDefaultBtn >
257285 </ Flex >
258286 </ div >
259287 }
@@ -263,31 +291,7 @@ const Prompt = () => {
263291 >
264292 < StyledTextArea autoSize placeholder = { 'Enter a prompt' } />
265293 </ StyledPromptFormItem >
266- < RestoreDefaultBtn
267- onClick = { ( ) => {
268- return Modal . warning ( {
269- title : 'Restore Default Prompt' ,
270- closable : true ,
271- content : < > { 'Are you sure you want to restore to the default prompt? Your current prompt will be lost.' } </ > ,
272- footer : (
273- < ModalButtonGroup gap = { 8 } justify = 'end' >
274- < Button onClick = { ( ) => Modal . destroyAll ( ) } > { 'Cancel' } </ Button >
275- < Button
276- onClick = { ( ) => {
277- form . setFieldValue ( 'custom_prompt' , defaultPromptRef . current )
278- Modal . destroyAll ( )
279- } }
280- type = 'primary'
281- >
282- { 'Confirm' }
283- </ Button >
284- </ ModalButtonGroup >
285- ) ,
286- maskClosable : true ,
287- } )
288- } } >
289- { 'Restore' }
290- </ RestoreDefaultBtn >
294+
291295
292296 </ div >
293297 { ( ( workflow_type === WorkflowType . CUSTOM_DATA_GENERATION && ! isEmpty ( doc_paths ) ) ||
0 commit comments