@@ -201,14 +201,12 @@ async function parseChatResponse2TaskDraft(message: string): Promise<Record<stri
201
201
202
202
// use helper function to make code more concise ;)
203
203
const createTaskGenerator =
204
- ( childCosts : object , finishedTask : TaskNode ) =>
205
- async ( execute : boolean , partialTask : partialTaskDraft ) => {
204
+ ( childCosts : object , finishedTask : TaskNode ) => async ( partialTask : partialTaskDraft ) => {
206
205
partialTask . debugging = { ...partialTask . debugging , ...childCosts }
207
206
const taskTemplate : Partial < TaskNode > = {
208
207
configuration : finishedTask . configuration ,
209
208
}
210
209
const newTask = deepMerge ( taskTemplate , partialTask )
211
- newTask . state = execute ? 'Open' : 'Completed'
212
210
return newTask
213
211
}
214
212
@@ -240,7 +238,7 @@ async function generateFollowupFromStructuredResponse(
240
238
241
239
if ( useTool ) {
242
240
console . log ( 'trying to get tool call from structured response' )
243
- const newTask = await generateFollowUpTask ( false , {
241
+ const newTask = await generateFollowUpTask ( {
244
242
role : 'assistant' ,
245
243
content : { structuredResponse : choice . message . content || '' } ,
246
244
} )
@@ -257,7 +255,7 @@ async function generateFollowupFromStructuredResponse(
257
255
const command = res . data
258
256
return [
259
257
newTask ,
260
- await generateFollowUpTask ( true , {
258
+ await generateFollowUpTask ( {
261
259
priorID : newTask . priorID ,
262
260
role : 'assistant' ,
263
261
content : { functionCall : command } ,
@@ -266,7 +264,7 @@ async function generateFollowupFromStructuredResponse(
266
264
} else {
267
265
return [
268
266
newTask ,
269
- await generateFollowUpTask ( true , {
267
+ await generateFollowUpTask ( {
270
268
priorID : newTask . priorID ,
271
269
role : 'system' ,
272
270
content : {
@@ -280,7 +278,7 @@ async function generateFollowupFromStructuredResponse(
280
278
// in the case that we don't call a tool, provide a "normal" answer :)
281
279
// this time we declare it as "Open" and set execution to "true"
282
280
return [
283
- await generateFollowUpTask ( true , {
281
+ await generateFollowUpTask ( {
284
282
role : 'assistant' ,
285
283
content : { structuredResponse : choice . message . content || '' } ,
286
284
} ) ,
@@ -335,7 +333,7 @@ async function generateFollowUpTasksFromResult(
335
333
if ( finishedTask . result ) {
336
334
if ( 'functionCall' in finishedTask . content ) {
337
335
return [
338
- await generateFollowUpTask ( true , {
336
+ await generateFollowUpTask ( {
339
337
role : 'system' ,
340
338
content : { toolResult : finishedTask . result } ,
341
339
} ) ,
@@ -354,7 +352,7 @@ async function generateFollowUpTasksFromResult(
354
352
if ( functionCall [ 0 ] ) {
355
353
// TODO: enable multiple parallel function calls
356
354
return [
357
- await generateFollowUpTask ( true , {
355
+ await generateFollowUpTask ( {
358
356
role : 'function' ,
359
357
content : { functionCall : functionCall [ 0 ] } ,
360
358
} ) ,
@@ -379,7 +377,7 @@ async function generateFollowUpTasksFromResult(
379
377
} else {
380
378
// if 'message' in finishedTask.content && finishedTask.role === 'assistant'
381
379
// this is the final response, so we simply add it to the chain without executing it
382
- const newTask = await generateFollowUpTask ( false , {
380
+ const newTask = await generateFollowUpTask ( {
383
381
role : 'assistant' ,
384
382
content : { message : choice . message . content } ,
385
383
} )
@@ -478,7 +476,6 @@ async function processTask(
478
476
void taskManager . updateTask (
479
477
{
480
478
id : taskId ,
481
- state : 'In Progress' ,
482
479
} ,
483
480
false ,
484
481
)
@@ -512,7 +509,6 @@ async function processTask(
512
509
// get token usage for this task..
513
510
await addTaskCostInformation ( task , taskManager , llmSettings , apiKey )
514
511
515
- task . state = 'Completed'
516
512
return task
517
513
}
518
514
@@ -640,7 +636,7 @@ export async function runTaskWorker(
640
636
// interrupt execution if interrupted flag is shown!
641
637
// this makes sure that results are still saved, even if we stop any
642
638
// further execution
643
- taskWorkerController . isInterrupted ( ) ? false : t . state == 'Open' ? true : false ,
639
+ taskWorkerController . isInterrupted ( ) ? false : true ,
644
640
)
645
641
llmSettings . selectedTaskId = newTaskId
646
642
}
@@ -658,10 +654,6 @@ export async function runTaskWorker(
658
654
)
659
655
}
660
656
661
- if ( task ) {
662
- task . state = 'Error'
663
- }
664
-
665
657
const errorTask : partialTaskDraft = {
666
658
role : 'system' ,
667
659
configuration : task ?. configuration ,
0 commit comments