@@ -236,6 +236,13 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
236
236
const selectedTemplate = templates . find (
237
237
( t ) => t . id === selectedTemplateId ,
238
238
) as Template ;
239
+
240
+ // Extract AI prompt from selected preset
241
+ const selectedPreset = presets ?. find ( ( p ) => p . ID === selectedPresetId ) ;
242
+ const presetAIPrompt = selectedPreset ?. Parameters . find (
243
+ ( param ) => param . Name === "ai_prompt" ,
244
+ ) ?. Value ;
245
+ const isPromptReadOnly = ! ! presetAIPrompt ;
239
246
const {
240
247
externalAuth,
241
248
externalAuthError,
@@ -291,8 +298,7 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
291
298
292
299
const form = e . currentTarget ;
293
300
const formData = new FormData ( form ) ;
294
- const prompt = formData . get ( "prompt" ) as string ;
295
- const templateID = formData . get ( "templateID" ) as string ;
301
+ const prompt = presetAIPrompt || ( formData . get ( "prompt" ) as string ) ;
296
302
297
303
try {
298
304
await createTaskMutation . mutateAsync ( {
@@ -326,9 +332,13 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
326
332
required
327
333
id = "prompt"
328
334
name = "prompt"
335
+ value = { presetAIPrompt || undefined }
336
+ readOnly = { isPromptReadOnly }
329
337
placeholder = { textareaPlaceholder }
330
338
className = { `border-0 resize-none w-full h-full bg-transparent rounded-lg outline-none flex min-h-[60px]
331
- text-sm shadow-sm text-content-primary placeholder:text-content-secondary md:text-sm` }
339
+ text-sm shadow-sm text-content-primary placeholder:text-content-secondary md:text-sm ${
340
+ isPromptReadOnly ? "opacity-60 cursor-not-allowed" : ""
341
+ } `}
332
342
/>
333
343
< div className = "flex items-center justify-between pt-2" >
334
344
< div className = "flex items-center gap-4" >
0 commit comments