agent.start.ts 418 B

123456789101112131415161718192021
  1. import { AgentTaskStep } from "./agent.task";
  2. /**
  3. * 任务执行函数
  4. */
  5. export async function TaskExecutor(taskStepList:AgentTaskStep[]){
  6. for (let index = 0; index < taskStepList.length; index++) {
  7. let step = taskStepList[index];
  8. let result = await step.handle()
  9. if(result == false) {break;}
  10. if(step.error){
  11. break;
  12. }
  13. if(!step.error){ // 任务执行正常,无Error
  14. }
  15. }
  16. }