@@ -206,7 +206,7 @@ const TaskFormSection: FC<{
206
206
) ;
207
207
} ;
208
208
209
- type CreateTaskMutationFnProps = { prompt :string ; templateId : string } ;
209
+ type CreateTaskMutationFnProps = { prompt :string ; template : Template } ;
210
210
211
211
type TaskFormProps = {
212
212
templates :Template [ ] ;
@@ -236,8 +236,8 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
236
236
:true ;
237
237
238
238
const createTaskMutation = useMutation ( {
239
- mutationFn :async ( { prompt, templateId } :CreateTaskMutationFnProps ) =>
240
- data . createTask ( prompt , user . id , templateId ) ,
239
+ mutationFn :async ( { prompt, template } :CreateTaskMutationFnProps ) =>
240
+ data . createTask ( prompt , user . id , template . id , template . active_version_id ) ,
241
241
onSuccess :async ( task ) => {
242
242
await queryClient . invalidateQueries ( {
243
243
queryKey :[ "tasks" ] ,
@@ -257,7 +257,7 @@ const TaskForm: FC<TaskFormProps> = ({ templates, onSuccess }) => {
257
257
try {
258
258
await createTaskMutation . mutateAsync ( {
259
259
prompt,
260
- templateId : templateID ,
260
+ template : selectedTemplate ,
261
261
} ) ;
262
262
} catch ( error ) {
263
263
const message = getErrorMessage ( error , "Error creating task" ) ;
@@ -601,10 +601,15 @@ export const data = {
601
601
prompt :string ,
602
602
userId :string ,
603
603
templateId :string ,
604
+ templateVersionId :string ,
604
605
) :Promise < Task > {
606
+ const presets = await API . getTemplateVersionPresets ( templateVersionId ) ;
607
+ const defaultPreset = presets . find ( ( p ) => p . Default ) ;
605
608
const workspace = await API . createWorkspace ( userId , {
606
609
name :`task-${ generateWorkspaceName ( ) } ` ,
607
610
template_id :templateId ,
611
+ template_version_id :templateVersionId ,
612
+ template_version_preset_id :defaultPreset ?. ID ,
608
613
rich_parameter_values :[
609
614
{ name :AI_PROMPT_PARAMETER_NAME , value :prompt } ,
610
615
] ,