fm-agent-task.component.mjs 10 KB

12345678910
  1. /**
  2. * @copyright © 未来飞马 © 未来全栈 www.fmode.cn
  3. * 版权所有 © 未来飞马 © 江西脑控科技有限公司 Copyright © Fmode Technology Co., Ltd.
  4. * 保留所有权利 All Rights Reserved.
  5. * /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2022/lib/aigc/agent/fm-agent-task/fm-agent-task.component.mjs
  6. */
  7. import{CommonModule}from"@angular/common";import{Component,Inject,ViewChild}from"@angular/core";import{FormsModule}from"@angular/forms";import{MatButtonModule}from"@angular/material/button";import{MatDialogModule,MatDialogRef,MAT_DIALOG_DATA}from"@angular/material/dialog";import{MatFormFieldModule}from"@angular/material/form-field";import{MatInputModule}from"@angular/material/input";import{MatProgressBarModule}from"@angular/material/progress-bar";import{MatStepper,MatStepperModule}from"@angular/material/stepper";import*as i0 from"@angular/core";import*as i1 from"@angular/material/dialog";import*as i2 from"@angular/common";import*as i3 from"@angular/material/button";import*as i4 from"@angular/material/stepper";import*as i5 from"@angular/material/progress-bar";export class FmAgentTaskComponent{constructor(t,e){this.dialogRef=t,this.data=e,this.enabledClose=!1,this.currentStepIndex=0,this.hasError=!1,console.log(this.data?.stepsList)}ngOnInit(){this.startTask()}async startTask(t){if(t&&(this.currentStepIndex=t),this.data.stepsList){for(;this.currentStepIndex<this.data.stepsList?.length;this.currentStepIndex++){let t=this.data.stepsList?.[this.currentStepIndex];if(console.log("this.currentStepIndex",this.currentStepIndex),t?.simulatorProgress(),t.parentComp=this,t.parentIndex=Number(this.currentStepIndex.toFixed(0)),t?.limitStart)break;if(t?.handle){let e=await(t?.handle());if(t.cancelAll){this.dialogRef.close();break}if(0==e)break;t.error||(t.progressSub$?.unsubscribe(),t.progress=1,this.stepper?.next())}}let t=!1;this.data?.stepsList.forEach(((e,o)=>{e?.error&&(t=!0,this.hasError=!0)})),t||(this.enabledClose=!0)}}onNoClick(){this.dialogRef.close()}static{this.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:FmAgentTaskComponent,deps:[{token:i1.MatDialogRef},{token:MAT_DIALOG_DATA}],target:i0.ɵɵFactoryTarget.Component})}static{this.ɵcmp=i0.ɵɵngDeclareComponent({minVersion:"14.0.0",version:"17.3.12",type:FmAgentTaskComponent,isStandalone:!0,selector:"fm-agent-task",viewQueries:[{propertyName:"stepper",first:!0,predicate:MatStepper,descendants:!0}],ngImport:i0,template:'\n<h2 mat-dialog-title *ngIf="!enabledClose">AI生成中</h2>\n<h2 mat-dialog-title *ngIf="enabledClose">任务已完成</h2>\n<mat-dialog-content>\n \n <mat-stepper #stepper orientation="vertical">\n <mat-step *ngFor="let step of data?.stepsList; let index=index;">\n <ng-template matStepLabel>{{step?.title}}</ng-template>\n <ng-template matStepContent>\n <p *ngIf="step?.message">{{step?.message}}</p>\n <p *ngFor="let log of step?.logList">{{log}}</p>\n <button *ngIf="step?.error" mat-button color="warn">{{step?.error}}</button>\n <mat-progress-bar *ngIf="step?.progress!=1&&!step?.limitStart" [color]="step?.error?\'warn\':\'primary\'"\n [mode]="(step?.progress || 1)>=100?\'indeterminate\':\'buffer\'" [value]="step?.progress" [bufferValue]="(step?.progress || 0) + 10"></mat-progress-bar>\n\n\n\n \x3c!-- 自定义按钮区域 --\x3e\n <ng-container *ngFor="let button of step?.buttons">\n <button *ngIf="button.isShow&&button.isShow()" mat-raised-button [color]="button?.color||\'primary\'" (click)="button?.handle()">{{button?.name}}</button>\n </ng-container>\n\n <button mat-button color="warn" *ngIf="step?.restartButtonShow" (click)="startTask(index)">重试</button>\n \x3c!-- 非首项:上一步 --\x3e\n <button mat-button matStepperPrevious *ngIf="index!=0">上一步</button>\n \x3c!-- 非末项:下一步 --\x3e\n <button mat-button matStepperNext *ngIf="(index+1!=data?.stepsList?.length)&&!step?.error">下一步</button>\n </ng-template>\n </mat-step>\n\n </mat-stepper>\n \n \n</mat-dialog-content>\n<mat-dialog-actions [align]="\'end\'" style="display: flex;justify-content: center;">\n \x3c!-- <button mat-button (click)="onNoClick()">No Thanks</button> --\x3e\n <button style="font-size: 20px;" *ngIf="hasError" mat-button color="warn" [mat-dialog-close]="false" cdkFocusInitial>取消</button>\n <button style="font-size: 20px;" *ngIf="enabledClose" mat-button color="primary" [mat-dialog-close]="true" cdkFocusInitial>完成</button>\n</mat-dialog-actions>\n\n',styles:["h2{text-align:center;background-color:#6e23ce}\n"],dependencies:[{kind:"ngmodule",type:CommonModule},{kind:"directive",type:i2.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{kind:"directive",type:i2.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{kind:"ngmodule",type:FormsModule},{kind:"ngmodule",type:MatDialogModule},{kind:"directive",type:i1.MatDialogClose,selector:"[mat-dialog-close], [matDialogClose]",inputs:["aria-label","type","mat-dialog-close","matDialogClose"],exportAs:["matDialogClose"]},{kind:"directive",type:i1.MatDialogTitle,selector:"[mat-dialog-title], [matDialogTitle]",inputs:["id"],exportAs:["matDialogTitle"]},{kind:"directive",type:i1.MatDialogActions,selector:"[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",inputs:["align"]},{kind:"directive",type:i1.MatDialogContent,selector:"[mat-dialog-content], mat-dialog-content, [matDialogContent]"},{kind:"ngmodule",type:MatFormFieldModule},{kind:"ngmodule",type:MatInputModule},{kind:"ngmodule",type:MatButtonModule},{kind:"component",type:i3.MatButton,selector:" button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ",exportAs:["matButton"]},{kind:"ngmodule",type:MatStepperModule},{kind:"component",type:i4.MatStep,selector:"mat-step",inputs:["color"],exportAs:["matStep"]},{kind:"directive",type:i4.MatStepLabel,selector:"[matStepLabel]"},{kind:"component",type:i4.MatStepper,selector:"mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]",inputs:["disableRipple","color","labelPosition","headerPosition","animationDuration"],outputs:["animationDone"],exportAs:["matStepper","matVerticalStepper","matHorizontalStepper"]},{kind:"directive",type:i4.MatStepperNext,selector:"button[matStepperNext]"},{kind:"directive",type:i4.MatStepperPrevious,selector:"button[matStepperPrevious]"},{kind:"directive",type:i4.MatStepContent,selector:"ng-template[matStepContent]"},{kind:"ngmodule",type:MatProgressBarModule},{kind:"component",type:i5.MatProgressBar,selector:"mat-progress-bar",inputs:["color","value","bufferValue","mode"],outputs:["animationEnd"],exportAs:["matProgressBar"]}]})}}i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"17.3.12",ngImport:i0,type:FmAgentTaskComponent,decorators:[{type:Component,args:[{selector:"fm-agent-task",standalone:!0,imports:[CommonModule,FormsModule,MatDialogModule,MatFormFieldModule,MatInputModule,MatButtonModule,MatStepperModule,MatProgressBarModule],template:'\n<h2 mat-dialog-title *ngIf="!enabledClose">AI生成中</h2>\n<h2 mat-dialog-title *ngIf="enabledClose">任务已完成</h2>\n<mat-dialog-content>\n \n <mat-stepper #stepper orientation="vertical">\n <mat-step *ngFor="let step of data?.stepsList; let index=index;">\n <ng-template matStepLabel>{{step?.title}}</ng-template>\n <ng-template matStepContent>\n <p *ngIf="step?.message">{{step?.message}}</p>\n <p *ngFor="let log of step?.logList">{{log}}</p>\n <button *ngIf="step?.error" mat-button color="warn">{{step?.error}}</button>\n <mat-progress-bar *ngIf="step?.progress!=1&&!step?.limitStart" [color]="step?.error?\'warn\':\'primary\'"\n [mode]="(step?.progress || 1)>=100?\'indeterminate\':\'buffer\'" [value]="step?.progress" [bufferValue]="(step?.progress || 0) + 10"></mat-progress-bar>\n\n\n\n \x3c!-- 自定义按钮区域 --\x3e\n <ng-container *ngFor="let button of step?.buttons">\n <button *ngIf="button.isShow&&button.isShow()" mat-raised-button [color]="button?.color||\'primary\'" (click)="button?.handle()">{{button?.name}}</button>\n </ng-container>\n\n <button mat-button color="warn" *ngIf="step?.restartButtonShow" (click)="startTask(index)">重试</button>\n \x3c!-- 非首项:上一步 --\x3e\n <button mat-button matStepperPrevious *ngIf="index!=0">上一步</button>\n \x3c!-- 非末项:下一步 --\x3e\n <button mat-button matStepperNext *ngIf="(index+1!=data?.stepsList?.length)&&!step?.error">下一步</button>\n </ng-template>\n </mat-step>\n\n </mat-stepper>\n \n \n</mat-dialog-content>\n<mat-dialog-actions [align]="\'end\'" style="display: flex;justify-content: center;">\n \x3c!-- <button mat-button (click)="onNoClick()">No Thanks</button> --\x3e\n <button style="font-size: 20px;" *ngIf="hasError" mat-button color="warn" [mat-dialog-close]="false" cdkFocusInitial>取消</button>\n <button style="font-size: 20px;" *ngIf="enabledClose" mat-button color="primary" [mat-dialog-close]="true" cdkFocusInitial>完成</button>\n</mat-dialog-actions>\n\n',styles:["h2{text-align:center;background-color:#6e23ce}\n"]}]}],ctorParameters:()=>[{type:i1.MatDialogRef},{type:void 0,decorators:[{type:Inject,args:[MAT_DIALOG_DATA]}]}],propDecorators:{stepper:[{type:ViewChild,args:[MatStepper]}]}});
  8. var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIyL2xpYi9haWdjL2FnZW50L2ZtLWFnZW50LXRhc2svZm0tYWdlbnQtdGFzay5jb21wb25lbnQubWpz`