fmode-ng 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,6 @@
5
5
  * 保留所有权利 All Rights Reserved.
6
6
  * /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2020/lib/aigc/service-fmai/service-chat/chat-class.mjs
7
7
  */
8
- import{bufferTime,concatMap,Observable,delay,finalize}from"rxjs";import*as Parse from"parse";const API_BASE="https://test.fmode.cn/api/apig/aigc/gpt";export class FmodeChat{constructor(e,t,n){this.messageList=[{role:"system",content:"系统提示:AI仅供参考"}],this.mask=t,this.chatId=e,this.chat=n}sendMessage(e="FmodeAiTest测试问题"){this.messageList.push({role:"user",content:e,createdAt:new Date});let t=new FmodeChatCompletion(this.fixMessageList(this.messageList));t.sendCompletion().pipe(finalize((()=>{this.messageList[t.indexOfList].complete=!0}))).subscribe((e=>{this.messageList[t.indexOfList]=e}))}fixMessageList(e){return e.map((e=>({role:e.role,content:e.content})))}nowStr(){let e=new Date;return`${e.getFullYear()}/${e.getMonth()+1}/${e.getDate()} ${e.getHours()}:${e.getMinutes()}:${e.getSeconds()}`}}export class FmodeChatCompletion{constructor(e){this.content="",this.contentBuffer=[],this.isCompleted=!1,this.indexOfList=Number(e.length),this.messages=e}sendCompletion(e=!1){let t={messages:this.messages,stream:!0,model:"gpt-3.5-turbo",temperature:.5,presence_penalty:0,frequency_penalty:0};return new Observable((n=>{let s=RequestFmodeChatApi("/v1/chat/completions",t).subscribe((t=>{let o=String(t);if(o.indexOf("data: {")>-1){let t=chunkToJson(o),r=t?.choices?.[0]?.delta?.content||"";this.contentBuffer.push(r);let a=100;e&&(a=1),this.contentPusher||(this.contentPusher=setInterval((()=>{this.isCompleted&&0==this.contentBuffer?.length&&(n.next({role:"assistant",content:this.content,complete:!0,createdAt:new Date}),s.unsubscribe(),clearInterval(this.contentPusher),n.complete()),this.contentBuffer?.length>=0&&(this.contentBuffer?.length>0&&(this.content+=this.contentBuffer.shift()),n.next({role:"assistant",content:this.content,createdAt:new Date}))}),a))}"data: [DONE]"===o&&(this.isCompleted=!0)}))})).pipe(bufferTime(100),concatMap((e=>e)),delay(200))}}function chunkToJson(e){let t;try{t=JSON.parse(e.replaceAll("data: ",""))}catch(e){console.error(e)}return t||{}}function RequestFmodeChatApi(e,t,n="POST"){return new Observable((s=>{let o=API_BASE+e,r=`Bearer ${Parse.User.current()?.getSessionToken()||localStorage.getItem("FMODE_AI_TOKEN")}`;return t.token=r,t&&(t=JSON.stringify(t)),fetch(o,{headers:{"Content-Type":"text/plain","Cache-Control":"no-cache"},body:t||null,method:n,credentials:"omit",mode:"cors"}).then((e=>{let t="";{let n=e.body?.getReader();const o=new TextDecoder;let r=new ReadableStream({start(e){!function read(){n.read().then((({done:t,value:n})=>{if(t)return e.close(),void s.complete();e.enqueue(n),read()}))}()}}).getReader();r.read().then((function processStream({done:e,value:n}){if(e)return;!function processData(e){let n=(t+e).split("\n");if(n?.length>1){for(let e=0;e<n.length-1;e++){let t=n[e];s.next(t)}t=n[n.length-1]}}(o.decode(n)),r.read().then(processStream)}))}})).catch((e=>s.error(e))),()=>{}}))}function JsonToFormData(e){const t=new FormData;return function appendFormData(e,n=""){Array.isArray(e)?e.forEach(((e,t)=>{appendFormData(e,`${n}[${t}]`)})):"object"==typeof e&&null!==e?Object.keys(e).forEach((t=>{const s=n?`${n}.${t}`:t;appendFormData(e[t],s)})):t.append(n,e)}(e),t}
8
+ import{bufferTime,concatMap,Observable,delay,finalize}from"rxjs";import*as Parse from"parse";const API_BASE="https://test.fmode.cn/api/apig/aigc/gpt";export class FmodeChat{constructor(e,t,s){this.ChatSession=Parse.Object.extend("ChatSession"),this.messageList=[{role:"system",content:"系统提示:AI仅供参考"}],this.role=t,this.sessionId=e,s?.id&&(this.chatSession=s,this.messageList=this.chatSession.get("messageList"),this.sessionId=s?.id)}sendMessage(e="FmodeAiTest测试问题"){this.messageList.push({role:"user",content:e,createdAt:new Date});let t=new FmodeChatCompletion(this.fixMessageList(this.messageList)),s=t.sendCompletion().pipe(finalize((()=>{this.messageList[t.indexOfList].complete=!0}))).subscribe((e=>{this.messageList[t.indexOfList]=e;let n=this.chatSession?.get("messageList")?.length;this.messageList?.length>n&&(console.log("cycle新会话"),this.saveChatSession()),e?.complete&&(this.saveChatSession(),s.unsubscribe())}))}async saveChatSession(){"new"==this.sessionId&&(this.chatSession=new this.ChatSession),this.chatSession.set("title",this.genTitle()),this.chatSession.set("role",this.role?.toPointer()),this.chatSession.set("messageList",this.messageList),this.chatSession.set("user",Parse.User.current()?.toPointer()),this.chatSession=await this.chatSession.save(),this.sessionId=this.chatSession?.id}genTitle(){if(this.title)return this.title;let e=this.messageList.find((e=>"user"==e.role))?.content;return this.title=e?.slice(0,15)||"",this.title}fixMessageList(e){return e.map((e=>({role:e.role,content:e.content})))}nowStr(){let e=new Date;return`${e.getFullYear()}/${e.getMonth()+1}/${e.getDate()} ${e.getHours()}:${e.getMinutes()}:${e.getSeconds()}`}}export class FmodeChatCompletion{constructor(e){this.content="",this.contentBuffer=[],this.isCompleted=!1,this.indexOfList=Number(e.length),this.messages=e}sendCompletion(e=!1){let t={messages:this.messages,stream:!0,model:"gpt-3.5-turbo",temperature:.5,presence_penalty:0,frequency_penalty:0};return new Observable((s=>{let n=RequestFmodeChatApi("/v1/chat/completions",t).subscribe((t=>{let i=String(t);if(i.indexOf("data: {")>-1){let t=chunkToJson(i),o=t?.choices?.[0]?.delta?.content||"";this.contentBuffer.push(o);let a=100;e&&(a=1),this.contentPusher||(this.contentPusher=setInterval((()=>{this.isCompleted&&0==this.contentBuffer?.length&&(s.next({role:"assistant",cid:t?.id,content:this.content,complete:!0,createdAt:new Date}),n.unsubscribe(),clearInterval(this.contentPusher),s.complete()),this.contentBuffer?.length>=0&&(this.contentBuffer?.length>0&&(this.content+=this.contentBuffer.shift()),s.next({role:"assistant",cid:t?.id,content:this.content,createdAt:new Date}))}),a))}"data: [DONE]"===i&&(this.isCompleted=!0)}))})).pipe(bufferTime(100),concatMap((e=>e)),delay(200))}}function chunkToJson(e){let t;try{t=JSON.parse(e.replaceAll("data: ",""))}catch(e){console.error(e)}return t||{}}function RequestFmodeChatApi(e,t,s="POST"){return new Observable((n=>{let i=API_BASE+e,o=`Bearer ${Parse.User.current()?.getSessionToken()||localStorage.getItem("FMODE_AI_TOKEN")}`;return t.token=o,t&&(t=JSON.stringify(t)),fetch(i,{headers:{"Content-Type":"text/plain","Cache-Control":"no-cache"},body:t||null,method:s,credentials:"omit",mode:"cors"}).then((e=>{let t="";{let s=e.body?.getReader();const i=new TextDecoder;let o=new ReadableStream({start(e){!function read(){s.read().then((({done:t,value:s})=>{if(t)return e.close(),void n.complete();e.enqueue(s),read()}))}()}}).getReader();o.read().then((function processStream({done:e,value:s}){if(e)return;!function processData(e){let s=(t+e).split("\n");if(s?.length>1){for(let e=0;e<s.length-1;e++){let t=s[e];n.next(t)}t=s[s.length-1]}}(i.decode(s)),o.read().then(processStream)}))}})).catch((e=>n.error(e))),()=>{}}))}function JsonToFormData(e){const t=new FormData;return function appendFormData(e,s=""){Array.isArray(e)?e.forEach(((e,t)=>{appendFormData(e,`${s}[${t}]`)})):"object"==typeof e&&null!==e?Object.keys(e).forEach((t=>{const n=s?`${s}.${t}`:t;appendFormData(e[t],n)})):t.append(s,e)}(e),t}
9
9
  var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIwL2xpYi9haWdjL3NlcnZpY2UtZm1haS9zZXJ2aWNlLWNoYXQvY2hhdC1jbGFzcy5tanM=`
10
10
 
@@ -5,6 +5,6 @@
5
5
  * 保留所有权利 All Rights Reserved.
6
6
  * /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2020/lib/aigc/service-fmai/service-chat/chat.service.mjs
7
7
  */
8
- import{Injectable}from"@angular/core";import{Router}from"@angular/router";import{MASK_LIST}from"./mask-list";import{FmodeChat}from"./chat-class";import*as i0 from"@angular/core";import*as i1 from"@angular/router";export class ChatService{constructor(r){this.router=r,this.maskList=[],this.chatMap={},this.maskList=MASK_LIST}createChatPanel(r,t){let e=t?.id||"new";t=new FmodeChat(e,r,t),this.chatMap[e]=t,this.router.navigate(["/chat/pro/chat/"+e])}}ChatService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ChatService,deps:[{token:i1.Router}],target:i0.ɵɵFactoryTarget.Injectable}),ChatService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ChatService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ChatService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.Router}]}});
8
+ import{Injectable}from"@angular/core";import{Router}from"@angular/router";import{FmodeChat}from"./chat-class";import*as Parse from"parse";import{NovaCloudService}from"../../../nova-cloud";import*as i0 from"@angular/core";import*as i1 from"@angular/router";import*as i2 from"../../../nova-cloud";export class ChatService{constructor(e,t){this.router=e,this.ncloud=t,this.chatMap={}}async initChatMap(e){if(this.chatMap[e])return this.chatMap[e];let t=new Parse.Query("ChatSession");t.include("role");let a=await t.get(e),r=new FmodeChat(a?.id,a?.get("role"),a);return this.chatMap[e]=r,this.chatMap[e]}async getChatSession(){let e=new Parse.Query("ChatSession");e.include("role"),e.addDescending("updatedAt"),e.equalTo("user",Parse.User.current().toPointer()),e.limit(10);let t=await e.find();this.chatList=t.map((e=>(this.chatMap[e?.id]=new FmodeChat(e?.id,e?.get("role"),e),{sid:e?.id,rid:e?.get("role")?.id,name:e?.get("role")?.get("name"),message:e?.get("messageList")?.[e?.get("messageList")?.length-1]?.content?.slice(0,20),latest:e?.createdAt})))}async getChatSessionDistinct(){let e=await this.ncloud.novaql('SELECT t1."objectId" as sid , "AvatarRole"."objectId" as rid, * FROM (\n SELECT *,ROW_NUMBER() OVER (PARTITION BY "user", "role" ORDER BY "createdAt" DESC) AS rn\n FROM "ChatSession" WHERE "user"=$1\n ) as t1\n LEFT JOIN "AvatarRole" ON "AvatarRole"."objectId" = t1."role"\n WHERE t1.rn=1\n LIMIT $2\n ;',[Parse.User.current()?.id,10]),t=e?.map((e=>({sid:e?.sid,rid:e?.rid,name:e?.name,message:e?.messageList?.[e?.messageList?.length-1]?.content?.slice(0,20),latest:e?.createdAt})));return this.chatList=t,this.chatList}createChatPanel(e,t){let a=t?.id||"new";t=new FmodeChat(a,e,t),this.chatMap[a]=t,this.router.navigate(["/chat/pro/chat/"+a])}async restoreChatPanel(e){let t=new Parse.Query("AvatarRole"),a=new Parse.Query("ChatSession"),r=await t.get(e?.rid),i=await a.get(e?.sid),s=new FmodeChat(e?.sid,r,i);this.chatMap[e?.sid]=s,this.router.navigate(["/chat/pro/chat/"+e?.sid])}}ChatService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ChatService,deps:[{token:i1.Router},{token:i2.NovaCloudService}],target:i0.ɵɵFactoryTarget.Injectable}),ChatService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ChatService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ChatService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.Router},{type:i2.NovaCloudService}]}});
9
9
  var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIwL2xpYi9haWdjL3NlcnZpY2UtZm1haS9zZXJ2aWNlLWNoYXQvY2hhdC5zZXJ2aWNlLm1qcw==`
10
10
 
@@ -5,6 +5,6 @@
5
5
  * 保留所有权利 All Rights Reserved.
6
6
  * /home/ryan/workspace/nova/nova-admin/dist/fmode-ng/esm2020/lib/aigc/service-fmai/service-imagine/imagine.service.mjs
7
7
  */
8
- import{HttpClient}from"@angular/common/http";import{Injectable}from"@angular/core";import{NovaCloudService}from"../../../nova-cloud/nova-cloud.service";import*as Parse from"parse";import*as i0 from"@angular/core";import*as i1 from"@angular/common/http";import*as i2 from"../../../nova-cloud/nova-cloud.service";export class ImagineService{constructor(e,t){this.http=e,this.ncloud=t,this.taskDetailMap={},this.newWorkList=[],this.myWorkList=[]}async drawDalle(e){e.size=e?.size||"1024x1024",e.style=e?.style||"natural",e.quality=e?.quality||null;let t={model:"dall-e-3",prompt:e.prompt,n:1,quality:e.quality,response_format:"url",size:e.size,style:e.style};if(e.prompt?.length>3e3)throw"prompt maximum < 4000 characters";let i=await this.ncloud.apigTest("aigc/gpt/v1/images/generations",t);if(console.log(i),i?.id){let e=new Parse.Query("ImagineWork");e.get(i?.id);let t=await e.first();console.log(t),t?.id&&this.newWorkList.unshift(t)}return i}priceDalle(e){let t=[{model:"dall-e-3",quality:null,size:"1024x1024",credit:6.4},{model:"dall-e-3",quality:null,size:"1024x1792",credit:12.8},{model:"dall-e-3",quality:null,size:"1792x1024",credit:12.8},{model:"dall-e-3",quality:"hd",size:"1024x1024",credit:12.8},{model:"dall-e-3",quality:"hd",size:"1024x1792",credit:19.2},{model:"dall-e-3",quality:"hd",size:"1792x1024",credit:19.2},{model:"dall-e-2",quality:null,size:"1024x1024",credit:3.2},{model:"dall-e-2",quality:null,size:"512x512",credit:2.88},{model:"dall-e-2",quality:null,size:"256x256",credit:2.56}].find((t=>t.model==e.model&&t.quality==e.quality&&t.size==e.size));return t?.credit||19.2}b64DataToBase64Image(e){let t=atob(e),i=new Blob([t],{type:"image/webp"});new Promise((e=>{let t=new FileReader;t.onloadend=function(){let i=t.result;console.log(i),e(i)},t.readAsDataURL(i)}))}async draw(e){let t=await this.ncloud.apig("aigc/sdapi/v1/draw",e),i=t?.paintingSign;return i&&setTimeout((async()=>{let e=new Parse.Query("ImagineWork");e.equalTo("taskId",i);let t=await e.first();console.log(t),t?.id&&this.newWorkList.unshift(t)}),1e3),t}async taskDetail(e){let t=await this.ncloud.apig("aigc/sdapi/v1/task/detail",{taskId:e});return console.log(t),this.taskDetailMap[e]=t,t}getMyWorkQuery(){let e=Parse.User.current();if(!e?.id)return;let t=this.getWorkQuery();return t.include("model","module","user"),t.equalTo("user",e.toPointer()),t}getWorkQuery(){let e=new Parse.Query("ImagineWork");return e.include("model","module","user"),e.notEqualTo("isDeleted",!0),e.addDescending("createdAt"),e}}ImagineService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ImagineService,deps:[{token:i1.HttpClient},{token:i2.NovaCloudService}],target:i0.ɵɵFactoryTarget.Injectable}),ImagineService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ImagineService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ImagineService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.HttpClient},{type:i2.NovaCloudService}]}});
8
+ import{HttpClient}from"@angular/common/http";import{Injectable}from"@angular/core";import{NovaCloudService}from"../../../nova-cloud/nova-cloud.service";import*as Parse from"parse";import*as i0 from"@angular/core";import*as i1 from"@angular/common/http";import*as i2 from"../../../nova-cloud/nova-cloud.service";export class ImagineService{constructor(e,t){this.http=e,this.ncloud=t,this.taskDetailMap={},this.newWorkList=[],this.myWorkList=[]}async drawDalle(e){e.size=e?.size||"1024x1024",e.style=e?.style||"natural",e.quality=e?.quality||null;let t={model:"dall-e-3",prompt:e.prompt,n:1,quality:e.quality,response_format:"url",size:e.size,style:e.style};if(e.prompt?.length>3e3)throw"prompt maximum < 4000 characters";let i=await this.ncloud.apigTest("aigc/gpt/v1/images/generations",t);if(console.log(i),i?.id){let e=new Parse.Query("ImagineWork");e.get(i?.id);let t=await e.first();console.log(t),t?.id&&this.newWorkList.unshift(t)}return i}priceDalle(e){let t=[{model:"dall-e-3",quality:null,size:"1024x1024",credit:6.4},{model:"dall-e-3",quality:null,size:"1024x1792",credit:12.8},{model:"dall-e-3",quality:null,size:"1792x1024",credit:12.8},{model:"dall-e-3",quality:"hd",size:"1024x1024",credit:12.8},{model:"dall-e-3",quality:"hd",size:"1024x1792",credit:19.2},{model:"dall-e-3",quality:"hd",size:"1792x1024",credit:19.2},{model:"dall-e-2",quality:null,size:"1024x1024",credit:3.2},{model:"dall-e-2",quality:null,size:"512x512",credit:2.88},{model:"dall-e-2",quality:null,size:"256x256",credit:2.56}].find((t=>t.model==e.model&&t.quality==e.quality&&t.size==e.size));return t?.credit||19.2}priceStableDiffusion(e){let t=e.width*e.height,i=763e-9*t*e.steps+2278e-8*t*(e?.upscale||0)+(e?.hrSteps||0)*t*(e?.hrScale||0)*(e?.hrScale||0)*763e-9+2*(e?.controlnet?.units?.length||0)+(e?.imgOptions?.removeBackground?2:0)+(e?.faceFix?2:0)+(e?.imgOptions?.redrawBackground?2:0)+(e?.imgOptions?.facePreservation?2:0)+(e?.imgOptions?.genderDetect?1:0);return console.log(i),i=.3*i*e.batchSize,console.log(e.width+"X"+e.height),console.log(e?.hrSteps),console.log(e?.hrScale),console.log(e?.controlnet?.units?.length),console.log(e?.imgOptions?.removeBackground),console.log(e?.faceFix),console.log(e?.imgOptions?.redrawBackground),console.log(e?.imgOptions?.facePreservation),console.log(e?.imgOptions?.genderDetect),console.log(i),i}b64DataToBase64Image(e){let t=atob(e),i=new Blob([t],{type:"image/webp"});new Promise((e=>{let t=new FileReader;t.onloadend=function(){let i=t.result;console.log(i),e(i)},t.readAsDataURL(i)}))}async draw(e){let t=await this.ncloud.apig("aigc/sdapi/v1/draw",e),i=t?.paintingSign;return i&&setTimeout((async()=>{let e=new Parse.Query("ImagineWork");e.equalTo("taskId",i);let t=await e.first();console.log(t),t?.id&&this.newWorkList.unshift(t)}),1e3),t}async taskDetail(e){let t=await this.ncloud.apig("aigc/sdapi/v1/task/detail",{taskId:e});return console.log(t),this.taskDetailMap[e]=t,t}getMyWorkQuery(){let e=Parse.User.current();if(!e?.id)return;let t=this.getWorkQuery();return t.include("model","module","user"),t.equalTo("user",e.toPointer()),t}getWorkQuery(){let e=new Date((new Date).getTime()-6e4),t=Parse.Query.fromJSON("ImagineWork",{where:{$or:[{createdAt:{$lte:e},progress:{$ne:0}},{createdAt:{$gt:e}}]}});return t.include("model","module","user"),t.notEqualTo("isDeleted",!0),t.doesNotExist("respData.error"),t.doesNotExist("respData.data.taskLimitCount"),t.addDescending("createdAt"),t}}ImagineService.ɵfac=i0.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ImagineService,deps:[{token:i1.HttpClient},{token:i2.NovaCloudService}],target:i0.ɵɵFactoryTarget.Injectable}),ImagineService.ɵprov=i0.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ImagineService,providedIn:"root"}),i0.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"15.1.0",ngImport:i0,type:ImagineService,decorators:[{type:Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[{type:i1.HttpClient},{type:i2.NovaCloudService}]}});
9
9
  var MODULE_PATH_NEED = `6K+l5paH5Lu25piv5pys6aG555uu55qE5LiA6YOo5YiGIFRoaXMgZmlsZSBpcyBwYXJ0IG9mIHRoZSBDb21wb25lbnRzIGluIEZtb2RlIEluYy4KICAgIOeJiOadg+aJgOaciSDCqSDmnKrmnaXpo57pqawgwqkg5rGf6KW/6ISR5o6n56eR5oqA5pyJ6ZmQ5YWs5Y+4IENvcHlyaWdodCDCqSBGbW9kZSBUZWNobm9sb2d5IENvLiwgTHRkLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCiAgICDkuKXnpoHlnKjmnKrnu4/mjojmnYPnmoTmg4XlhrXkuIvvvIzpgJrov4fku7vkvZXlqpLku4vlpI3liLbmraTmlofku7YgVW5hdXRob3JpemVkIGNvcHlpbmcgb2YgdGhpcyBmaWxlLCB2aWEgYW55IG1lZGl1bSBpcyBzdHJpY3RseSBwcm9oaWJpdGVkCiAgICDor6Xmlofku7bmmK/kuJPmnInnmoTmnLrlr4bmlofku7YgUHJvcHJpZXRhcnkgYW5kIGNvbmZpZGVudGlhbAogICAKICAgIENvcHlyaWdodCAyMDIxLW5vdyBGbW9kZSBJbmMuIHN1cHBvcnRAZm1vZGUuY24uIDE4NjA3MDA3MDczLgogICAg5L+d55WZ5omA5pyJ5p2D5YipIEFsbCByaWdodHMgcmVzZXJ2ZWQuCgogICAgUEFUSDovaG9tZS9yeWFuL3dvcmtzcGFjZS9ub3ZhL25vdmEtYWRtaW4vZGlzdC9mbW9kZS1uZy9lc20yMDIwL2xpYi9haWdjL3NlcnZpY2UtZm1haS9zZXJ2aWNlLWltYWdpbmUvaW1hZ2luZS5zZXJ2aWNlLm1qcw==`
10
10