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