File tree Expand file tree Collapse file tree
packages/browseros-agent/apps/agent/entrypoints/app/scheduled-tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ export const NewScheduledTaskDialog: FC<NewScheduledTaskDialogProps> = ({
117117 const [ isRefining , setIsRefining ] = useState ( false )
118118 const originalPromptRef = useRef < string | null > ( null )
119119 const refineRequestIdRef = useRef ( 0 )
120+ const isProgrammaticChange = useRef ( false )
120121
121122 // Load providers from storage
122123 useEffect ( ( ) => {
@@ -187,9 +188,11 @@ export const NewScheduledTaskDialog: FC<NewScheduledTaskDialogProps> = ({
187188 'textarea[name="query"]' ,
188189 ) as HTMLTextAreaElement
189190 if ( textarea ) {
191+ isProgrammaticChange . current = true
190192 textarea . focus ( )
191193 textarea . select ( )
192194 document . execCommand ( 'insertText' , false , value )
195+ isProgrammaticChange . current = false
193196 } else {
194197 form . setValue ( 'query' , value )
195198 }
@@ -305,6 +308,15 @@ export const NewScheduledTaskDialog: FC<NewScheduledTaskDialogProps> = ({
305308 placeholder = "What should the agent do? e.g., Check my email and summarize important messages"
306309 className = "min-h-[100px] resize-none"
307310 { ...field }
311+ onChange = { ( e ) => {
312+ field . onChange ( e )
313+ if (
314+ ! isProgrammaticChange . current &&
315+ originalPromptRef . current !== null
316+ ) {
317+ originalPromptRef . current = null
318+ }
319+ } }
308320 />
309321 </ FormControl >
310322 { ! isRefining && originalPromptRef . current !== null ? (
You can’t perform that action at this time.
0 commit comments