@acedatacloud/nexior 3.324.26 → 3.324.27
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.
- package/dist/assets/{ApiCodeButton-B2n0Brc3.js → ApiCodeButton-Ds-DXrRl.js} +1 -1
- package/dist/assets/{Artifacts-bYcpXn1i.js → Artifacts-B4tLjxmD.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-6Tvkx4lJ.js → AskUserQuestionCard-By_Uc205.js} +1 -1
- package/dist/assets/{Auth-xOe5heXZ.js → Auth-D6zhYiJF.js} +1 -1
- package/dist/assets/{Bare-CoVnbDRF.js → Bare-C2GwkNNN.js} +1 -1
- package/dist/assets/{BotPlaceholder-pWxgOlNM.js → BotPlaceholder-KUVrB1fh.js} +1 -1
- package/dist/assets/{BottomFooter-IvArhRU6.js → BottomFooter-sTVs9-uF.js} +1 -1
- package/dist/assets/{Callback-DI3QCRv4.js → Callback-cTy95LUy.js} +1 -1
- package/dist/assets/{CodeSnippet-Nhq000pp.js → CodeSnippet-Cw-Cs8Dg.js} +1 -1
- package/dist/assets/{Console-DDPsPWdn.js → Console-CmwvZ3Rt.js} +1 -1
- package/dist/assets/{Consumption-_5s609Be.js → Consumption-ucYx29ld.js} +1 -1
- package/dist/assets/{Conversation-BnCwLjxJ.js → Conversation-D28I2BDj.js} +1 -1
- package/dist/assets/{Conversation-Cp32MlyI.js → Conversation-VFKISHqz.js} +1 -1
- package/dist/assets/{CopyToClipboard-Dpqkkmd1.js → CopyToClipboard-DDOSZiCt.js} +1 -1
- package/dist/assets/{Detail-ByDgH0Nw.js → Detail-C83f417q.js} +2 -2
- package/dist/assets/{Extra-DcgU0U-7.js → Extra-CTaZvBcT.js} +1 -1
- package/dist/assets/{FilePreview-BmzWuB1J.js → FilePreview-BgmKvogN.js} +1 -1
- package/dist/assets/{Hailuo-DLv-hN-Y.js → Hailuo-DDgFUsvn.js} +1 -1
- package/dist/assets/{History-BdhCtWkD.js → History-9eVKoZ2i.js} +1 -1
- package/dist/assets/{ImagePreview-DWw0Go0f.js → ImagePreview-83gb1Wk3.js} +1 -1
- package/dist/assets/{ImageWrapper-BrSu8vnh.js → ImageWrapper-LCA0PyoC.js} +1 -1
- package/dist/assets/{Index-_QNmiWNn.js → Index-B1VJXogg.js} +1 -1
- package/dist/assets/{Index-CGYlg3Ml.js → Index-BGVQyZbE.js} +1 -1
- package/dist/assets/{Index-B0HZDR12.js → Index-BNuPQTfk.js} +1 -1
- package/dist/assets/{Index-DWRPWh9C.js → Index-BRIgt7Y0.js} +1 -1
- package/dist/assets/{Index-DHSAlxR2.js → Index-BYr_68hG.js} +1 -1
- package/dist/assets/{Index-B_fdXvjL.js → Index-C6uEtyLC.js} +1 -1
- package/dist/assets/{Index-qp6I8EiB.js → Index-CWRkR7Jn.js} +1 -1
- package/dist/assets/{Index-CbA1sOkq.js → Index-ChmRP8hU.js} +1 -1
- package/dist/assets/{Index-DOV_MbF2.js → Index-CnOzuEN4.js} +1 -1
- package/dist/assets/{Index-Df7haQJX.js → Index-CsSJ2phC.js} +1 -1
- package/dist/assets/{Index-BZ8Rx8e7.js → Index-D7Qq-KDK.js} +1 -1
- package/dist/assets/{Index-B33yZBVR.js → Index-DA-O_FNX.js} +1 -1
- package/dist/assets/{Index-wrIYEPfJ.js → Index-DEwq1SbZ.js} +1 -1
- package/dist/assets/{Index-CDXOkvJG.js → Index-DKA9jXyH.js} +1 -1
- package/dist/assets/{Index-C5rpZi9u.js → Index-DKAmo4J2.js} +1 -1
- package/dist/assets/{Index-gYl_iZrw.js → Index-DNRKiQRj.js} +1 -1
- package/dist/assets/{Index-DByrj5uH.js → Index-DPiopqXX.js} +1 -1
- package/dist/assets/{Index-D3-z7ZX9.js → Index-DVLuGCwf.js} +1 -1
- package/dist/assets/{Index-CniV6d6k.js → Index-DfeUpxLI.js} +1 -1
- package/dist/assets/{Index-DqFBNg3y.js → Index-DmGOrfxf.js} +1 -1
- package/dist/assets/{Index-DAMUc94V.js → Index-DwbX8Ixg.js} +1 -1
- package/dist/assets/{Index-bwhsJqSz.js → Index-M9OM80m8.js} +1 -1
- package/dist/assets/{Index-C_QfIpmH.js → Index-PAtY7LVI.js} +1 -1
- package/dist/assets/{Index-BPVMXsLG.js → Index-Q6Upq1ZO.js} +1 -1
- package/dist/assets/{Index-DW8j3f4_.js → Index-nNWrCnNq.js} +1 -1
- package/dist/assets/{Index-DolsNtFI.js → Index-o3ejs26z.js} +1 -1
- package/dist/assets/{Index-BHMG-Sr0.js → Index-rN276Sty.js} +1 -1
- package/dist/assets/{Index-Bmppim6j.js → Index-wsizArYz.js} +1 -1
- package/dist/assets/{Invitees-D2yB5tvI.js → Invitees-YI_g8r3W.js} +1 -1
- package/dist/assets/{List-CRVcW742.js → List-BUfvwTQV.js} +1 -1
- package/dist/assets/{List-CWtfUVLf.js → List-Bx7Ddrso.js} +1 -1
- package/dist/assets/{List-C-jt4bQn.js → List-azcNQIPb.js} +1 -1
- package/dist/assets/{LocalTools-CyZR9aT6.js → LocalTools-CZrikBFj.js} +1 -1
- package/dist/assets/{LocalTools-DnZPno59.js → LocalTools-OsQX5dZg.js} +1 -1
- package/dist/assets/{Main-DLByly6-.js → Main-B8jmgaF-.js} +1 -1
- package/dist/assets/{Message-fPEQyCqa.js → Message-BArVFm7c.js} +1 -1
- package/dist/assets/{Model-TAZXKk2B.js → Model-10O11cFU.js} +1 -1
- package/dist/assets/{Navigator-C0sjTgt5.js → Navigator-CyrHs0fw.js} +3 -3
- package/dist/assets/{NoTasks-DhYUH2SG.js → NoTasks-VnYzvYev.js} +1 -1
- package/dist/assets/{NotFound-DPN_uobB.js → NotFound-j8hRBvk7.js} +1 -1
- package/dist/assets/{Pay-ChrnlIvU.js → Pay-DVP9AysY.js} +1 -1
- package/dist/assets/{Player-ZmIrwkTi.js → Player-Bm6iFx6M.js} +1 -1
- package/dist/assets/{PromptTextarea-D1yTfPjT.js → PromptTextarea-DpyGubYO.js} +1 -1
- package/dist/assets/{RealtimeCall-BF9_D0aQ.js → RealtimeCall-fYNV0nO0.js} +1 -1
- package/dist/assets/ScheduledTasks-C_3M1hSP.js +2 -0
- package/dist/assets/ScheduledTasks-DRYgT4HV.css +1 -0
- package/dist/assets/{Status-DtFipZ5C.js → Status-C-dA9-N3.js} +1 -1
- package/dist/assets/{Subscribe-B9-G7J9T.js → Subscribe-B01PQQ_p.js} +1 -1
- package/dist/assets/{TabSwitcher-B-X64NrE.js → TabSwitcher-Cq6KN4-J.js} +1 -1
- package/dist/assets/{Tts-BiJZ7Yie.js → Tts-BZ6rOtM5.js} +1 -1
- package/dist/assets/{VideoPlayer-B31d0G5B.js → VideoPlayer-DI3PVekV.js} +1 -1
- package/dist/assets/{VideoPreview-62jM67_g.js → VideoPreview-B0RlfkdO.js} +1 -1
- package/dist/assets/{alert-xa4qD-Fe.js → alert-OQpRj2T1.js} +1 -1
- package/dist/assets/{avatar-CY8f2_Ok.js → avatar-Cw63ZCtR.js} +1 -1
- package/dist/assets/{basic-BV6kK3Gz.js → basic-Djkfvmn5.js} +1 -1
- package/dist/assets/{chat-DbEmvJ2E.js → chat-9opabn-h.js} +1 -1
- package/dist/assets/{chat-CI71JU81.js → chat-BDFqZmA3.js} +1 -1
- package/dist/assets/{chat-CgsLe5gQ.js → chat-BXG0uOVZ.js} +1 -1
- package/dist/assets/{chat-BCTFfZ5X.js → chat-BrZJSdNv.js} +1 -1
- package/dist/assets/{chat-DMRo2ZN9.js → chat-Bwws-v4D.js} +1 -1
- package/dist/assets/{chat-Dw8r84-S.js → chat-C-DKOo30.js} +1 -1
- package/dist/assets/{chat-CI9xa3Mk.js → chat-CeWfycGq.js} +1 -1
- package/dist/assets/{chat-DWDZtabw.js → chat-DGXJ4mVu.js} +1 -1
- package/dist/assets/{chat-DRPbY35P.js → chat-DW2yPStG.js} +1 -1
- package/dist/assets/{chat-C0zt2tk8.js → chat-DbN3MSTh.js} +1 -1
- package/dist/assets/{chat-CEli_JXi.js → chat-DcUjsF0z.js} +1 -1
- package/dist/assets/{chat-DiGq7o7P.js → chat-DqaOqyAE.js} +1 -1
- package/dist/assets/{chat-BvCwCJcC.js → chat-DthPhVgi.js} +1 -1
- package/dist/assets/{chat-UKxTrDe-.js → chat-Dwhkdkl2.js} +1 -1
- package/dist/assets/{chat-P65wtEtO.js → chat-MQGYTifz.js} +1 -1
- package/dist/assets/{chat-ChWOd3gT.js → chat-QD1aMFrQ.js} +1 -1
- package/dist/assets/{chat-BFeYezva.js → chat-VCk_q53g.js} +1 -1
- package/dist/assets/{chat-CJxHtIm-.js → chat-gZYrV4pp.js} +1 -1
- package/dist/assets/{chat-CnCF2A1q.js → chat-sBlqc2KU.js} +1 -1
- package/dist/assets/{codingBridge-UXVKJKZW.js → codingBridge-CFVTCdpx.js} +1 -1
- package/dist/assets/{codingBridgeNotify-y-0Fc2Kr.js → codingBridgeNotify-ylZwSN9q.js} +2 -2
- package/dist/assets/{collapse-CostQqqt.js → collapse-Cf_wHaFR.js} +1 -1
- package/dist/assets/{constants-qNbtmSmx.js → constants-DxuoPabX.js} +1 -1
- package/dist/assets/{createTaskActions-Dcb24Ia7.js → createTaskActions-DASMFGcq.js} +1 -1
- package/dist/assets/{date-picker-CfVvM0Bm.js → date-picker-DcmItEGA.js} +1 -1
- package/dist/assets/{digitalhuman-B6p0g8dI.js → digitalhuman-aK7FsQpM.js} +1 -1
- package/dist/assets/{drawer-5rJXE0y9.js → drawer-I7xPkGcQ.js} +1 -1
- package/dist/assets/{dropdown-BpbJaNVt.js → dropdown-C5Bh_We5.js} +1 -1
- package/dist/assets/{dropdown-B2l51P8D.js → dropdown-D0djnq3W.js} +1 -1
- package/dist/assets/esm-C6-ExqZK.js +1 -0
- package/dist/assets/{esm-CwnPqw0P.js → esm-CRc2oo3B.js} +1 -1
- package/dist/assets/{esm-BhWrtFFp.js → esm-CqzJzaAG.js} +2 -2
- package/dist/assets/{esm-BTqzarMm.js → esm-DpzxyC1c.js} +3 -3
- package/dist/assets/{esm-BkHPDRBP.js → esm-G3YHTLCE.js} +1 -1
- package/dist/assets/{esm-DT6Qkbhh.js → esm-mY1LAPmt.js} +2 -2
- package/dist/assets/{esm-CQLViX0u.js → esm-p7W_j8xh.js} +1 -1
- package/dist/assets/{fish-pQlPo1po.js → fish-Cl6kT8c7.js} +1 -1
- package/dist/assets/{flux-BfKWqQOO.js → flux-D4B3Ttwt.js} +1 -1
- package/dist/assets/{grokvideo-BR6tVIFV.js → grokvideo-F8QxgMmV.js} +1 -1
- package/dist/assets/{hailuo-C0ncRs_S.js → hailuo-JUoBuyzY.js} +1 -1
- package/dist/assets/{headshots-5AnDzT6G.js → headshots-CeCtpecL.js} +1 -1
- package/dist/assets/{i18n-Cd6gY58S.js → i18n-CektUpr6.js} +1 -1
- package/dist/assets/{image-C3e5pYdE.js → image-D5GTCt7T.js} +1 -1
- package/dist/assets/{index-CaaGWjWz.js → index-CVIbScOR.js} +4 -4
- package/dist/assets/{index.browser.esm-DVDe0-g-.js → index.browser.esm-D5uNO0dq.js} +1 -1
- package/dist/assets/{index.es-ChYr3ccY.js → index.es-DFowd1fY.js} +1 -1
- package/dist/assets/{input-number-CjtFPLFn.js → input-number-Dzrcxfmt.js} +1 -1
- package/dist/assets/{kling-CX4fPLNH.js → kling-BXwxcBEc.js} +1 -1
- package/dist/assets/{luma-kPBiLIIU.js → luma-DCUYFvK0.js} +1 -1
- package/dist/assets/{maestro-C4xfKvQT.js → maestro-CBjCyEKr.js} +1 -1
- package/dist/assets/{maestro-DftIGiG7.js → maestro-CVG0qlm6.js} +1 -1
- package/dist/assets/{midjourney-CUaY5RaH.js → midjourney-CPZfm0TS.js} +1 -1
- package/dist/assets/{mobileLocalExec-468cRLq1.js → mobileLocalExec-BqkKju3u.js} +2 -2
- package/dist/assets/{nanobanana-Wxjr0Z0O.js → nanobanana-Bu61wBoi.js} +1 -1
- package/dist/assets/{openaiimage-DN7umrQW.js → openaiimage-PjjkthMP.js} +1 -1
- package/dist/assets/{pagination-7x9FPQoF.js → pagination-DeLGsK5x.js} +1 -1
- package/dist/assets/{pagination-CsrnaFD4.js → pagination-J-NQWTz2.js} +1 -1
- package/dist/assets/{sora-CGYyT49c.js → pika-Dq_pVehD.js} +1 -1
- package/dist/assets/{pixverse-D-XB9li_.js → pixverse-Dojv_vtM.js} +1 -1
- package/dist/assets/{popover-Cprk0cQi.js → popover-Bm7KDllj.js} +1 -1
- package/dist/assets/{producer-BprXnpS2.js → producer-DbUywcR_.js} +1 -1
- package/dist/assets/{qrart-DOEGhBbS.js → qrart-CLJcSX81.js} +1 -1
- package/dist/assets/{realtime-CcaVpUjO.js → realtime-DhExsigk.js} +1 -1
- package/dist/assets/{row-B4O9xz9q.js → row-CdtGuvk2.js} +1 -1
- package/dist/assets/{seedance-KnzVkRMi.js → seedance-BUNP8Vyy.js} +1 -1
- package/dist/assets/{seedream-DysW7geG.js → seedream-CKwhzk-c.js} +1 -1
- package/dist/assets/{select-DlW_4H3t.js → select-DvoqOdpJ.js} +1 -1
- package/dist/assets/{serp-Hh7FERvu.js → serp-BsF7ZQR8.js} +1 -1
- package/dist/assets/{slider-DgIq-E4A.js → slider-CXhxZsRJ.js} +1 -1
- package/dist/assets/{solana-wallets-AW2fdFAy.js → solana-wallets-B2iMinvE.js} +2 -2
- package/dist/assets/{solana-wallets-vue-DbMtRDoi.js → solana-wallets-vue-BsLTdal6.js} +1 -1
- package/dist/assets/{pika-Dcp1WvF-.js → sora-D2rKRJP4.js} +1 -1
- package/dist/assets/{suno-DKRK7FQL.js → suno-eaP508RN.js} +1 -1
- package/dist/assets/{switch-CVKpq9gb.js → switch-B9HKxKEO.js} +1 -1
- package/dist/assets/{table-2rCsqVOz.js → table-CKlScW26.js} +1 -1
- package/dist/assets/{tabs-mERVVVuV.js → tabs-B4kpWPSB.js} +1 -1
- package/dist/assets/{time-picker-CG1X_hYX.js → time-picker-BURqc92y.js} +1 -1
- package/dist/assets/{tooltip-BYBJPcZV.js → tooltip-C4ECsqjH.js} +1 -1
- package/dist/assets/{upload-NEt87PZ4.js → upload-YiAKN8Py.js} +1 -1
- package/dist/assets/{veo-D2800-LF.js → veo-BRivmcyL.js} +1 -1
- package/dist/assets/{wan-VFLuXbQz.js → wan-CoRTdEVB.js} +1 -1
- package/dist/assets/{web-CLU7nr0M.js → web-B9xFnjol.js} +1 -1
- package/dist/assets/{web-CirV-rez.js → web-C8V4c-UB.js} +1 -1
- package/dist/assets/{web-CU6_1QvI.js → web-CJ_WV-do.js} +1 -1
- package/dist/assets/{web-BDwkU_vO.js → web-CKO4phT1.js} +1 -1
- package/dist/assets/{web-ByQlaSqB.js → web-DM9efsQy.js} +1 -1
- package/dist/assets/{webextrator-0KexTFpU.js → webextrator-CqgLPDw0.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/ScheduledTasks-Bcg-8cte.js +0 -2
- package/dist/assets/ScheduledTasks-xPsbhIa2.css +0 -1
- package/dist/assets/esm-B9LxjsAJ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,S as c,T as l,at as u,bt as d,ht as f,it as p,j as m,mt as h,qt as g,rt as _,tt as v,x as y,z as b}from"./vendor-chart-Dw-P17PN.js";import{I as x,b as S,nt as C}from"./use-deprecated-B-uvyrTL.js";import{r as w,t as T}from"./select-DlW_4H3t.js";import{t as E}from"./upload-NEt87PZ4.js";import{t as D}from"./image-C3e5pYdE.js";import{t as O}from"./alert-xa4qD-Fe.js";import{t as k}from"./drawer-5rJXE0y9.js";import{t as A}from"./input-number-CjtFPLFn.js";import{t as j}from"./switch-CVKpq9gb.js";import{Ar as M,Cr as ee,Mr as te,Or as N,Pr as P,Sr as F,Tr as I,_r as ne,br as re,jr as ie,xr as ae,yr as oe}from"./constants-qNbtmSmx.js";import{Fn as L,Kr as R,Yr as se,_i as z,en as B,j as V,nn as H,oi as U,on as W,or as G,rn as K}from"./index-CaaGWjWz.js";import{t as q}from"./index.es-ChYr3ccY.js";import{t as ce}from"./CopyToClipboard-Dpqkkmd1.js";import{t as le}from"./FilePreview-BmzWuB1J.js";import{t as ue}from"./ImagePreview-DWw0Go0f.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{i as fe,n as pe,t as me}from"./pagination-7x9FPQoF.js";import{t as he}from"./VideoPlayer-B31d0G5B.js";import{t as ge}from"./ApiCodeButton-B2n0Brc3.js";import{t as _e}from"./BotPlaceholder-pWxgOlNM.js";import{t as ve}from"./NoTasks-DhYUH2SG.js";import{t as ye}from"./PromptTextarea-D1yTfPjT.js";import{a as J,i as be,n as xe,o as Se,s as Ce,t as we}from"./maestro-C4xfKvQT.js";import{n as Te,t as Ee}from"./VideoPreview-62jM67_g.js";var De=b({name:`LayoutMaestro`,components:{ElDrawer:k,ElButton:z,FontAwesomeIcon:q},mixins:[de]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(t,n,r,i,o,c){let l=u(`font-awesome-icon`),d=u(`el-button`),m=u(`el-drawer`);return v(),s(`div`,Oe,[e(`div`,ke,[p(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ae,[p(t.$slots,`result`,{},void 0,!0)]),f(a(d,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:h(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[y,!t.tasksEmpty]]),a(m,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:h(()=>[p(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=V(De,[[`render`,je],[`__scopeId`,`data-v-91db2b6f`]]),Ne=b({name:`MaestroFileUrlsInput`,components:{ElUpload:E,ElButton:z,FontAwesomeIcon:q},data(){return{fileList:[],uploadUrl:se()+`/api/v1/files/`,MAESTRO_FILE_ACCEPT:M,MAESTRO_FILE_LIMIT:6}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},value(){return this.$store.state.maestro?.config?.file_urls||[]}},watch:{value:{immediate:!0,handler(e){let t=new Map(this.fileList.map(e=>[e?.response?.file_url||e.url,e])),n=e.map(e=>t.get(e)||{name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}}),r=this.fileList.filter(e=>!(e?.response?.file_url||e.url));this.fileList=[...n,...r]}}},methods:{onExceed(){U.warning(this.$t(`maestro.message.uploadExceed`))},onError(){U.error(this.$t(`maestro.message.uploadError`))},onChange(){let e=this.fileList.map(e=>e?.response?.file_url||e.url).filter(e=>!!e);this.$store.commit(`maestro/setConfig`,{...this.$store.state.maestro?.config,file_urls:e})}}});function Pe(e,t,n,o,c,l){let d=u(`font-awesome-icon`),f=u(`el-button`),p=u(`el-upload`);return v(),s(`div`,null,[a(p,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:e.MAESTRO_FILE_ACCEPT,name:`file`,class:`w-full`,limit:e.MAESTRO_FILE_LIMIT,multiple:!0,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onChange,"on-remove":e.onChange},{default:h(()=>[a(f,{size:`small`,round:``},{default:h(()=>[a(d,{icon:`fa-solid fa-paperclip`,class:`mr-1`}),r(` `+i(e.$t(`maestro.button.uploadFiles`)),1)]),_:1})]),_:1},8,[`file-list`,`accept`,`limit`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])])}var Fe=V(Ne,[[`render`,Pe]]),Ie={"9:16":{width:15,height:26},"16:9":{width:26,height:15},"1:1":{width:20,height:20}},Le=b({name:`ConfigPanel`,components:{ElButton:z,ElSelect:w,ElOption:T,ElInputNumber:A,ElAlert:O,ElSwitch:j,InfoIcon:fe,PromptTextarea:ye,FileUrlsInput:Fe,FontAwesomeIcon:q},emits:[`generate`],data(){return{MAESTRO_MIN_DURATION:1,MAESTRO_MAX_DURATION:600,MAESTRO_ALLOWED_QUALITIES:oe,MAESTRO_ALLOWED_SCENARIOS:re,MAESTRO_SCENARIO_THUMBNAILS:te,MAESTRO_ALLOWED_STYLES:ae,MAESTRO_ALLOWED_VOICES:F,playing:!1,audioEl:null}},computed:{config(){return this.$store.state.maestro?.config},service(){return this.$store.state.maestro?.service},ratioOptions(){return ne.map(e=>({value:e,...Ie[e]??{width:20,height:20}}))},isRemixing(){let e=this.config?.action;return!!e&&e!==`generate`&&!!this.config?.ref_task_id},refTaskId(){return this.config?.ref_task_id},needsVideoUpload(){if(!this.scenarioCustomizationEnabled)return!1;let e=this.config?.scenario;return!e||!P.includes(e)?!1:!(this.config?.file_urls||[]).some(e=>W(e))},canGenerate(){return!!this.prompt?.trim()&&!this.needsVideoUpload},prompt:{get(){return this.config?.prompt},set(e){this.update({prompt:e})}},langs:{get(){return J(this.config?.langs)},set(e){this.update({langs:J(e)})}},languageOptions(){return be(this.$i18n.locale)},additionalLanguageOptions(){return this.languageOptions.filter(e=>e.value!==this.primaryLanguage)},primaryLanguage:{get(){return this.langs[0]||I[0]},set(e){this.update({langs:Ce(this.langs,e)})}},additionalLanguages:{get(){return this.langs.slice(1)},set(e){this.update({langs:Se(this.langs,e)})}},aspect:{get(){return this.config?.aspect},set(e){this.update({aspect:e})}},duration:{get(){return this.config?.duration},set(e){let t=Math.min(600,Math.max(1,Math.round(typeof e==`number`&&!Number.isNaN(e)?e:30)));this.update({duration:t})}},quality:{get(){return this.config?.quality},set(e){this.update({quality:e})}},scenarioCustomizationEnabled:{get(){return this.config?.scenario_customization_enabled??!1},set(e){this.update({scenario_customization_enabled:e})}},styleCustomizationEnabled:{get(){return this.config?.style_customization_enabled??!1},set(e){this.update({style_customization_enabled:e})}},voiceCustomizationEnabled:{get(){return this.config?.voice_customization_enabled??!1},set(e){e||this.stopSample(),this.update({voice_customization_enabled:e})}},scenario:{get(){return this.config?.scenario},set(e){this.update({scenario:e})}},style:{get(){return this.config?.style},set(e){let t=e?.trim();this.update({style:!t||t.toLowerCase()===`auto`?N:t})}},voice:{get(){return this.config?.voice},set(e){this.stopSample(),this.update({voice:e||`warm-female`})}},currentSample(){return F.find(e=>e.key===this.voice)?.sample}},watch:{voiceCustomizationEnabled(e){e||this.stopSample()},voice(){this.stopSample()}},mounted(){this.update({action:this.config?.action??`generate`,langs:J(this.config?.langs),aspect:this.config?.aspect??`9:16`,duration:this.config?.duration??30,quality:this.config?.quality??`standard`})},beforeUnmount(){this.stopSample()},methods:{update(e){this.$store.commit(`maestro/setConfig`,{...this.config,...e})},onClearRemix(){this.update({action:ee,ref_task_id:void 0})},onToggleSample(){let e=this.currentSample;if(e){if(this.audioEl||(this.audioEl=d(new Audio),this.audioEl.addEventListener(`ended`,()=>{this.playing=!1})),this.playing){this.audioEl.pause(),this.playing=!1;return}this.audioEl.src!==e&&(this.audioEl.src=e),this.audioEl.currentTime=0,this.audioEl.play().then(()=>{this.playing=!0}).catch(()=>{this.playing=!1})}},stopSample(){this.audioEl&&(this.audioEl.pause(),this.audioEl.currentTime=0),this.playing=!1},onGenerate(){this.$emit(`generate`)}}}),Re={class:`flex flex-col h-full`},ze={class:`flex-1 overflow-y-auto p-5`},Be={class:`text-xs mb-1`},Ve={class:`field-block mb-5`},He={class:`field-head`},Ue={class:`field-title font-bold`},We={class:`field-block mb-5`},Ge={class:`field-head`},Ke={class:`field-title font-bold`},qe={class:`language-picker`},Je={class:`language-role language-role--primary`},Ye={class:`language-role-label`},Xe={class:`language-role`},Ze={class:`language-role-label`},Qe={class:`field-block mb-5`},$e={class:`field-head`},et={class:`field-title font-bold`},tt=[`aria-label`],nt=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],rt={class:`ratio-preview`},it={class:`ratio-name`},at={class:`field-row mb-4`},ot={class:`field-head`},st={class:`field-title font-bold`},ct={class:`field-row`},lt={class:`field-head`},ut={class:`field-title font-bold`},dt={class:`custom-field`},ft={class:`custom-field-header mb-2`},pt={class:`field-head`},mt={class:`field-title font-bold`},ht=[`aria-label`,`aria-disabled`],gt=[`aria-checked`,`aria-disabled`,`aria-label`,`tabindex`,`onClick`,`onKeydown`],_t={class:`scenario-thumb`},vt=[`src`,`alt`],yt={class:`scenario-name`},bt={class:`custom-field`},xt={class:`custom-field-header mb-2`},St={class:`field-head`},Ct={class:`field-title font-bold`},wt={class:`custom-field`},Tt={class:`custom-field-header mb-2`},Et={class:`field-head`},Dt={class:`field-title font-bold`},Ot={class:`voice-row`},kt={class:`flex flex-col items-center justify-center px-5 pb-5`};function At(d,f,p,y,b,x){let S=u(`font-awesome-icon`),C=u(`el-button`),w=u(`el-alert`),T=u(`prompt-textarea`),E=u(`info-icon`),D=u(`file-urls-input`),O=u(`el-option`),k=u(`el-select`),A=u(`el-input-number`),j=u(`el-switch`);return v(),s(`div`,Re,[e(`div`,ze,[d.isRemixing?(v(),m(w,{key:0,closable:!1,type:`info`,class:`mb-5`},{default:h(()=>[e(`p`,Be,[a(S,{icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`}),r(` `+i(d.$t(`maestro.name.remixing`))+`: `+i(d.refTaskId),1)]),a(C,{size:`small`,text:``,onClick:d.onClearRemix},{default:h(()=>[r(i(d.$t(`maestro.button.cancelRemix`)),1)]),_:1},8,[`onClick`])]),_:1})):o(``,!0),a(T,{modelValue:d.prompt,"onUpdate:modelValue":f[0]||=e=>d.prompt=e,class:`mb-5`,title:d.$t(`maestro.name.prompt`),info:d.$t(`maestro.description.prompt`),placeholder:d.$t(`maestro.placeholder.prompt`),"min-rows":6},null,8,[`modelValue`,`title`,`info`,`placeholder`]),e(`div`,Ve,[e(`div`,He,[e(`h2`,Ue,i(d.$t(`maestro.name.files`)),1),a(E,{content:d.$t(`maestro.description.files`),class:`ml-1`},null,8,[`content`])]),a(D)]),e(`div`,We,[e(`div`,Ge,[e(`h2`,Ke,i(d.$t(`maestro.name.langs`)),1),a(E,{content:d.$t(`maestro.description.langs`),class:`ml-1`},null,8,[`content`])]),e(`div`,qe,[e(`label`,Je,[e(`span`,Ye,i(d.$t(`maestro.name.primaryLanguage`)),1),a(k,{modelValue:d.primaryLanguage,"onUpdate:modelValue":f[1]||=e=>d.primaryLanguage=e,class:`w-full`},{default:h(()=>[(v(!0),s(l,null,_(d.languageOptions,e=>(v(),m(O,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),e(`label`,Xe,[e(`span`,Ze,i(d.$t(`maestro.name.additionalLanguages`)),1),a(k,{modelValue:d.additionalLanguages,"onUpdate:modelValue":f[2]||=e=>d.additionalLanguages=e,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,placeholder:d.$t(`maestro.placeholder.additionalLanguages`),class:`w-full`},{default:h(()=>[(v(!0),s(l,null,_(d.additionalLanguageOptions,e=>(v(),m(O,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])]),e(`div`,Qe,[e(`div`,$e,[e(`h2`,et,i(d.$t(`maestro.name.aspect`)),1)]),e(`div`,{class:`ratio-items`,role:`radiogroup`,"aria-label":d.$t(`maestro.name.aspect`)},[(v(!0),s(l,null,_(d.ratioOptions,r=>(v(),s(`div`,{key:r.value,class:n([`ratio-item`,{active:d.aspect===r.value}]),role:`radio`,"aria-checked":d.aspect===r.value,"aria-label":r.value,tabindex:`0`,onClick:e=>d.aspect=r.value,onKeydown:[c(t(e=>d.aspect=r.value,[`prevent`]),[`enter`]),c(t(e=>d.aspect=r.value,[`prevent`]),[`space`])]},[e(`div`,rt,[e(`div`,{class:`ratio-rect`,style:g({width:r.width+`px`,height:r.height+`px`})},null,4)]),e(`p`,it,i(r.value),1)],42,nt))),128))],8,tt)]),e(`div`,at,[e(`div`,ot,[e(`h2`,st,i(d.$t(`maestro.name.duration`)),1),a(E,{content:d.$t(`maestro.description.duration`),class:`ml-1`},null,8,[`content`])]),a(A,{modelValue:d.duration,"onUpdate:modelValue":f[3]||=e=>d.duration=e,class:`field-control`,min:d.MAESTRO_MIN_DURATION,max:d.MAESTRO_MAX_DURATION,step:5,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`])]),e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(d.$t(`maestro.name.quality`)),1),a(E,{content:d.$t(`maestro.description.quality`),class:`ml-1`},null,8,[`content`])]),a(k,{modelValue:d.quality,"onUpdate:modelValue":f[4]||=e=>d.quality=e,class:`field-control`},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_QUALITIES,e=>(v(),m(O,{key:e,label:d.$t(`maestro.option.quality.${e}`),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),e(`div`,dt,[e(`div`,ft,[e(`div`,pt,[e(`h2`,mt,i(d.$t(`maestro.name.customizeScenario`)),1),a(E,{content:d.$t(`maestro.description.scenario`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.scenarioCustomizationEnabled,"onUpdate:modelValue":f[5]||=e=>d.scenarioCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeScenario`)},null,8,[`modelValue`,`aria-label`])]),e(`div`,{class:n([`scenario-cards`,{"is-disabled":!d.scenarioCustomizationEnabled}]),role:`radiogroup`,"aria-label":d.$t(`maestro.name.scenario`),"aria-disabled":!d.scenarioCustomizationEnabled},[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_SCENARIOS,r=>(v(),s(`div`,{key:r,class:n([`scenario-card`,{active:d.scenarioCustomizationEnabled&&d.scenario===r,disabled:!d.scenarioCustomizationEnabled}]),role:`radio`,"aria-checked":d.scenarioCustomizationEnabled&&d.scenario===r,"aria-disabled":!d.scenarioCustomizationEnabled,"aria-label":d.$t(`maestro.option.scenario.${r}`),tabindex:d.scenarioCustomizationEnabled?0:-1,onClick:e=>d.scenarioCustomizationEnabled&&(d.scenario=r),onKeydown:[c(t(e=>d.scenarioCustomizationEnabled&&(d.scenario=r),[`prevent`]),[`enter`]),c(t(e=>d.scenarioCustomizationEnabled&&(d.scenario=r),[`prevent`]),[`space`])]},[e(`div`,_t,[e(`img`,{src:d.MAESTRO_SCENARIO_THUMBNAILS[r],alt:d.$t(`maestro.option.scenario.${r}`),loading:`lazy`},null,8,vt)]),e(`p`,yt,i(d.$t(`maestro.option.scenario.${r}`)),1)],42,gt))),128))],10,ht),d.needsVideoUpload?(v(),m(w,{key:0,title:d.$t(`maestro.message.captionsNeedVideo`),type:`warning`,closable:!1,"show-icon":``,class:`mt-2`},null,8,[`title`])):o(``,!0)]),e(`div`,bt,[e(`div`,xt,[e(`div`,St,[e(`h2`,Ct,i(d.$t(`maestro.name.customizeStyle`)),1),a(E,{content:d.$t(`maestro.description.style`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.styleCustomizationEnabled,"onUpdate:modelValue":f[6]||=e=>d.styleCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeStyle`)},null,8,[`modelValue`,`aria-label`])]),a(k,{modelValue:d.style,"onUpdate:modelValue":f[7]||=e=>d.style=e,class:`w-full`,filterable:``,"allow-create":``,"default-first-option":``,disabled:!d.styleCustomizationEnabled,"aria-label":d.$t(`maestro.name.customizeStyle`),placeholder:d.$t(`maestro.placeholder.select`)},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_STYLES,e=>(v(),m(O,{key:e,label:d.$t(`maestro.option.style.${e}`),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`disabled`,`aria-label`,`placeholder`])]),e(`div`,wt,[e(`div`,Tt,[e(`div`,Et,[e(`h2`,Dt,i(d.$t(`maestro.name.customizeVoice`)),1),a(E,{content:d.$t(`maestro.description.voice`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.voiceCustomizationEnabled,"onUpdate:modelValue":f[8]||=e=>d.voiceCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeVoice`)},null,8,[`modelValue`,`aria-label`])]),e(`div`,Ot,[a(k,{modelValue:d.voice,"onUpdate:modelValue":f[9]||=e=>d.voice=e,class:`voice-select`,disabled:!d.voiceCustomizationEnabled,"aria-label":d.$t(`maestro.name.customizeVoice`),placeholder:d.$t(`maestro.placeholder.select`)},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_VOICES,e=>(v(),m(O,{key:e.key,label:d.$t(`maestro.option.voice.${e.key}`),value:e.key},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`disabled`,`aria-label`,`placeholder`]),a(C,{class:`voice-play`,disabled:!d.voiceCustomizationEnabled||!d.currentSample,title:d.$t(`maestro.button.preview`),onClick:d.onToggleSample},{default:h(()=>[a(S,{icon:d.playing?`fa-solid fa-pause`:`fa-solid fa-play`},null,8,[`icon`])]),_:1},8,[`disabled`,`title`,`onClick`])])])]),e(`div`,kt,[a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!d.canGenerate,onClick:d.onGenerate},{default:h(()=>[a(S,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(d.$t(`maestro.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var jt=V(Le,[[`render`,At],[`__scopeId`,`data-v-0e7c2918`]]),Mt=50,Nt=1e4,Y=new Map,X=new Map,Pt=(e,t)=>{if(Y.set(e,t),Y.size>Mt){let e=Y.keys().next().value;e&&Y.delete(e)}};async function Ft(e,t){let n=`${t.credentialKey}:${e}`,r=Y.get(n);if(r)return r;let i=X.get(n);if(i)return i.promise;let a=new AbortController,o,s={controller:a,promise:void 0},c=L.task(e,{token:t.token,signal:a.signal}).then(({data:e})=>{if(!a.signal.aborted)return Pt(n,e),e}).catch(t=>{a.signal.aborted||console.warn(`failed to load maestro remix reference task`,e,t)}),l=new Promise(e=>{o=window.setTimeout(()=>{a.abort(),e(void 0)},Nt)});return s.promise=Promise.race([c,l]).finally(()=>{o!==void 0&&window.clearTimeout(o),X.get(n)===s&&X.delete(n)}),X.set(n,s),s.promise}var Z=[`plan`,`source`,`voice`,`compose`,`render`,`deliver`];function Q(e){if(!e)return-1;let t=e.toLowerCase(),n=Z.indexOf(t);return n>=0?n:/plan|storyboard|script|brief/.test(t)?0:/source|search|image|photo|asset|media/.test(t)?1:/voice|tts|audio|narrat/.test(t)?2:/compose|composit|build|layout|scene/.test(t)?3:/render|encode/.test(t)?4:/deliver|upload|cdn|complete|done|finish/.test(t)?5:-1}var It=b({name:`ProgressSteps`,components:{ElIcon:C,Loading:x,Check:S},props:{modelValue:{type:Object,required:!0}},computed:{currentIndex(){let e=this.modelValue?.response?.data?.progress||[],t=-1;for(let n of e)t=Math.max(t,Q(n?.stage));return t=Math.max(t,Q(this.modelValue?.response?.data?.stage)),Math.max(t,0)},detail(){let e=this.modelValue?.response?.data;if(e?.activity)return e.activity;let t=e?.progress||[];for(let e=t.length-1;e>=0;e--)if(t[e]?.message)return t[e]?.message},steps(){return Z.map(e=>({key:e}))}},methods:{stateOf(e){let t=this.currentIndex;return e<t?`done`:e===t?`active`:`pending`}}}),Lt={class:`progress-steps`,"aria-live":`polite`},Rt=[`aria-current`],zt={class:`ico`},Bt={class:`txt`},Vt={key:0,class:`detail`};function Ht(t,r,c,d,f,p){let g=u(`loading`),y=u(`el-icon`),b=u(`check`);return v(),s(`div`,Lt,[(v(!0),s(l,null,_(t.steps,(r,c)=>(v(),s(`div`,{key:r.key,class:n([`step`,t.stateOf(c)]),"aria-current":c===t.currentIndex?`step`:void 0},[e(`span`,zt,[c===t.currentIndex?(v(),m(y,{key:0,class:`is-loading`,"aria-label":t.$t(`maestro.step.${r.key}`)},{default:h(()=>[a(g)]),_:1},8,[`aria-label`])):c<t.currentIndex?(v(),m(y,{key:1},{default:h(()=>[a(b)]),_:1})):o(``,!0)]),e(`span`,Bt,i(t.$t(`maestro.step.${r.key}`)),1)],10,Rt))),128)),t.detail?(v(),s(`p`,Vt,i(t.detail),1)):o(``,!0)])}var Ut=V(It,[[`render`,Ht],[`__scopeId`,`data-v-86e2e559`]]),Wt=[`succeeded`,`failed`],Gt=[1e3,3e3],Kt=b({name:`TaskPreview`,components:{ElImage:D,CopyToClipboard:ce,FontAwesomeIcon:q,ElAlert:O,VideoPlayer:he,ElButton:z,ApiCodeButton:ge,ImagePreview:ue,AudioPreview:Te,VideoPreview:Ee,FilePreview:le,ProgressSteps:Ut},props:{modelValue:{type:Object,required:!0}},data(){return{MAESTRO_LOGO:ie,fetchedReferenceTask:void 0,fetchedReferenceKey:void 0,referenceLoadAttempt:0,referenceLoadFailed:!1,referenceLoadTimer:void 0,referenceLoadVersion:0}},computed:{variants(){return this.modelValue?.response?.data?.variants||[]},files(){let e=[...this.modelValue?.request?.file_urls||[]];if(this.referenceTaskId)for(let t of this.referenceTask?.response?.data?.variants||[])t.output_url&&e.push(t.output_url);return[...new Set(e)].filter(e=>!!e).map(e=>{let t=e.split(`?`)[0].split(`#`)[0],n=K(t)?`image`:W(t)?`video`:H(t)?`audio`:`file`;return{url:e,name:this.fileName(t),kind:n}})},referenceTaskId(){let e=this.modelValue?.request;return e?.action===`remix`?e?.ref_task_id:void 0},referenceLoadKey(){let e=this.$store.state.maestro?.credential,t=e?.token;if(!(!this.referenceTaskId||!t))return JSON.stringify([this.referenceTaskId,e?.id||e?.user_id||t,t])},referenceTask(){if(this.referenceTaskId)return this.$store.state.maestro?.tasks?.items?.find(e=>e.id===this.referenceTaskId)||(this.fetchedReferenceKey===this.referenceLoadKey?this.fetchedReferenceTask:void 0)},isTerminal(){return Wt.includes(this.modelValue?.status||``)},traceId(){return this.modelValue?.trace_id||this.modelValue?.response?.trace_id},progressPct(){let e=this.modelValue?.response?.data?.progress,t=e?.length?e[e.length-1]:void 0;return typeof t?.pct==`number`?t.pct:void 0},progressText(){return this.progressPct===void 0?this.statusLabel:`${this.progressPct}%`},statusLabel(){let e=`maestro.status.${this.modelValue?.status||`pending`}`,t=this.$t(e);return t===e?this.$t(`maestro.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message},requestParams(){let e=this.modelValue?.request;if(!e)return[];let t=[];return e.action&&t.push({icon:`fa-solid fa-wand-magic-sparkles`,label:this.$t(`maestro.name.mode`),value:this.optionLabel(`maestro.option.action`,e.action)}),e.scenario&&t.push({icon:`fa-solid fa-clapperboard`,label:this.$t(`maestro.name.scenario`),value:this.optionLabel(`maestro.option.scenario`,e.scenario)}),e.style&&t.push({icon:`fa-solid fa-palette`,label:this.$t(`maestro.name.style`),value:this.optionLabel(`maestro.option.style`,e.style)}),e.quality&&t.push({icon:`fa-solid fa-gauge-high`,label:this.$t(`maestro.name.quality`),value:this.optionLabel(`maestro.option.quality`,e.quality)}),e.aspect&&t.push({icon:`fa-solid fa-expand`,label:this.$t(`maestro.name.aspect`),value:e.aspect}),e.duration&&t.push({icon:`fa-solid fa-clock`,label:this.$t(`maestro.name.duration`),value:`${e.duration}s`}),e.langs?.length&&t.push({icon:`fa-solid fa-language`,label:this.$t(`maestro.name.langs`),value:e.langs.join(` · `)}),t}},watch:{referenceLoadKey:{immediate:!0,handler(e){this.resetReferenceLoad(),e&&!this.referenceTask&&this.loadReferenceTask(e)}}},beforeUnmount(){this.resetReferenceLoad()},methods:{resetReferenceLoad(){this.referenceLoadTimer!==void 0&&window.clearTimeout(this.referenceLoadTimer),this.referenceLoadTimer=void 0,this.referenceLoadVersion+=1,this.referenceLoadAttempt=0,this.referenceLoadFailed=!1,this.fetchedReferenceTask=void 0,this.fetchedReferenceKey=void 0},async loadReferenceTask(e){if(e!==this.referenceLoadKey||this.referenceTask)return;let t=this.$store.state.maestro?.credential,n=t?.token,r=this.referenceTaskId;if(!r||!n)return;let i=t?.id||t?.user_id||n,a=this.referenceLoadVersion;this.referenceLoadAttempt+=1;let o=await Ft(r,{token:n,credentialKey:i});if(a!==this.referenceLoadVersion||e!==this.referenceLoadKey)return;if(o){this.fetchedReferenceTask=o,this.fetchedReferenceKey=e,this.referenceLoadFailed=!1;return}let s=Gt[this.referenceLoadAttempt-1];s===void 0?this.referenceLoadFailed=!0:this.referenceLoadTimer=window.setTimeout(()=>{this.referenceLoadTimer=void 0,this.loadReferenceTask(e)},s)},retryReferenceTask(){let e=this.referenceLoadKey;this.resetReferenceLoad(),e&&this.loadReferenceTask(e)},optionLabel(e,t){let n=`${e}.${t}`,r=this.$t(n);return r===n?t:r},fileName(e){let t=e.substring(e.lastIndexOf(`/`)+1);try{return decodeURIComponent(t)||e}catch{return t||e}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)},onRemix(){if(!this.modelValue)return;let e=xe(this.$store.state.maestro?.config,this.modelValue);this.$store.commit(`maestro/setConfig`,e),U.info(this.$t(`maestro.message.remixLoaded`))}}}),qt={class:`preview`},Jt={class:`left`},Yt={class:`main`},Xt={class:`bot`},Zt={class:`datetime`},Qt={class:`info`},$t={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},en=[`href`,`title`],tn={key:1,class:`reference-load-failed flex items-center gap-1 mt-2 text-xs text-[var(--el-text-color-secondary)]`},nn={key:2,class:`prompt mt-2`},rn={key:0,class:`progress-pct`},an={key:0,class:`content`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},cn={key:1,class:`content`},$={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},ln={key:0},un={class:`operations`},dn={key:0},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},hn={key:2,class:`content`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(t,c,d,f,p,g){let y=u(`el-image`),b=u(`image-preview`),x=u(`video-preview`),S=u(`audio-preview`),C=u(`file-preview`),w=u(`font-awesome-icon`),T=u(`el-button`),E=u(`progress-steps`),D=u(`copy-to-clipboard`),O=u(`el-alert`),k=u(`video-player`),A=u(`api-code-button`);return v(),s(`div`,qt,[e(`div`,Jt,[a(y,{src:t.MAESTRO_LOGO,class:`avatar`},null,8,[`src`])]),e(`div`,Yt,[e(`div`,Xt,[r(i(t.$t(`maestro.name.maestroBot`))+` `,1),e(`span`,Zt,i(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Qt,[t.files.length?(v(),s(`div`,$t,[(v(!0),s(l,null,_(t.files,(e,t)=>(v(),s(l,{key:t},[e.kind===`image`?(v(),m(b,{key:0,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`])):e.kind===`video`?(v(),m(x,{key:1,url:e.url,name:e.name},null,8,[`url`,`name`])):e.kind===`audio`?(v(),m(S,{key:2,url:e.url,name:e.name},null,8,[`url`,`name`])):(v(),s(`a`,{key:3,href:e.url,title:e.name,target:`_blank`,rel:`noopener noreferrer`,class:`shrink-0 no-underline`},[a(C,{name:e.name,closable:!1},null,8,[`name`])],8,en))],64))),128))])):o(``,!0),t.referenceLoadFailed&&t.referenceTaskId&&!t.referenceTask?(v(),s(`div`,tn,[a(w,{icon:`fa-solid fa-circle-info`}),e(`span`,null,i(t.$t(`maestro.name.files`))+`: `+i(t.$t(`maestro.name.failure`)),1),a(T,{class:`reference-retry`,size:`small`,text:``,circle:``,title:t.$t(`codingBridge.session.retry`),"aria-label":t.$t(`codingBridge.session.retry`),onClick:t.retryReferenceTask},{default:h(()=>[a(w,{icon:`fa-solid fa-rotate-right`})]),_:1},8,[`title`,`aria-label`,`onClick`])])):o(``,!0),t.modelValue?.request?.prompt?(v(),s(`p`,nn,[r(i(t.modelValue?.request?.prompt)+` `,1),t.isTerminal?o(``,!0):(v(),s(`span`,rn,` · `+i(t.progressText),1))])):o(``,!0)]),t.isTerminal?o(``,!0):(v(),s(`div`,an,[a(O,{closable:!1,class:`mt-2 processing`},{default:h(()=>[a(E,{"model-value":t.modelValue},null,8,[`model-value`]),(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:n([`text-[var(--el-text-color-regular)] text-xs mb-2`,{"mt-3":t===0}])},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)],2))),128)),e(`p`,on,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.traceId?(v(),s(`p`,sn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])),t.modelValue?.response?.success===!0&&t.variants.length?(v(),s(`div`,cn,[(v(!0),s(l,null,_(t.variants,(t,n)=>(v(),s(`div`,{key:n,class:`mb-4`},[e(`p`,$,[a(w,{icon:`fa-solid fa-language`,class:`mr-1`}),r(i(t.lang),1),t.title?(v(),s(`span`,ln,` · `+i(t.title),1)):o(``,!0)]),t.output_url?(v(),m(k,{key:0,src:t.output_url},null,8,[`src`])):o(``,!0)]))),128)),e(`div`,un,[(v(!0),s(l,null,_(t.variants,(e,n)=>(v(),s(l,{key:n},[e.output_url?(v(),m(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:n=>t.onDownload(n,e.output_url)},{default:h(()=>[a(w,{icon:`fa-solid fa-download`,class:`mr-1`}),r(` `+i(t.$t(`maestro.button.download`)),1),t.variants.length>1?(v(),s(`span`,dn,` · `+i(e.lang),1)):o(``,!0)]),_:2},1032,[`onClick`])):o(``,!0)],64))),128)),a(T,{size:`small`,type:`primary`,class:`btn-action`,onClick:t.onRemix},{default:h(()=>[a(w,{icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`}),r(` `+i(t.$t(`maestro.button.remix`)),1)]),_:1},8,[`onClick`]),a(A,{path:`/maestro/videos`,body:t.modelValue?.request},null,8,[`body`])]),a(O,{closable:!1,class:`mt-2 success`},{default:h(()=>[(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)]))),128)),e(`p`,fn,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(v(),s(`p`,pn,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.traceId?(v(),s(`p`,mn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),t.modelValue?.response?.success===!1?(v(),s(`div`,hn,[a(O,{closable:!1,class:`failure`},{template:h(()=>[a(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.failure`)),1)]),default:h(()=>[(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)]))),128)),e(`p`,gn,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.failureReason?(v(),s(`p`,_n,[a(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.failureReason`))+`: `+i(t.failureReason),1)])):o(``,!0),t.modelValue?.elapsed?(v(),s(`p`,vn,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.traceId?(v(),s(`p`,yn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var xn=b({name:`RecentPanel`,components:{TaskPreview:V(Kt,[[`render`,bn],[`__scopeId`,`data-v-55b17645`]]),NoTasks:ve,BotPlaceholder:_e,ScrollList:pe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.maestro?.tasks,items:this.$store.state.maestro?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),p=u(`scroll-list`),g=u(`no-tasks`);return v(),s(l,null,[e.tasks?.items===void 0?(v(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(v(),m(p,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:h(()=>[(v(!0),s(l,null,_(e.tasks?.items,(e,t)=>(v(),m(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(v(),s(`div`,Cn,[a(g)])):o(``,!0)],64)}var Tn=b({name:`MaestroIndex`,components:{ConfigPanel:jt,Layout:Me,RecentPanel:V(xn,[[`render`,wn]])},inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.maestro?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.maestro?.status?.getTasks===R.Request||this.fetchingTasks},credential(){return this.$store.state.maestro.credential},config(){return this.$store.state.maestro.config},tasks(){return this.$store.state.maestro.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await me({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`maestro/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`maestro/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){let e=we(this.config);if(!B())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}U.info(this.$t(`maestro.message.startingTask`)),G(`maestro`,L.generate(e,{token:t})).then(()=>{U.success(this.$t(`maestro.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`maestro.message.usedUp`)):U.error(this.$t(`maestro.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function En(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return v(),m(l,null,{config:h(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:h(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=V(Tn,[[`render`,En]]);export{Dn as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,C as t,Gt as n,I as r,Jt as i,L as a,M as o,N as s,S as c,T as l,at as u,bt as d,ht as f,it as p,j as m,mt as h,qt as g,rt as _,tt as v,x as y,z as b}from"./vendor-chart-Dw-P17PN.js";import{I as x,b as S,nt as C}from"./use-deprecated-B-uvyrTL.js";import{r as w,t as T}from"./select-DvoqOdpJ.js";import{t as E}from"./upload-YiAKN8Py.js";import{t as D}from"./image-D5GTCt7T.js";import{t as O}from"./alert-OQpRj2T1.js";import{t as k}from"./drawer-I7xPkGcQ.js";import{t as A}from"./input-number-Dzrcxfmt.js";import{t as j}from"./switch-B9HKxKEO.js";import{Ar as M,Cr as ee,Mr as te,Or as N,Pr as P,Sr as F,Tr as I,_r as ne,br as re,jr as ie,xr as ae,yr as oe}from"./constants-DxuoPabX.js";import{Fn as L,Kr as R,Yr as se,_i as z,en as B,j as V,nn as H,oi as U,on as W,or as G,rn as K}from"./index-CVIbScOR.js";import{t as q}from"./index.es-DFowd1fY.js";import{t as ce}from"./CopyToClipboard-DDOSZiCt.js";import{t as le}from"./FilePreview-BgmKvogN.js";import{t as ue}from"./ImagePreview-83gb1Wk3.js";import{n as de}from"./taskDrawerMixin-DyAUhFEq.js";import{i as fe,n as pe,t as me}from"./pagination-DeLGsK5x.js";import{t as he}from"./VideoPlayer-DI3PVekV.js";import{t as ge}from"./ApiCodeButton-Ds-DXrRl.js";import{t as _e}from"./BotPlaceholder-KUVrB1fh.js";import{t as ve}from"./NoTasks-VnYzvYev.js";import{t as ye}from"./PromptTextarea-DpyGubYO.js";import{a as J,i as be,n as xe,o as Se,s as Ce,t as we}from"./maestro-CBjCyEKr.js";import{n as Te,t as Ee}from"./VideoPreview-B0RlfkdO.js";var De=b({name:`LayoutMaestro`,components:{ElDrawer:k,ElButton:z,FontAwesomeIcon:q},mixins:[de]}),Oe={class:`main flex flex-row flex-1`},ke={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},Ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function je(t,n,r,i,o,c){let l=u(`font-awesome-icon`),d=u(`el-button`),m=u(`el-drawer`);return v(),s(`div`,Oe,[e(`div`,ke,[p(t.$slots,`config`,{},void 0,!0)]),e(`div`,Ae,[p(t.$slots,`result`,{},void 0,!0)]),f(a(d,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:h(()=>[a(l,{icon:`fa-solid fa-magic`})]),_:1},512),[[y,!t.tasksEmpty]]),a(m,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:h(()=>[p(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var Me=V(De,[[`render`,je],[`__scopeId`,`data-v-91db2b6f`]]),Ne=b({name:`MaestroFileUrlsInput`,components:{ElUpload:E,ElButton:z,FontAwesomeIcon:q},data(){return{fileList:[],uploadUrl:se()+`/api/v1/files/`,MAESTRO_FILE_ACCEPT:M,MAESTRO_FILE_LIMIT:6}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},value(){return this.$store.state.maestro?.config?.file_urls||[]}},watch:{value:{immediate:!0,handler(e){let t=new Map(this.fileList.map(e=>[e?.response?.file_url||e.url,e])),n=e.map(e=>t.get(e)||{name:e.split(`/`).pop()||e,url:e,status:`success`,percentage:100,response:{file_url:e}}),r=this.fileList.filter(e=>!(e?.response?.file_url||e.url));this.fileList=[...n,...r]}}},methods:{onExceed(){U.warning(this.$t(`maestro.message.uploadExceed`))},onError(){U.error(this.$t(`maestro.message.uploadError`))},onChange(){let e=this.fileList.map(e=>e?.response?.file_url||e.url).filter(e=>!!e);this.$store.commit(`maestro/setConfig`,{...this.$store.state.maestro?.config,file_urls:e})}}});function Pe(e,t,n,o,c,l){let d=u(`font-awesome-icon`),f=u(`el-button`),p=u(`el-upload`);return v(),s(`div`,null,[a(p,{ref:`uploader`,"file-list":e.fileList,"onUpdate:fileList":t[0]||=t=>e.fileList=t,accept:e.MAESTRO_FILE_ACCEPT,name:`file`,class:`w-full`,limit:e.MAESTRO_FILE_LIMIT,multiple:!0,action:e.uploadUrl,headers:e.headers,"on-exceed":e.onExceed,"on-error":e.onError,"on-success":e.onChange,"on-remove":e.onChange},{default:h(()=>[a(f,{size:`small`,round:``},{default:h(()=>[a(d,{icon:`fa-solid fa-paperclip`,class:`mr-1`}),r(` `+i(e.$t(`maestro.button.uploadFiles`)),1)]),_:1})]),_:1},8,[`file-list`,`accept`,`limit`,`action`,`headers`,`on-exceed`,`on-error`,`on-success`,`on-remove`])])}var Fe=V(Ne,[[`render`,Pe]]),Ie={"9:16":{width:15,height:26},"16:9":{width:26,height:15},"1:1":{width:20,height:20}},Le=b({name:`ConfigPanel`,components:{ElButton:z,ElSelect:w,ElOption:T,ElInputNumber:A,ElAlert:O,ElSwitch:j,InfoIcon:fe,PromptTextarea:ye,FileUrlsInput:Fe,FontAwesomeIcon:q},emits:[`generate`],data(){return{MAESTRO_MIN_DURATION:1,MAESTRO_MAX_DURATION:600,MAESTRO_ALLOWED_QUALITIES:oe,MAESTRO_ALLOWED_SCENARIOS:re,MAESTRO_SCENARIO_THUMBNAILS:te,MAESTRO_ALLOWED_STYLES:ae,MAESTRO_ALLOWED_VOICES:F,playing:!1,audioEl:null}},computed:{config(){return this.$store.state.maestro?.config},service(){return this.$store.state.maestro?.service},ratioOptions(){return ne.map(e=>({value:e,...Ie[e]??{width:20,height:20}}))},isRemixing(){let e=this.config?.action;return!!e&&e!==`generate`&&!!this.config?.ref_task_id},refTaskId(){return this.config?.ref_task_id},needsVideoUpload(){if(!this.scenarioCustomizationEnabled)return!1;let e=this.config?.scenario;return!e||!P.includes(e)?!1:!(this.config?.file_urls||[]).some(e=>W(e))},canGenerate(){return!!this.prompt?.trim()&&!this.needsVideoUpload},prompt:{get(){return this.config?.prompt},set(e){this.update({prompt:e})}},langs:{get(){return J(this.config?.langs)},set(e){this.update({langs:J(e)})}},languageOptions(){return be(this.$i18n.locale)},additionalLanguageOptions(){return this.languageOptions.filter(e=>e.value!==this.primaryLanguage)},primaryLanguage:{get(){return this.langs[0]||I[0]},set(e){this.update({langs:Ce(this.langs,e)})}},additionalLanguages:{get(){return this.langs.slice(1)},set(e){this.update({langs:Se(this.langs,e)})}},aspect:{get(){return this.config?.aspect},set(e){this.update({aspect:e})}},duration:{get(){return this.config?.duration},set(e){let t=Math.min(600,Math.max(1,Math.round(typeof e==`number`&&!Number.isNaN(e)?e:30)));this.update({duration:t})}},quality:{get(){return this.config?.quality},set(e){this.update({quality:e})}},scenarioCustomizationEnabled:{get(){return this.config?.scenario_customization_enabled??!1},set(e){this.update({scenario_customization_enabled:e})}},styleCustomizationEnabled:{get(){return this.config?.style_customization_enabled??!1},set(e){this.update({style_customization_enabled:e})}},voiceCustomizationEnabled:{get(){return this.config?.voice_customization_enabled??!1},set(e){e||this.stopSample(),this.update({voice_customization_enabled:e})}},scenario:{get(){return this.config?.scenario},set(e){this.update({scenario:e})}},style:{get(){return this.config?.style},set(e){let t=e?.trim();this.update({style:!t||t.toLowerCase()===`auto`?N:t})}},voice:{get(){return this.config?.voice},set(e){this.stopSample(),this.update({voice:e||`warm-female`})}},currentSample(){return F.find(e=>e.key===this.voice)?.sample}},watch:{voiceCustomizationEnabled(e){e||this.stopSample()},voice(){this.stopSample()}},mounted(){this.update({action:this.config?.action??`generate`,langs:J(this.config?.langs),aspect:this.config?.aspect??`9:16`,duration:this.config?.duration??30,quality:this.config?.quality??`standard`})},beforeUnmount(){this.stopSample()},methods:{update(e){this.$store.commit(`maestro/setConfig`,{...this.config,...e})},onClearRemix(){this.update({action:ee,ref_task_id:void 0})},onToggleSample(){let e=this.currentSample;if(e){if(this.audioEl||(this.audioEl=d(new Audio),this.audioEl.addEventListener(`ended`,()=>{this.playing=!1})),this.playing){this.audioEl.pause(),this.playing=!1;return}this.audioEl.src!==e&&(this.audioEl.src=e),this.audioEl.currentTime=0,this.audioEl.play().then(()=>{this.playing=!0}).catch(()=>{this.playing=!1})}},stopSample(){this.audioEl&&(this.audioEl.pause(),this.audioEl.currentTime=0),this.playing=!1},onGenerate(){this.$emit(`generate`)}}}),Re={class:`flex flex-col h-full`},ze={class:`flex-1 overflow-y-auto p-5`},Be={class:`text-xs mb-1`},Ve={class:`field-block mb-5`},He={class:`field-head`},Ue={class:`field-title font-bold`},We={class:`field-block mb-5`},Ge={class:`field-head`},Ke={class:`field-title font-bold`},qe={class:`language-picker`},Je={class:`language-role language-role--primary`},Ye={class:`language-role-label`},Xe={class:`language-role`},Ze={class:`language-role-label`},Qe={class:`field-block mb-5`},$e={class:`field-head`},et={class:`field-title font-bold`},tt=[`aria-label`],nt=[`aria-checked`,`aria-label`,`onClick`,`onKeydown`],rt={class:`ratio-preview`},it={class:`ratio-name`},at={class:`field-row mb-4`},ot={class:`field-head`},st={class:`field-title font-bold`},ct={class:`field-row`},lt={class:`field-head`},ut={class:`field-title font-bold`},dt={class:`custom-field`},ft={class:`custom-field-header mb-2`},pt={class:`field-head`},mt={class:`field-title font-bold`},ht=[`aria-label`,`aria-disabled`],gt=[`aria-checked`,`aria-disabled`,`aria-label`,`tabindex`,`onClick`,`onKeydown`],_t={class:`scenario-thumb`},vt=[`src`,`alt`],yt={class:`scenario-name`},bt={class:`custom-field`},xt={class:`custom-field-header mb-2`},St={class:`field-head`},Ct={class:`field-title font-bold`},wt={class:`custom-field`},Tt={class:`custom-field-header mb-2`},Et={class:`field-head`},Dt={class:`field-title font-bold`},Ot={class:`voice-row`},kt={class:`flex flex-col items-center justify-center px-5 pb-5`};function At(d,f,p,y,b,x){let S=u(`font-awesome-icon`),C=u(`el-button`),w=u(`el-alert`),T=u(`prompt-textarea`),E=u(`info-icon`),D=u(`file-urls-input`),O=u(`el-option`),k=u(`el-select`),A=u(`el-input-number`),j=u(`el-switch`);return v(),s(`div`,Re,[e(`div`,ze,[d.isRemixing?(v(),m(w,{key:0,closable:!1,type:`info`,class:`mb-5`},{default:h(()=>[e(`p`,Be,[a(S,{icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`}),r(` `+i(d.$t(`maestro.name.remixing`))+`: `+i(d.refTaskId),1)]),a(C,{size:`small`,text:``,onClick:d.onClearRemix},{default:h(()=>[r(i(d.$t(`maestro.button.cancelRemix`)),1)]),_:1},8,[`onClick`])]),_:1})):o(``,!0),a(T,{modelValue:d.prompt,"onUpdate:modelValue":f[0]||=e=>d.prompt=e,class:`mb-5`,title:d.$t(`maestro.name.prompt`),info:d.$t(`maestro.description.prompt`),placeholder:d.$t(`maestro.placeholder.prompt`),"min-rows":6},null,8,[`modelValue`,`title`,`info`,`placeholder`]),e(`div`,Ve,[e(`div`,He,[e(`h2`,Ue,i(d.$t(`maestro.name.files`)),1),a(E,{content:d.$t(`maestro.description.files`),class:`ml-1`},null,8,[`content`])]),a(D)]),e(`div`,We,[e(`div`,Ge,[e(`h2`,Ke,i(d.$t(`maestro.name.langs`)),1),a(E,{content:d.$t(`maestro.description.langs`),class:`ml-1`},null,8,[`content`])]),e(`div`,qe,[e(`label`,Je,[e(`span`,Ye,i(d.$t(`maestro.name.primaryLanguage`)),1),a(k,{modelValue:d.primaryLanguage,"onUpdate:modelValue":f[1]||=e=>d.primaryLanguage=e,class:`w-full`},{default:h(()=>[(v(!0),s(l,null,_(d.languageOptions,e=>(v(),m(O,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),e(`label`,Xe,[e(`span`,Ze,i(d.$t(`maestro.name.additionalLanguages`)),1),a(k,{modelValue:d.additionalLanguages,"onUpdate:modelValue":f[2]||=e=>d.additionalLanguages=e,multiple:``,"collapse-tags":``,"collapse-tags-tooltip":``,placeholder:d.$t(`maestro.placeholder.additionalLanguages`),class:`w-full`},{default:h(()=>[(v(!0),s(l,null,_(d.additionalLanguageOptions,e=>(v(),m(O,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])]),e(`div`,Qe,[e(`div`,$e,[e(`h2`,et,i(d.$t(`maestro.name.aspect`)),1)]),e(`div`,{class:`ratio-items`,role:`radiogroup`,"aria-label":d.$t(`maestro.name.aspect`)},[(v(!0),s(l,null,_(d.ratioOptions,r=>(v(),s(`div`,{key:r.value,class:n([`ratio-item`,{active:d.aspect===r.value}]),role:`radio`,"aria-checked":d.aspect===r.value,"aria-label":r.value,tabindex:`0`,onClick:e=>d.aspect=r.value,onKeydown:[c(t(e=>d.aspect=r.value,[`prevent`]),[`enter`]),c(t(e=>d.aspect=r.value,[`prevent`]),[`space`])]},[e(`div`,rt,[e(`div`,{class:`ratio-rect`,style:g({width:r.width+`px`,height:r.height+`px`})},null,4)]),e(`p`,it,i(r.value),1)],42,nt))),128))],8,tt)]),e(`div`,at,[e(`div`,ot,[e(`h2`,st,i(d.$t(`maestro.name.duration`)),1),a(E,{content:d.$t(`maestro.description.duration`),class:`ml-1`},null,8,[`content`])]),a(A,{modelValue:d.duration,"onUpdate:modelValue":f[3]||=e=>d.duration=e,class:`field-control`,min:d.MAESTRO_MIN_DURATION,max:d.MAESTRO_MAX_DURATION,step:5,"controls-position":`right`},null,8,[`modelValue`,`min`,`max`])]),e(`div`,ct,[e(`div`,lt,[e(`h2`,ut,i(d.$t(`maestro.name.quality`)),1),a(E,{content:d.$t(`maestro.description.quality`),class:`ml-1`},null,8,[`content`])]),a(k,{modelValue:d.quality,"onUpdate:modelValue":f[4]||=e=>d.quality=e,class:`field-control`},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_QUALITIES,e=>(v(),m(O,{key:e,label:d.$t(`maestro.option.quality.${e}`),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),e(`div`,dt,[e(`div`,ft,[e(`div`,pt,[e(`h2`,mt,i(d.$t(`maestro.name.customizeScenario`)),1),a(E,{content:d.$t(`maestro.description.scenario`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.scenarioCustomizationEnabled,"onUpdate:modelValue":f[5]||=e=>d.scenarioCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeScenario`)},null,8,[`modelValue`,`aria-label`])]),e(`div`,{class:n([`scenario-cards`,{"is-disabled":!d.scenarioCustomizationEnabled}]),role:`radiogroup`,"aria-label":d.$t(`maestro.name.scenario`),"aria-disabled":!d.scenarioCustomizationEnabled},[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_SCENARIOS,r=>(v(),s(`div`,{key:r,class:n([`scenario-card`,{active:d.scenarioCustomizationEnabled&&d.scenario===r,disabled:!d.scenarioCustomizationEnabled}]),role:`radio`,"aria-checked":d.scenarioCustomizationEnabled&&d.scenario===r,"aria-disabled":!d.scenarioCustomizationEnabled,"aria-label":d.$t(`maestro.option.scenario.${r}`),tabindex:d.scenarioCustomizationEnabled?0:-1,onClick:e=>d.scenarioCustomizationEnabled&&(d.scenario=r),onKeydown:[c(t(e=>d.scenarioCustomizationEnabled&&(d.scenario=r),[`prevent`]),[`enter`]),c(t(e=>d.scenarioCustomizationEnabled&&(d.scenario=r),[`prevent`]),[`space`])]},[e(`div`,_t,[e(`img`,{src:d.MAESTRO_SCENARIO_THUMBNAILS[r],alt:d.$t(`maestro.option.scenario.${r}`),loading:`lazy`},null,8,vt)]),e(`p`,yt,i(d.$t(`maestro.option.scenario.${r}`)),1)],42,gt))),128))],10,ht),d.needsVideoUpload?(v(),m(w,{key:0,title:d.$t(`maestro.message.captionsNeedVideo`),type:`warning`,closable:!1,"show-icon":``,class:`mt-2`},null,8,[`title`])):o(``,!0)]),e(`div`,bt,[e(`div`,xt,[e(`div`,St,[e(`h2`,Ct,i(d.$t(`maestro.name.customizeStyle`)),1),a(E,{content:d.$t(`maestro.description.style`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.styleCustomizationEnabled,"onUpdate:modelValue":f[6]||=e=>d.styleCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeStyle`)},null,8,[`modelValue`,`aria-label`])]),a(k,{modelValue:d.style,"onUpdate:modelValue":f[7]||=e=>d.style=e,class:`w-full`,filterable:``,"allow-create":``,"default-first-option":``,disabled:!d.styleCustomizationEnabled,"aria-label":d.$t(`maestro.name.customizeStyle`),placeholder:d.$t(`maestro.placeholder.select`)},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_STYLES,e=>(v(),m(O,{key:e,label:d.$t(`maestro.option.style.${e}`),value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`disabled`,`aria-label`,`placeholder`])]),e(`div`,wt,[e(`div`,Tt,[e(`div`,Et,[e(`h2`,Dt,i(d.$t(`maestro.name.customizeVoice`)),1),a(E,{content:d.$t(`maestro.description.voice`),class:`ml-1`},null,8,[`content`])]),a(j,{modelValue:d.voiceCustomizationEnabled,"onUpdate:modelValue":f[8]||=e=>d.voiceCustomizationEnabled=e,"aria-label":d.$t(`maestro.name.customizeVoice`)},null,8,[`modelValue`,`aria-label`])]),e(`div`,Ot,[a(k,{modelValue:d.voice,"onUpdate:modelValue":f[9]||=e=>d.voice=e,class:`voice-select`,disabled:!d.voiceCustomizationEnabled,"aria-label":d.$t(`maestro.name.customizeVoice`),placeholder:d.$t(`maestro.placeholder.select`)},{default:h(()=>[(v(!0),s(l,null,_(d.MAESTRO_ALLOWED_VOICES,e=>(v(),m(O,{key:e.key,label:d.$t(`maestro.option.voice.${e.key}`),value:e.key},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`disabled`,`aria-label`,`placeholder`]),a(C,{class:`voice-play`,disabled:!d.voiceCustomizationEnabled||!d.currentSample,title:d.$t(`maestro.button.preview`),onClick:d.onToggleSample},{default:h(()=>[a(S,{icon:d.playing?`fa-solid fa-pause`:`fa-solid fa-play`},null,8,[`icon`])]),_:1},8,[`disabled`,`title`,`onClick`])])])]),e(`div`,kt,[a(C,{type:`primary`,class:`btn w-full`,round:``,disabled:!d.canGenerate,onClick:d.onGenerate},{default:h(()=>[a(S,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+i(d.$t(`maestro.button.generate`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var jt=V(Le,[[`render`,At],[`__scopeId`,`data-v-0e7c2918`]]),Mt=50,Nt=1e4,Y=new Map,X=new Map,Pt=(e,t)=>{if(Y.set(e,t),Y.size>Mt){let e=Y.keys().next().value;e&&Y.delete(e)}};async function Ft(e,t){let n=`${t.credentialKey}:${e}`,r=Y.get(n);if(r)return r;let i=X.get(n);if(i)return i.promise;let a=new AbortController,o,s={controller:a,promise:void 0},c=L.task(e,{token:t.token,signal:a.signal}).then(({data:e})=>{if(!a.signal.aborted)return Pt(n,e),e}).catch(t=>{a.signal.aborted||console.warn(`failed to load maestro remix reference task`,e,t)}),l=new Promise(e=>{o=window.setTimeout(()=>{a.abort(),e(void 0)},Nt)});return s.promise=Promise.race([c,l]).finally(()=>{o!==void 0&&window.clearTimeout(o),X.get(n)===s&&X.delete(n)}),X.set(n,s),s.promise}var Z=[`plan`,`source`,`voice`,`compose`,`render`,`deliver`];function Q(e){if(!e)return-1;let t=e.toLowerCase(),n=Z.indexOf(t);return n>=0?n:/plan|storyboard|script|brief/.test(t)?0:/source|search|image|photo|asset|media/.test(t)?1:/voice|tts|audio|narrat/.test(t)?2:/compose|composit|build|layout|scene/.test(t)?3:/render|encode/.test(t)?4:/deliver|upload|cdn|complete|done|finish/.test(t)?5:-1}var It=b({name:`ProgressSteps`,components:{ElIcon:C,Loading:x,Check:S},props:{modelValue:{type:Object,required:!0}},computed:{currentIndex(){let e=this.modelValue?.response?.data?.progress||[],t=-1;for(let n of e)t=Math.max(t,Q(n?.stage));return t=Math.max(t,Q(this.modelValue?.response?.data?.stage)),Math.max(t,0)},detail(){let e=this.modelValue?.response?.data;if(e?.activity)return e.activity;let t=e?.progress||[];for(let e=t.length-1;e>=0;e--)if(t[e]?.message)return t[e]?.message},steps(){return Z.map(e=>({key:e}))}},methods:{stateOf(e){let t=this.currentIndex;return e<t?`done`:e===t?`active`:`pending`}}}),Lt={class:`progress-steps`,"aria-live":`polite`},Rt=[`aria-current`],zt={class:`ico`},Bt={class:`txt`},Vt={key:0,class:`detail`};function Ht(t,r,c,d,f,p){let g=u(`loading`),y=u(`el-icon`),b=u(`check`);return v(),s(`div`,Lt,[(v(!0),s(l,null,_(t.steps,(r,c)=>(v(),s(`div`,{key:r.key,class:n([`step`,t.stateOf(c)]),"aria-current":c===t.currentIndex?`step`:void 0},[e(`span`,zt,[c===t.currentIndex?(v(),m(y,{key:0,class:`is-loading`,"aria-label":t.$t(`maestro.step.${r.key}`)},{default:h(()=>[a(g)]),_:1},8,[`aria-label`])):c<t.currentIndex?(v(),m(y,{key:1},{default:h(()=>[a(b)]),_:1})):o(``,!0)]),e(`span`,Bt,i(t.$t(`maestro.step.${r.key}`)),1)],10,Rt))),128)),t.detail?(v(),s(`p`,Vt,i(t.detail),1)):o(``,!0)])}var Ut=V(It,[[`render`,Ht],[`__scopeId`,`data-v-86e2e559`]]),Wt=[`succeeded`,`failed`],Gt=[1e3,3e3],Kt=b({name:`TaskPreview`,components:{ElImage:D,CopyToClipboard:ce,FontAwesomeIcon:q,ElAlert:O,VideoPlayer:he,ElButton:z,ApiCodeButton:ge,ImagePreview:ue,AudioPreview:Te,VideoPreview:Ee,FilePreview:le,ProgressSteps:Ut},props:{modelValue:{type:Object,required:!0}},data(){return{MAESTRO_LOGO:ie,fetchedReferenceTask:void 0,fetchedReferenceKey:void 0,referenceLoadAttempt:0,referenceLoadFailed:!1,referenceLoadTimer:void 0,referenceLoadVersion:0}},computed:{variants(){return this.modelValue?.response?.data?.variants||[]},files(){let e=[...this.modelValue?.request?.file_urls||[]];if(this.referenceTaskId)for(let t of this.referenceTask?.response?.data?.variants||[])t.output_url&&e.push(t.output_url);return[...new Set(e)].filter(e=>!!e).map(e=>{let t=e.split(`?`)[0].split(`#`)[0],n=K(t)?`image`:W(t)?`video`:H(t)?`audio`:`file`;return{url:e,name:this.fileName(t),kind:n}})},referenceTaskId(){let e=this.modelValue?.request;return e?.action===`remix`?e?.ref_task_id:void 0},referenceLoadKey(){let e=this.$store.state.maestro?.credential,t=e?.token;if(!(!this.referenceTaskId||!t))return JSON.stringify([this.referenceTaskId,e?.id||e?.user_id||t,t])},referenceTask(){if(this.referenceTaskId)return this.$store.state.maestro?.tasks?.items?.find(e=>e.id===this.referenceTaskId)||(this.fetchedReferenceKey===this.referenceLoadKey?this.fetchedReferenceTask:void 0)},isTerminal(){return Wt.includes(this.modelValue?.status||``)},traceId(){return this.modelValue?.trace_id||this.modelValue?.response?.trace_id},progressPct(){let e=this.modelValue?.response?.data?.progress,t=e?.length?e[e.length-1]:void 0;return typeof t?.pct==`number`?t.pct:void 0},progressText(){return this.progressPct===void 0?this.statusLabel:`${this.progressPct}%`},statusLabel(){let e=`maestro.status.${this.modelValue?.status||`pending`}`,t=this.$t(e);return t===e?this.$t(`maestro.status.processing`):t},failureReason(){let e=this.modelValue?.response?.error;if(e)return typeof e==`string`?e:e?.message},requestParams(){let e=this.modelValue?.request;if(!e)return[];let t=[];return e.action&&t.push({icon:`fa-solid fa-wand-magic-sparkles`,label:this.$t(`maestro.name.mode`),value:this.optionLabel(`maestro.option.action`,e.action)}),e.scenario&&t.push({icon:`fa-solid fa-clapperboard`,label:this.$t(`maestro.name.scenario`),value:this.optionLabel(`maestro.option.scenario`,e.scenario)}),e.style&&t.push({icon:`fa-solid fa-palette`,label:this.$t(`maestro.name.style`),value:this.optionLabel(`maestro.option.style`,e.style)}),e.quality&&t.push({icon:`fa-solid fa-gauge-high`,label:this.$t(`maestro.name.quality`),value:this.optionLabel(`maestro.option.quality`,e.quality)}),e.aspect&&t.push({icon:`fa-solid fa-expand`,label:this.$t(`maestro.name.aspect`),value:e.aspect}),e.duration&&t.push({icon:`fa-solid fa-clock`,label:this.$t(`maestro.name.duration`),value:`${e.duration}s`}),e.langs?.length&&t.push({icon:`fa-solid fa-language`,label:this.$t(`maestro.name.langs`),value:e.langs.join(` · `)}),t}},watch:{referenceLoadKey:{immediate:!0,handler(e){this.resetReferenceLoad(),e&&!this.referenceTask&&this.loadReferenceTask(e)}}},beforeUnmount(){this.resetReferenceLoad()},methods:{resetReferenceLoad(){this.referenceLoadTimer!==void 0&&window.clearTimeout(this.referenceLoadTimer),this.referenceLoadTimer=void 0,this.referenceLoadVersion+=1,this.referenceLoadAttempt=0,this.referenceLoadFailed=!1,this.fetchedReferenceTask=void 0,this.fetchedReferenceKey=void 0},async loadReferenceTask(e){if(e!==this.referenceLoadKey||this.referenceTask)return;let t=this.$store.state.maestro?.credential,n=t?.token,r=this.referenceTaskId;if(!r||!n)return;let i=t?.id||t?.user_id||n,a=this.referenceLoadVersion;this.referenceLoadAttempt+=1;let o=await Ft(r,{token:n,credentialKey:i});if(a!==this.referenceLoadVersion||e!==this.referenceLoadKey)return;if(o){this.fetchedReferenceTask=o,this.fetchedReferenceKey=e,this.referenceLoadFailed=!1;return}let s=Gt[this.referenceLoadAttempt-1];s===void 0?this.referenceLoadFailed=!0:this.referenceLoadTimer=window.setTimeout(()=>{this.referenceLoadTimer=void 0,this.loadReferenceTask(e)},s)},retryReferenceTask(){let e=this.referenceLoadKey;this.resetReferenceLoad(),e&&this.loadReferenceTask(e)},optionLabel(e,t){let n=`${e}.${t}`,r=this.$t(n);return r===n?t:r},fileName(e){let t=e.substring(e.lastIndexOf(`/`)+1);try{return decodeURIComponent(t)||e}catch{return t||e}},onDownload(e,t){e?.stopPropagation(),window.open(t,`_blank`)},onRemix(){if(!this.modelValue)return;let e=xe(this.$store.state.maestro?.config,this.modelValue);this.$store.commit(`maestro/setConfig`,e),U.info(this.$t(`maestro.message.remixLoaded`))}}}),qt={class:`preview`},Jt={class:`left`},Yt={class:`main`},Xt={class:`bot`},Zt={class:`datetime`},Qt={class:`info`},$t={key:0,class:`flex justify-start items-center gap-2 mt-2 w-full overflow-x-auto`},en=[`href`,`title`],tn={key:1,class:`reference-load-failed flex items-center gap-1 mt-2 text-xs text-[var(--el-text-color-secondary)]`},nn={key:2,class:`prompt mt-2`},rn={key:0,class:`progress-pct`},an={key:0,class:`content`},on={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},sn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},cn={key:1,class:`content`},$={class:`text-xs text-[var(--el-text-color-secondary)] mb-1`},ln={key:0},un={class:`operations`},dn={key:0},fn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pn={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},hn={key:2,class:`content`},gn={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_n={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vn={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yn={key:2,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function bn(t,c,d,f,p,g){let y=u(`el-image`),b=u(`image-preview`),x=u(`video-preview`),S=u(`audio-preview`),C=u(`file-preview`),w=u(`font-awesome-icon`),T=u(`el-button`),E=u(`progress-steps`),D=u(`copy-to-clipboard`),O=u(`el-alert`),k=u(`video-player`),A=u(`api-code-button`);return v(),s(`div`,qt,[e(`div`,Jt,[a(y,{src:t.MAESTRO_LOGO,class:`avatar`},null,8,[`src`])]),e(`div`,Yt,[e(`div`,Xt,[r(i(t.$t(`maestro.name.maestroBot`))+` `,1),e(`span`,Zt,i(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Qt,[t.files.length?(v(),s(`div`,$t,[(v(!0),s(l,null,_(t.files,(e,t)=>(v(),s(l,{key:t},[e.kind===`image`?(v(),m(b,{key:0,url:e.url,name:e.name,closable:!1},null,8,[`url`,`name`])):e.kind===`video`?(v(),m(x,{key:1,url:e.url,name:e.name},null,8,[`url`,`name`])):e.kind===`audio`?(v(),m(S,{key:2,url:e.url,name:e.name},null,8,[`url`,`name`])):(v(),s(`a`,{key:3,href:e.url,title:e.name,target:`_blank`,rel:`noopener noreferrer`,class:`shrink-0 no-underline`},[a(C,{name:e.name,closable:!1},null,8,[`name`])],8,en))],64))),128))])):o(``,!0),t.referenceLoadFailed&&t.referenceTaskId&&!t.referenceTask?(v(),s(`div`,tn,[a(w,{icon:`fa-solid fa-circle-info`}),e(`span`,null,i(t.$t(`maestro.name.files`))+`: `+i(t.$t(`maestro.name.failure`)),1),a(T,{class:`reference-retry`,size:`small`,text:``,circle:``,title:t.$t(`codingBridge.session.retry`),"aria-label":t.$t(`codingBridge.session.retry`),onClick:t.retryReferenceTask},{default:h(()=>[a(w,{icon:`fa-solid fa-rotate-right`})]),_:1},8,[`title`,`aria-label`,`onClick`])])):o(``,!0),t.modelValue?.request?.prompt?(v(),s(`p`,nn,[r(i(t.modelValue?.request?.prompt)+` `,1),t.isTerminal?o(``,!0):(v(),s(`span`,rn,` · `+i(t.progressText),1))])):o(``,!0)]),t.isTerminal?o(``,!0):(v(),s(`div`,an,[a(O,{closable:!1,class:`mt-2 processing`},{default:h(()=>[a(E,{"model-value":t.modelValue},null,8,[`model-value`]),(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:n([`text-[var(--el-text-color-regular)] text-xs mb-2`,{"mt-3":t===0}])},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)],2))),128)),e(`p`,on,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.traceId?(v(),s(`p`,sn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])),t.modelValue?.response?.success===!0&&t.variants.length?(v(),s(`div`,cn,[(v(!0),s(l,null,_(t.variants,(t,n)=>(v(),s(`div`,{key:n,class:`mb-4`},[e(`p`,$,[a(w,{icon:`fa-solid fa-language`,class:`mr-1`}),r(i(t.lang),1),t.title?(v(),s(`span`,ln,` · `+i(t.title),1)):o(``,!0)]),t.output_url?(v(),m(k,{key:0,src:t.output_url},null,8,[`src`])):o(``,!0)]))),128)),e(`div`,un,[(v(!0),s(l,null,_(t.variants,(e,n)=>(v(),s(l,{key:n},[e.output_url?(v(),m(T,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:n=>t.onDownload(n,e.output_url)},{default:h(()=>[a(w,{icon:`fa-solid fa-download`,class:`mr-1`}),r(` `+i(t.$t(`maestro.button.download`)),1),t.variants.length>1?(v(),s(`span`,dn,` · `+i(e.lang),1)):o(``,!0)]),_:2},1032,[`onClick`])):o(``,!0)],64))),128)),a(T,{size:`small`,type:`primary`,class:`btn-action`,onClick:t.onRemix},{default:h(()=>[a(w,{icon:`fa-solid fa-wand-magic-sparkles`,class:`mr-1`}),r(` `+i(t.$t(`maestro.button.remix`)),1)]),_:1},8,[`onClick`]),a(A,{path:`/maestro/videos`,body:t.modelValue?.request},null,8,[`body`])]),a(O,{closable:!1,class:`mt-2 success`},{default:h(()=>[(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)]))),128)),e(`p`,fn,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(v(),s(`p`,pn,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.traceId?(v(),s(`p`,mn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0),t.modelValue?.response?.success===!1?(v(),s(`div`,hn,[a(O,{closable:!1,class:`failure`},{template:h(()=>[a(w,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.failure`)),1)]),default:h(()=>[(v(!0),s(l,null,_(t.requestParams,(e,t)=>(v(),s(`p`,{key:`param-${t}`,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},[a(w,{icon:e.icon,class:`mr-1`},null,8,[`icon`]),r(` `+i(e.label)+`: `+i(e.value),1)]))),128)),e(`p`,gn,[a(w,{icon:`fa-solid fa-magic`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.taskId`))+`: `+i(t.modelValue?.id)+` `,1),a(D,{content:t.modelValue?.id},null,8,[`content`])]),t.failureReason?(v(),s(`p`,_n,[a(w,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.failureReason`))+`: `+i(t.failureReason),1)])):o(``,!0),t.modelValue?.elapsed?(v(),s(`p`,vn,[a(w,{icon:`fa-solid fa-clock`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.elapsed`))+`: `+i(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):o(``,!0),t.traceId?(v(),s(`p`,yn,[a(w,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),r(` `+i(t.$t(`maestro.name.traceId`))+`: `+i(t.traceId)+` `,1),a(D,{content:t.traceId},null,8,[`content`])])):o(``,!0)]),_:1})])):o(``,!0)])])}var xn=b({name:`RecentPanel`,components:{TaskPreview:V(Kt,[[`render`,bn],[`__scopeId`,`data-v-55b17645`]]),NoTasks:ve,BotPlaceholder:_e,ScrollList:pe},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],computed:{tasks(){return{...this.$store.state.maestro?.tasks,items:this.$store.state.maestro?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),Sn={key:0},Cn={key:2,class:`w-full h-full flex items-center justify-center`};function wn(e,t,n,r,i,c){let d=u(`bot-placeholder`),f=u(`task-preview`),p=u(`scroll-list`),g=u(`no-tasks`);return v(),s(l,null,[e.tasks?.items===void 0?(v(),s(`div`,Sn,[a(d)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(v(),m(p,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:h(()=>[(v(!0),s(l,null,_(e.tasks?.items,(e,t)=>(v(),m(f,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):o(``,!0),e.tasks?.items?.length===0?(v(),s(`div`,Cn,[a(g)])):o(``,!0)],64)}var Tn=b({name:`MaestroIndex`,components:{ConfigPanel:jt,Layout:Me,RecentPanel:V(xn,[[`render`,wn]])},inject:[`initialized`],data(){return{job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.maestro?.status?.getApplications===R.Request},tasksLoading(){return this.$store.state.maestro?.status?.getTasks===R.Request||this.fetchingTasks},credential(){return this.$store.state.maestro.credential},config(){return this.$store.state.maestro.config},tasks(){return this.$store.state.maestro.tasks}},watch:{initialized:{async handler(e){e&&(await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await me({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){await this.$store.dispatch(`maestro/getService`)},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks)return;let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};this.fetchingTasks=!0;try{await this.$store.dispatch(`maestro/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){let e=we(this.config);if(!B())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}U.info(this.$t(`maestro.message.startingTask`)),G(`maestro`,L.generate(e,{token:t})).then(()=>{U.success(this.$t(`maestro.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?U.error(this.$t(`maestro.message.usedUp`)):U.error(this.$t(`maestro.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function En(e,t,n,r,i,o){let s=u(`config-panel`),c=u(`recent-panel`),l=u(`layout`);return v(),m(l,null,{config:h(()=>[a(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:h(()=>[a(c,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Dn=V(Tn,[[`render`,En]]);export{Dn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-DlW_4H3t.js";import{t as b}from"./upload-NEt87PZ4.js";import{t as x}from"./tooltip-BYBJPcZV.js";import{t as S}from"./image-C3e5pYdE.js";import{t as C}from"./alert-xa4qD-Fe.js";import{t as w}from"./drawer-5rJXE0y9.js";import{t as T}from"./switch-CVKpq9gb.js";import{Gr as E,Kr as D,qr as O}from"./constants-qNbtmSmx.js";import{Ht as k,Kr as A,Kt as ee,Ln as te,Ut as j,Vt as M,Wt as N,Yr as P,_i as F,en as I,j as L,oi as R,or as z}from"./index-CaaGWjWz.js";import{t as B}from"./index.es-ChYr3ccY.js";import{t as V}from"./CopyToClipboard-Dpqkkmd1.js";import{t as H}from"./ImagePreview-DWw0Go0f.js";import{n as U}from"./taskDrawerMixin-DyAUhFEq.js";import{t as W}from"./Consumption-_5s609Be.js";import{i as G,n as K,t as q}from"./pagination-7x9FPQoF.js";import{t as J}from"./VideoPlayer-B31d0G5B.js";import{t as Y}from"./ApiCodeButton-B2n0Brc3.js";import{t as X}from"./BotPlaceholder-pWxgOlNM.js";import{t as Z}from"./NoTasks-DhYUH2SG.js";import{t as Q}from"./PromptTextarea-D1yTfPjT.js";var ne=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:F,FontAwesomeIcon:B},mixins:[U]}),re={class:`main flex flex-row flex-1`},ie={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function oe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,re,[e(`div`,ie,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,ae,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var se=L(ne,[[`render`,oe],[`__scopeId`,`data-v-12b82bc3`]]),ce=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=O}}),le={class:`field`},ue={class:`title font-bold`};function de(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,le,[e(`h2`,ue,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var fe=L(ce,[[`render`,de],[`__scopeId`,`data-v-a59d89c9`]]),pe=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=E}}),me={class:`field`},he={class:`title font-bold`},ge={class:`float-left`};function _e(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,me,[e(`h2`,he,r(t.$t(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,ge,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ve=L(pe,[[`render`,_e],[`__scopeId`,`data-v-261798ae`]]),ye=_({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:G},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),be={class:`relative`},xe={class:`flex justify-between`},Se={class:`flex justify-start items-center`},Ce={class:`text-sm font-bold`},we={class:`flex justify-end items-center`};function Te(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,be,[e(`div`,xe,[e(`div`,Se,[e(`span`,Ce,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,we,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ee=L(ye,[[`render`,Te]]),De=_({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=D}}),Oe={class:`text-sm font-bold mb-2 block`},ke={class:`items`},Ae=[`onClick`],je={class:`name`};function Me(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Oe,r(n.$t(`veo.name.ratio`)),1),e(`div`,ke,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,je,r(i.label),1)],10,Ae))),128))])])}var Ne=L(De,[[`render`,Me],[`__scopeId`,`data-v-28c472c4`]]),Pe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:F,InfoIcon:G,FontAwesomeIcon:B,ImagePreview:H},mixins:[N,k],emits:[`change`],data(){return{fileList:[],uploadUrl:P()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){R.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){R.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Fe={class:`relative`},Ie={class:`flex justify-between`},Le={class:`flex justify-start items-center`},Re={class:`text-sm font-bold`};function ze(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`span`,Re,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Be=L(Pe,[[`render`,ze],[`__scopeId`,`data-v-f9a79b4a`]]),Ve=_({name:`PromptInput`,components:{PromptTextarea:Q},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function He(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ue=_({name:`ConfigPanel`,components:{ElButton:F,Consumption:W,FontAwesomeIcon:B,PromptInput:L(Ve,[[`render`,He]]),ModelSelector:fe,StartEndImage:Be,ActionSelector:ve,TranslationSelector:Ee,AspectRatioSelector:Ne},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return ee(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),We={class:`flex flex-col h-full`},Ge={class:`flex-1 overflow-y-auto p-5`},Ke={class:`flex flex-col items-center justify-center px-5 pb-5`};function qe(t,s,l,u,p,m){let g=c(`action-selector`),_=c(`translation-selector`),v=c(`aspect-ratio-selector`),y=c(`prompt-input`),b=c(`model-selector`),x=c(`start-end-image`),S=c(`consumption`),C=c(`font-awesome-icon`),w=c(`el-button`);return h(),o(`div`,We,[e(`div`,Ge,[i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(b,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(x,{key:1,class:`mb-2`})):a(``,!0)]),e(`div`,Ke,[i(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(C,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Je=L(Ue,[[`render`,qe]]),Ye=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:V,FontAwesomeIcon:B,ElAlert:C,VideoPlayer:J,ElTooltip:x,ElButton:F,ApiCodeButton:Y},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Xe={class:`preview`},Ze={class:`left`},Qe={class:`main`},$e={class:`bot`},et={class:`datetime`},tt={class:`info`},nt={key:0,class:`prompt mt-2`},rt={key:0},it={key:1},at={key:0,class:t({content:!0,failed:!0})},ot={key:0,class:`mb-4`},st={key:1,class:t({operations:!0,"mt-2":!0})},ct={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},lt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ut={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},dt={key:1,class:t({content:!0})},ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ht={key:2,class:t({content:!0})},gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_t={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function vt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,Xe,[e(`div`,Ze,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,Qe,[e(`div`,$e,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,et,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,tt,[t.modelValue?.request?.prompt?(h(),o(`p`,nt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,rt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,it,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,at,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ot,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,st,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,ct,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,lt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,ut,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,dt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,ft,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,pt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,mt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,ht,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,gt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,_t,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var yt=_({name:`RecentPanel`,components:{TaskPreview:L(Ye,[[`render`,vt],[`__scopeId`,`data-v-a44f5f6b`]]),NoTasks:Z,BotPlaceholder:X,ScrollList:K},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),bt={key:0},xt={key:2,class:`w-full h-full flex items-center justify-center`};function St(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,bt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,xt,[i(v)])):a(``,!0)],64)}var Ct=_({name:`VeoIndex`,components:{ConfigPanel:Je,Layout:se,RecentPanel:L(yt,[[`render`,St]])},mixins:[j],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===A.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===A.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await q({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!M(this.uploadTracker,e=>this.$t(e),e=>R.warning(e)))return;let e={...this.config,async:!0};if(!I())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){R.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,R.info(this.$t(`veo.message.startingTask`)),z(`veo`,te.generate(e,{token:t})).then(()=>{R.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?R.error(this.$t(`veo.message.usedUp`)):R.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function wt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Tt=L(Ct,[[`render`,wt]]);export{Tt as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-DvoqOdpJ.js";import{t as b}from"./upload-YiAKN8Py.js";import{t as x}from"./tooltip-C4ECsqjH.js";import{t as S}from"./image-D5GTCt7T.js";import{t as C}from"./alert-OQpRj2T1.js";import{t as w}from"./drawer-I7xPkGcQ.js";import{t as T}from"./switch-B9HKxKEO.js";import{Gr as E,Kr as D,qr as O}from"./constants-DxuoPabX.js";import{Ht as k,Kr as A,Kt as ee,Ln as te,Ut as j,Vt as M,Wt as N,Yr as P,_i as F,en as I,j as L,oi as R,or as z}from"./index-CVIbScOR.js";import{t as B}from"./index.es-DFowd1fY.js";import{t as V}from"./CopyToClipboard-DDOSZiCt.js";import{t as H}from"./ImagePreview-83gb1Wk3.js";import{n as U}from"./taskDrawerMixin-DyAUhFEq.js";import{t as W}from"./Consumption-ucYx29ld.js";import{i as G,n as K,t as q}from"./pagination-DeLGsK5x.js";import{t as J}from"./VideoPlayer-DI3PVekV.js";import{t as Y}from"./ApiCodeButton-Ds-DXrRl.js";import{t as X}from"./BotPlaceholder-KUVrB1fh.js";import{t as Z}from"./NoTasks-VnYzvYev.js";import{t as Q}from"./PromptTextarea-DpyGubYO.js";var ne=_({name:`LayoutVeo`,components:{ElDrawer:w,ElButton:F,FontAwesomeIcon:B},mixins:[U]}),re={class:`main flex flex-row flex-1`},ie={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function oe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,re,[e(`div`,ie,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,ae,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var se=L(ne,[[`render`,oe],[`__scopeId`,`data-v-12b82bc3`]]),ce=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`veo2`,label:`veo2`},{value:`veo2-fast`,label:`veo2-fast`},{value:`veo3`,label:`veo3`},{value:`veo3-fast`,label:`veo3-fast`},{value:`veo31-fast`,label:`veo31-fast`},{value:`veo31`,label:`veo31`},{value:`veo31-fast-ingredients`,label:`veo31-fast-ingredients`}]}},computed:{value:{get(){return this.$store.state.veo?.config?.model},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo.config,model:e})}}},mounted(){this.value||=O}}),le={class:`field`},ue={class:`title font-bold`};function de(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,le,[e(`h2`,ue,r(t.$t(`veo.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var fe=L(ce,[[`render`,de],[`__scopeId`,`data-v-a59d89c9`]]),pe=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`veo.button.action1`)},{value:`image2video`,label:this.$t(`veo.button.action2`)},{value:`ingredients2video`,label:this.$t(`veo.button.actionIngredients`)}]},value:{get(){return this.$store.state.veo?.config?.action},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,action:e})}}},mounted(){this.value||=E}}),me={class:`field`},he={class:`title font-bold`},ge={class:`float-left`};function _e(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,me,[e(`h2`,he,r(t.$t(`veo.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`veo.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,ge,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ve=L(pe,[[`render`,_e],[`__scopeId`,`data-v-261798ae`]]),ye=_({name:`TranslationSelector`,components:{ElSwitch:T,InfoIcon:G},computed:{value:{get(){return this.$store.state.veo?.config?.translation},set(e){console.debug(`set translation`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,translation:e})}}},mounted(){this.value===void 0&&(this.value=!1)}}),be={class:`relative`},xe={class:`flex justify-between`},Se={class:`flex justify-start items-center`},Ce={class:`text-sm font-bold`},we={class:`flex justify-end items-center`};function Te(t,n,a,s,l,u){let d=c(`info-icon`),f=c(`el-switch`);return h(),o(`div`,be,[e(`div`,xe,[e(`div`,Se,[e(`span`,Ce,r(t.$t(`veo.name.translation`)),1),i(d,{content:t.$t(`veo.description.translation`)},null,8,[`content`])]),e(`div`,we,[i(f,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`])])])])}var Ee=L(ye,[[`render`,Te]]),De=_({name:`AspectRatioSelector`,data(){return{options:[{value:`16:9`,label:`16:9`,width:25,height:13},{value:`9:16`,label:`9:16`,width:13,height:25}]}},computed:{active(){return this.options.findIndex(e=>e.value===this.value)||0},value:{get(){return this.$store.state.veo?.config?.aspect_ratio},set(e){console.debug(`set aspect_ratio`,e),this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,aspect_ratio:e})}}},mounted(){this.value||=D}}),Oe={class:`text-sm font-bold mb-2 block`},ke={class:`items`},Ae=[`onClick`],je={class:`name`};function Me(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Oe,r(n.$t(`veo.name.ratio`)),1),e(`div`,ke,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.label])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,je,r(i.label),1)],10,Ae))),128))])])}var Ne=L(De,[[`render`,Me],[`__scopeId`,`data-v-28c472c4`]]),Pe=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:F,InfoIcon:G,FontAwesomeIcon:B,ImagePreview:H},mixins:[N,k],emits:[`change`],data(){return{fileList:[],uploadUrl:P()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.veo?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){R.warning(this.$t(`veo.message.uploadReferencesExceed`))},onError(){R.error(this.$t(`veo.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`veo/setConfig`,{...this.$store.state?.veo?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Fe={class:`relative`},Ie={class:`flex justify-between`},Le={class:`flex justify-start items-center`},Re={class:`text-sm font-bold`};function ze(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Fe,[e(`div`,Ie,[e(`div`,Le,[e(`span`,Re,r(t.$t(`veo.name.startEndImage`)),1),i(g,{content:t.$t(`veo.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`veo.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var Be=L(Pe,[[`render`,ze],[`__scopeId`,`data-v-f9a79b4a`]]),Ve=_({name:`PromptInput`,components:{PromptTextarea:Q},computed:{prompt:{get(){return this.$store.state.veo?.config?.prompt},set(e){this.$store.commit(`veo/setConfig`,{...this.$store.state.veo?.config,prompt:e})}}},mounted(){this.prompt||=``}});function He(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`veo.name.prompt`),info:e.$t(`veo.description.prompt`),placeholder:e.$t(`veo.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Ue=_({name:`ConfigPanel`,components:{ElButton:F,Consumption:W,FontAwesomeIcon:B,PromptInput:L(Ve,[[`render`,He]]),ModelSelector:fe,StartEndImage:Be,ActionSelector:ve,TranslationSelector:Ee,AspectRatioSelector:Ne},emits:[`generate`],computed:{config(){return this.$store.state.veo?.config},consumption(){return ee(this.config,this.service?.cost)},service(){return this.$store.state.veo?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),We={class:`flex flex-col h-full`},Ge={class:`flex-1 overflow-y-auto p-5`},Ke={class:`flex flex-col items-center justify-center px-5 pb-5`};function qe(t,s,l,u,p,m){let g=c(`action-selector`),_=c(`translation-selector`),v=c(`aspect-ratio-selector`),y=c(`prompt-input`),b=c(`model-selector`),x=c(`start-end-image`),S=c(`consumption`),C=c(`font-awesome-icon`),w=c(`el-button`);return h(),o(`div`,We,[e(`div`,Ge,[i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),t.config?.action===`ingredients2video`?a(``,!0):(h(),d(b,{key:0,class:`mb-4`})),t.config?.action===`image2video`||t.config?.action===`ingredients2video`?(h(),d(x,{key:1,class:`mb-2`})):a(``,!0)]),e(`div`,Ke,[i(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(C,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`veo.button.generate`)),1)]),_:1},8,[`onClick`])])])}var Je=L(Ue,[[`render`,qe]]),Ye=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:V,FontAwesomeIcon:B,ElAlert:C,VideoPlayer:J,ElTooltip:x,ElButton:F,ApiCodeButton:Y},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.veo?.application},config(){return this.$store.state.veo?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),Xe={class:`preview`},Ze={class:`left`},Qe={class:`main`},$e={class:`bot`},et={class:`datetime`},tt={class:`info`},nt={key:0,class:`prompt mt-2`},rt={key:0},it={key:1},at={key:0,class:t({content:!0,failed:!0})},ot={key:0,class:`mb-4`},st={key:1,class:t({operations:!0,"mt-2":!0})},ct={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},lt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},ut={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},dt={key:1,class:t({content:!0})},ft={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},$={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},pt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},mt={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},ht={key:2,class:t({content:!0})},gt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},_t={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function vt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,Xe,[e(`div`,Ze,[i(g,{src:`https://cdn.acedata.cloud/8nxyy9.jpg`,class:`avatar`})]),e(`div`,Qe,[e(`div`,$e,[n(r(t.$t(`veo.name.veoBot`))+` `,1),e(`span`,et,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,tt,[t.modelValue?.request?.prompt?(h(),o(`p`,nt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,rt,` - (`+r(t.$t(`veo.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`running`?(h(),o(`span`,it,` - (`+r(t.$t(`veo.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,at,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ot,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,st,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`veo.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`veo.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/veo/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,ct,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,lt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,ut,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,dt,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,ft,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,$,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,pt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,mt,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,ht,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.failure`)),1)]),default:f(()=>[e(`p`,gt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,_t,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`veo.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var yt=_({name:`RecentPanel`,components:{TaskPreview:L(Ye,[[`render`,vt],[`__scopeId`,`data-v-a44f5f6b`]]),NoTasks:Z,BotPlaceholder:X,ScrollList:K},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.veo?.tasks,items:this.$store.state.veo?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),bt={key:0},xt={key:2,class:`w-full h-full flex items-center justify-center`};function St(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,bt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,xt,[i(v)])):a(``,!0)],64)}var Ct=_({name:`VeoIndex`,components:{ConfigPanel:Je,Layout:se,RecentPanel:L(yt,[[`render`,St]])},mixins:[j],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.veo?.status?.getApplications===A.Request},tasksLoading(){return this.$store.state.veo?.status?.getTasks===A.Request||this.fetchingTasks},credential(){return this.$store.state.veo.credential},config(){return this.$store.state.veo.config},tasks(){return this.$store.state.veo.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await q({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`veo/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`veo/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`veo/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!M(this.uploadTracker,e=>this.$t(e),e=>R.warning(e)))return;let e={...this.config,async:!0};if(!I())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}if(e.action===`image2video`&&!(e.image_urls&&e.image_urls.length>0)){R.warning(this.$t(`veo.message.imageRequired`));return}(!e.image_urls||e.image_urls.length===0)&&delete e.image_urls,R.info(this.$t(`veo.message.startingTask`)),z(`veo`,te.generate(e,{token:t})).then(()=>{R.success(this.$t(`veo.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?R.error(this.$t(`veo.message.usedUp`)):R.error(this.$t(`veo.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function wt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Tt=L(Ct,[[`render`,wt]]);export{Tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-DlW_4H3t.js";import{t as b}from"./upload-NEt87PZ4.js";import{t as x}from"./tooltip-BYBJPcZV.js";import{t as S}from"./image-C3e5pYdE.js";import{t as C}from"./alert-xa4qD-Fe.js";import{t as w}from"./drawer-5rJXE0y9.js";import{Br as T,Fr as E,Hr as D,Ir as O,Lr as k,Rr as A,Ur as j,zr as ee}from"./constants-qNbtmSmx.js";import{Ht as te,In as M,Kr as N,Kt as P,Ut as F,Vt as I,Wt as L,Yr as R,_i as z,en as B,j as V,oi as H,or as U}from"./index-CaaGWjWz.js";import{t as W}from"./index.es-ChYr3ccY.js";import{t as G}from"./CopyToClipboard-Dpqkkmd1.js";import{t as K}from"./ImagePreview-DWw0Go0f.js";import{n as q}from"./taskDrawerMixin-DyAUhFEq.js";import{t as J}from"./Consumption-_5s609Be.js";import{i as Y,n as X,t as Z}from"./pagination-7x9FPQoF.js";import{t as Q}from"./VideoPlayer-B31d0G5B.js";import{t as ne}from"./ApiCodeButton-B2n0Brc3.js";import{t as re}from"./BotPlaceholder-pWxgOlNM.js";import{t as ie}from"./NoTasks-DhYUH2SG.js";import{t as ae}from"./PromptTextarea-D1yTfPjT.js";var oe=_({name:`LayoutSora`,components:{ElDrawer:w,ElButton:z,FontAwesomeIcon:W},mixins:[q]}),se={class:`main flex flex-row flex-1`},ce={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ue(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,se,[e(`div`,ce,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,le,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var de=V(oe,[[`render`,ue],[`__scopeId`,`data-v-531ab990`]]),fe=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:j,label:`sora-2`},{value:D,label:`sora-2-pro`}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){let t=this.$store.state.sora?.config||{},n=E[e]||[10],r=t.duration,i=r&&n.includes(r)?r:n.includes(10)?10:n[0],a={...t,model:e,duration:i,size:t.size||`small`};this.$store.commit(`sora/setConfig`,a)}}},mounted(){this.value||=A}}),pe={class:`field`},me={class:`title font-bold`};function he(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,pe,[e(`h2`,me,r(t.$t(`sora.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ge=V(fe,[[`render`,he],[`__scopeId`,`data-v-0cb7913d`]]),_e=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`sora.button.action1`)},{value:`image2video`,label:this.$t(`sora.button.action2`)}]},value:{get(){return this.$store.state.sora?.config?.action},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,action:e})}}},mounted(){this.value||=k}}),ve={class:`field`},ye={class:`title font-bold`},be={class:`float-left`};function xe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ve,[e(`h2`,ye,r(t.$t(`sora.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,be,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Se=V(_e,[[`render`,xe],[`__scopeId`,`data-v-7b82fa7f`]]),Ce=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},computed:{model(){return this.$store.state.sora?.config?.model||`sora-2`},allowedDurations(){return E[this.model]||[10]},optionsForModel(){return this.allowedDurations.map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.sora?.config?.duration},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,duration:e})}}},watch:{allowedDurations(){let e=this.allowedDurations;if(!e.includes(this.value)){let t=e.includes(10)?10:e[0];this.value=t}}},mounted(){this.value||=10}}),we={class:`field`},Te={class:`control`},Ee={class:`title font-bold`};function De(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,we,[e(`div`,Te,[e(`h2`,Ee,r(t.$t(`sora.name.duration`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.optionsForModel,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Oe=V(Ce,[[`render`,De],[`__scopeId`,`data-v-c2934598`]]),ke=_({name:`OrientationSelector`,data(){return{options:[{value:`portrait`,labelKey:`sora.option.portrait`,width:13,height:25},{value:`landscape`,labelKey:`sora.option.landscape`,width:25,height:13}]}},computed:{active(){let e=this.options.findIndex(e=>e.value===this.value);return e>=0?e:0},value:{get(){return this.$store.state.sora?.config?.orientation},set(e){console.debug(`set orientation`,e),this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,orientation:e})}}},mounted(){this.value||=ee}}),Ae={class:`text-sm font-bold mb-2 block`},je={class:`items`},Me=[`onClick`],Ne={class:`name`};function Pe(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Ae,r(n.$t(`sora.name.orientation`)),1),e(`div`,je,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.value])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Ne,r(n.$t(i.labelKey)),1)],10,Me))),128))])])}var Fe=V(ke,[[`render`,Pe],[`__scopeId`,`data-v-a20be6d9`]]),Ie=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:z,InfoIcon:Y,FontAwesomeIcon:W,ImagePreview:K},mixins:[L,te],emits:[`change`],data(){return{fileList:[],uploadUrl:R()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.sora?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){H.warning(this.$t(`sora.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`sora.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`};function Ve(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,r(t.$t(`sora.name.startEndImage`)),1),i(g,{content:t.$t(`sora.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`sora.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var He=V(Ie,[[`render`,Ve],[`__scopeId`,`data-v-4f7d9ba5`]]),Ue=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:O.map(e=>({value:e,label:Ue(e)}))}},computed:{value:{get(){return this.$store.state.sora?.config?.size},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,size:e})}}},mounted(){this.value||=T}}),Ge={class:`field`},Ke={class:`control`},qe={class:`title font-bold`};function Je(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,r(t.$t(`sora.name.size`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Ye=V(We,[[`render`,Je],[`__scopeId`,`data-v-8c485f0f`]]),Xe=_({name:`PromptInput`,components:{PromptTextarea:ae},computed:{prompt:{get(){return this.$store.state.sora?.config?.prompt},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ze(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`sora.name.prompt`),info:e.$t(`sora.description.prompt`),placeholder:e.$t(`sora.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Qe=_({name:`ConfigPanel`,components:{ElButton:z,Consumption:J,FontAwesomeIcon:W,PromptInput:V(Xe,[[`render`,Ze]]),ModelSelector:ge,StartEndImage:He,SizeSelector:Ye,ActionSelector:Se,OrientationSelector:Fe,DurationSelector:Oe},emits:[`generate`],computed:{config(){return this.$store.state.sora?.config},consumption(){return P(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),$e={class:`flex flex-col h-full`},et={class:`flex-1 overflow-y-auto p-5`},tt={class:`flex flex-col items-center justify-center px-5 pb-5`};function nt(t,a,s,u,d,p){let m=c(`model-selector`),_=c(`action-selector`),v=c(`duration-selector`),y=c(`size-selector`),b=c(`orientation-selector`),x=c(`prompt-input`),S=c(`start-end-image`),C=c(`consumption`),w=c(`font-awesome-icon`),T=c(`el-button`);return h(),o(`div`,$e,[e(`div`,et,[i(m,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),i(b,{class:`mb-4`}),i(x,{class:`mb-4`}),l(i(S,{class:`mb-2`},null,512),[[g,t.config?.action===`image2video`]])]),e(`div`,tt,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`sora.button.generate`)),1)]),_:1},8,[`onClick`])])])}var rt=V(Qe,[[`render`,nt]]),it=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:G,FontAwesomeIcon:W,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:z,ApiCodeButton:ne},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.sora?.application},config(){return this.$store.state.sora?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),at={class:`preview`},ot={class:`left`},st={class:`main`},ct={class:`bot`},lt={class:`datetime`},ut={class:`info`},dt={key:0,class:`prompt mt-2`},ft={key:0},pt={key:1},mt={key:0,class:t({content:!0,failed:!0})},ht={key:0,class:`mb-4`},gt={key:1,class:t({operations:!0,"mt-2":!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:t({content:!0})},bt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wt={key:2,class:t({content:!0})},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Dt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,at,[e(`div`,ot,[i(g,{src:`https://cdn.acedata.cloud/z5id1u.png`,class:`avatar`})]),e(`div`,st,[e(`div`,ct,[n(r(t.$t(`sora.name.soraBot`))+` `,1),e(`span`,lt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,ut,[t.modelValue?.request?.prompt?(h(),o(`p`,dt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,ft,` - (`+r(t.$t(`sora.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`pending`?(h(),o(`span`,pt,` - (`+r(t.$t(`sora.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,mt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ht,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,gt,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`sora.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`sora.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/sora/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,_t,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,vt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,yt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,$,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,bt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,xt,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,St,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,Ct,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,wt,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,Tt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,Et,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var Ot=_({name:`RecentPanel`,components:{TaskPreview:V(it,[[`render`,Dt],[`__scopeId`,`data-v-564d52e9`]]),NoTasks:ie,BotPlaceholder:re,ScrollList:X},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),kt={key:0},At={key:2,class:`w-full h-full flex items-center justify-center`};function jt(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,kt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,At,[i(v)])):a(``,!0)],64)}var Mt=_({name:`SoraIndex`,components:{ConfigPanel:rt,Layout:de,RecentPanel:V(Ot,[[`render`,jt]])},mixins:[F],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===N.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===N.Request||this.fetchingTasks},credential(){return this.$store.state.sora.credential},config(){return this.$store.state.sora.config},tasks(){return this.$store.state.sora.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await Z({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`sora/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`sora/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`sora/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!I(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config,async:!0};if(!B())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}H.info(this.$t(`sora.message.startingTask`)),U(`sora`,M.generate(e,{token:t})).then(()=>{H.success(this.$t(`sora.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`sora.message.usedUp`)):H.error(this.$t(`sora.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Nt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Pt=V(Mt,[[`render`,Nt]]);export{Pt as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,qt as p,rt as m,tt as h,x as g,z as _}from"./vendor-chart-Dw-P17PN.js";import{r as v,t as y}from"./select-DvoqOdpJ.js";import{t as b}from"./upload-YiAKN8Py.js";import{t as x}from"./tooltip-C4ECsqjH.js";import{t as S}from"./image-D5GTCt7T.js";import{t as C}from"./alert-OQpRj2T1.js";import{t as w}from"./drawer-I7xPkGcQ.js";import{Br as T,Fr as E,Hr as D,Ir as O,Lr as k,Rr as A,Ur as j,zr as ee}from"./constants-DxuoPabX.js";import{Ht as te,In as M,Kr as N,Kt as P,Ut as F,Vt as I,Wt as L,Yr as R,_i as z,en as B,j as V,oi as H,or as U}from"./index-CVIbScOR.js";import{t as W}from"./index.es-DFowd1fY.js";import{t as G}from"./CopyToClipboard-DDOSZiCt.js";import{t as K}from"./ImagePreview-83gb1Wk3.js";import{n as q}from"./taskDrawerMixin-DyAUhFEq.js";import{t as J}from"./Consumption-ucYx29ld.js";import{i as Y,n as X,t as Z}from"./pagination-DeLGsK5x.js";import{t as Q}from"./VideoPlayer-DI3PVekV.js";import{t as ne}from"./ApiCodeButton-Ds-DXrRl.js";import{t as re}from"./BotPlaceholder-KUVrB1fh.js";import{t as ie}from"./NoTasks-VnYzvYev.js";import{t as ae}from"./PromptTextarea-DpyGubYO.js";var oe=_({name:`LayoutSora`,components:{ElDrawer:w,ElButton:z,FontAwesomeIcon:W},mixins:[q]}),se={class:`main flex flex-row flex-1`},ce={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},le={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function ue(t,n,r,a,s,d){let p=c(`font-awesome-icon`),m=c(`el-button`),_=c(`el-drawer`);return h(),o(`div`,se,[e(`div`,ce,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,le,[u(t.$slots,`result`,{},void 0,!0)]),l(i(m,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[g,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var de=V(oe,[[`render`,ue],[`__scopeId`,`data-v-531ab990`]]),fe=_({name:`ModelSelector`,components:{ElSelect:v,ElOption:y},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:j,label:`sora-2`},{value:D,label:`sora-2-pro`}]}},computed:{value:{get(){return this.$store.state.sora?.config?.model},set(e){let t=this.$store.state.sora?.config||{},n=E[e]||[10],r=t.duration,i=r&&n.includes(r)?r:n.includes(10)?10:n[0],a={...t,model:e,duration:i,size:t.size||`small`};this.$store.commit(`sora/setConfig`,a)}}},mounted(){this.value||=A}}),pe={class:`field`},me={class:`title font-bold`};function he(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,pe,[e(`h2`,me,r(t.$t(`sora.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ge=V(fe,[[`render`,he],[`__scopeId`,`data-v-0cb7913d`]]),_e=_({name:`ActionSelector`,components:{ElSelect:v,ElOption:y},data(){return{}},computed:{options(){return[{value:`text2video`,label:this.$t(`sora.button.action1`)},{value:`image2video`,label:this.$t(`sora.button.action2`)}]},value:{get(){return this.$store.state.sora?.config?.action},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,action:e})}}},mounted(){this.value||=k}}),ve={class:`field`},ye={class:`title font-bold`},be={class:`float-left`};function xe(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,ve,[e(`h2`,ye,r(t.$t(`sora.name.action`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`),clearable:``},{default:f(()=>[(h(!0),o(s,null,m(t.options,t=>(h(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,be,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Se=V(_e,[[`render`,xe],[`__scopeId`,`data-v-7b82fa7f`]]),Ce=_({name:`DurationSelector`,components:{ElSelect:v,ElOption:y},computed:{model(){return this.$store.state.sora?.config?.model||`sora-2`},allowedDurations(){return E[this.model]||[10]},optionsForModel(){return this.allowedDurations.map(e=>({value:e,label:`${e}s`}))},value:{get(){return this.$store.state.sora?.config?.duration},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,duration:e})}}},watch:{allowedDurations(){let e=this.allowedDurations;if(!e.includes(this.value)){let t=e.includes(10)?10:e[0];this.value=t}}},mounted(){this.value||=10}}),we={class:`field`},Te={class:`control`},Ee={class:`title font-bold`};function De(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,we,[e(`div`,Te,[e(`h2`,Ee,r(t.$t(`sora.name.duration`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.optionsForModel,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Oe=V(Ce,[[`render`,De],[`__scopeId`,`data-v-c2934598`]]),ke=_({name:`OrientationSelector`,data(){return{options:[{value:`portrait`,labelKey:`sora.option.portrait`,width:13,height:25},{value:`landscape`,labelKey:`sora.option.landscape`,width:25,height:13}]}},computed:{active(){let e=this.options.findIndex(e=>e.value===this.value);return e>=0?e:0},value:{get(){return this.$store.state.sora?.config?.orientation},set(e){console.debug(`set orientation`,e),this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,orientation:e})}}},mounted(){this.value||=ee}}),Ae={class:`text-sm font-bold mb-2 block`},je={class:`items`},Me=[`onClick`],Ne={class:`name`};function Pe(n,i,a,c,l,u){return h(),o(`div`,null,[e(`span`,Ae,r(n.$t(`sora.name.orientation`)),1),e(`div`,je,[(h(!0),o(s,null,m(n.options,(i,a)=>(h(),o(`div`,{key:a,class:t({active:n.active===a,item:!0}),onClick:e=>n.value=i.value},[e(`div`,{class:t([`preview`,i.value])},[e(`div`,{class:`rect`,style:p({width:i.width+`px`,height:i.height+`px`})},null,4)],2),e(`p`,Ne,r(n.$t(i.labelKey)),1)],10,Me))),128))])])}var Fe=V(ke,[[`render`,Pe],[`__scopeId`,`data-v-a20be6d9`]]),Ie=_({name:`StartEndImage`,components:{ElUpload:b,ElButton:z,InfoIcon:Y,FontAwesomeIcon:W,ImagePreview:K},mixins:[L,te],emits:[`change`],data(){return{fileList:[],uploadUrl:R()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state?.sora?.config?.image_urls},set(){}}},mounted(){this.value||=void 0,this.onSetStartEndImageUrl()},methods:{onExceed(){H.warning(this.$t(`sora.message.uploadReferencesExceed`))},onError(){H.error(this.$t(`sora.message.uploadReferencesError`))},onSetStartEndImageUrl(){let e=this.urls;this.$store.commit(`sora/setConfig`,{...this.$store.state?.sora?.config,image_urls:e})},async onSuccess(){this.onSetStartEndImageUrl()}}}),Le={class:`relative`},Re={class:`flex justify-between`},ze={class:`flex justify-start items-center`},Be={class:`text-sm font-bold`};function Ve(t,s,l,u,p,m){let g=c(`info-icon`),_=c(`image-preview`),v=c(`font-awesome-icon`),y=c(`el-button`),b=c(`el-upload`);return h(),o(`div`,Le,[e(`div`,Re,[e(`div`,ze,[e(`span`,Be,r(t.$t(`sora.name.startEndImage`)),1),i(g,{content:t.$t(`sora.description.uploadStartEndImage`)},null,8,[`content`])])]),i(b,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":s[0]||=e=>t.fileList=e,name:`file`,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,limit:2,class:`upload-wrapper`,multiple:!1,action:t.uploadUrl,"list-type":`picture`,"on-exceed":t.onExceed,"on-error":t.onError,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[e.url&&e.percentage!==void 0?(h(),d(_,{key:0,url:e.url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])):a(``,!0)]),default:f(()=>[i(y,{round:``,type:`primary`,size:`small`,class:`btn btn-upload`},{default:f(()=>[i(v,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),n(` `+r(t.$t(`sora.button.uploadReferences`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`headers`])])}var He=V(Ie,[[`render`,Ve],[`__scopeId`,`data-v-4f7d9ba5`]]),Ue=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),We=_({name:`SizeSelector`,components:{ElSelect:v,ElOption:y},data(){return{options:O.map(e=>({value:e,label:Ue(e)}))}},computed:{value:{get(){return this.$store.state.sora?.config?.size},set(e){let t=this.$store.state.sora?.config||{};this.$store.commit(`sora/setConfig`,{...t,size:e})}}},mounted(){this.value||=T}}),Ge={class:`field`},Ke={class:`control`},qe={class:`title font-bold`};function Je(t,n,a,l,u,p){let g=c(`el-option`),_=c(`el-select`);return h(),o(`div`,Ge,[e(`div`,Ke,[e(`h2`,qe,r(t.$t(`sora.name.size`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`sora.placeholder.select`)},{default:f(()=>[(h(!0),o(s,null,m(t.options,e=>(h(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])])}var Ye=V(We,[[`render`,Je],[`__scopeId`,`data-v-8c485f0f`]]),Xe=_({name:`PromptInput`,components:{PromptTextarea:ae},computed:{prompt:{get(){return this.$store.state.sora?.config?.prompt},set(e){this.$store.commit(`sora/setConfig`,{...this.$store.state.sora?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ze(e,t,n,r,i,a){let o=c(`prompt-textarea`);return h(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`sora.name.prompt`),info:e.$t(`sora.description.prompt`),placeholder:e.$t(`sora.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Qe=_({name:`ConfigPanel`,components:{ElButton:z,Consumption:J,FontAwesomeIcon:W,PromptInput:V(Xe,[[`render`,Ze]]),ModelSelector:ge,StartEndImage:He,SizeSelector:Ye,ActionSelector:Se,OrientationSelector:Fe,DurationSelector:Oe},emits:[`generate`],computed:{config(){return this.$store.state.sora?.config},consumption(){return P(this.config,this.service?.cost)},service(){return this.$store.state.sora?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),$e={class:`flex flex-col h-full`},et={class:`flex-1 overflow-y-auto p-5`},tt={class:`flex flex-col items-center justify-center px-5 pb-5`};function nt(t,a,s,u,d,p){let m=c(`model-selector`),_=c(`action-selector`),v=c(`duration-selector`),y=c(`size-selector`),b=c(`orientation-selector`),x=c(`prompt-input`),S=c(`start-end-image`),C=c(`consumption`),w=c(`font-awesome-icon`),T=c(`el-button`);return h(),o(`div`,$e,[e(`div`,et,[i(m,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),i(b,{class:`mb-4`}),i(x,{class:`mb-4`}),l(i(S,{class:`mb-2`},null,512),[[g,t.config?.action===`image2video`]])]),e(`div`,tt,[i(C,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(T,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(w,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`sora.button.generate`)),1)]),_:1},8,[`onClick`])])])}var rt=V(Qe,[[`render`,nt]]),it=_({name:`TaskPreview`,components:{ElImage:S,CopyToClipboard:G,FontAwesomeIcon:W,ElAlert:C,VideoPlayer:Q,ElTooltip:x,ElButton:z,ApiCodeButton:ne},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.sora?.application},config(){return this.$store.state.sora?.config}},methods:{onDownload(e,t){e?.stopPropagation(),console.log(`on download`),window.open(t,`_blank`)},onOpenVideo(e){window.open(e,`_blank`)}}}),at={class:`preview`},ot={class:`left`},st={class:`main`},ct={class:`bot`},lt={class:`datetime`},ut={class:`info`},dt={key:0,class:`prompt mt-2`},ft={key:0},pt={key:1},mt={key:0,class:t({content:!0,failed:!0})},ht={key:0,class:`mb-4`},gt={key:1,class:t({operations:!0,"mt-2":!0})},_t={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},vt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},yt={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},$={key:1,class:t({content:!0})},bt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},xt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},St={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Ct={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},wt={key:2,class:t({content:!0})},Tt={class:`text-[var(--el-text-color-regular)] text-xs mb-2`},Et={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-0`};function Dt(t,s,l,u,p,m){let g=c(`el-image`),_=c(`video-player`),v=c(`el-button`),y=c(`el-tooltip`),b=c(`api-code-button`),x=c(`font-awesome-icon`),S=c(`copy-to-clipboard`),C=c(`el-alert`);return h(),o(`div`,at,[e(`div`,ot,[i(g,{src:`https://cdn.acedata.cloud/z5id1u.png`,class:`avatar`})]),e(`div`,st,[e(`div`,ct,[n(r(t.$t(`sora.name.soraBot`))+` `,1),e(`span`,lt,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,ut,[t.modelValue?.request?.prompt?(h(),o(`p`,dt,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(h(),o(`span`,ft,` - (`+r(t.$t(`sora.status.pending`))+`) `,1)),Array.isArray(t.modelValue?.response?.data)&&t.modelValue?.response?.data[0]?.state===`pending`?(h(),o(`span`,pt,` - (`+r(t.$t(`sora.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0&&t.modelValue?.response?.data?(h(),o(`div`,mt,[t.modelValue?.response?.data[0]?.video_url?(h(),o(`div`,ht,[i(_,{src:t.modelValue?.response?.data[0]?.video_url},null,8,[`src`])])):a(``,!0),t.modelValue?.response.success?(h(),o(`div`,gt,[i(y,{class:`box-item`,effect:`dark`,content:t.$t(`sora.message.downloadVideo`),placement:`top-start`},{default:f(()=>[t.modelValue?.response?.data[0]?.video_url?(h(),d(v,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:s[0]||=e=>t.onDownload(e,t.modelValue?.response?.data[0]?.video_url)},{default:f(()=>[n(r(t.$t(`sora.button.download`)),1)]),_:1})):a(``,!0)]),_:1},8,[`content`]),i(b,{path:`/sora/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(C,{closable:!1,class:`mt-2 success`},{default:f(()=>[e(`p`,_t,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.model`))+`: `+r(t.modelValue?.request?.model),1)]),e(`p`,vt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,yt,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(h(),o(`div`,$,[i(C,{closable:!1,class:`failure`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,bt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),e(`p`,xt,[i(x,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(S,{content:t.modelValue?.response?.error?.message},null,8,[`content`])]),t.modelValue?.elapsed?(h(),o(`p`,St,[i(x,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),t.modelValue?.response?.trace_id?(h(),o(`p`,Ct,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===void 0?(h(),o(`div`,wt,[i(C,{closable:!1,class:`info`},{template:f(()=>[i(x,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.failure`)),1)]),default:f(()=>[e(`p`,Tt,[i(x,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(S,{content:t.modelValue?.id},null,8,[`content`])]),t.modelValue?.response?.trace_id?(h(),o(`p`,Et,[i(x,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`sora.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(S,{content:t.modelValue?.response?.trace_id},null,8,[`content`])])):a(``,!0)]),_:1})])):a(``,!0)])])}var Ot=_({name:`RecentPanel`,components:{TaskPreview:V(it,[[`render`,Dt],[`__scopeId`,`data-v-564d52e9`]]),NoTasks:ie,BotPlaceholder:re,ScrollList:X},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.sora?.tasks,items:this.$store.state.sora?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),kt={key:0},At={key:2,class:`w-full h-full flex items-center justify-center`};function jt(e,t,n,r,l,u){let p=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return h(),o(s,null,[e.tasks?.items===void 0?(h(),o(`div`,kt,[i(p)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(h(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(h(!0),o(s,null,m(e.tasks?.items,(e,t)=>(h(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(h(),o(`div`,At,[i(v)])):a(``,!0)],64)}var Mt=_({name:`SoraIndex`,components:{ConfigPanel:rt,Layout:de,RecentPanel:V(Ot,[[`render`,jt]])},mixins:[F],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.sora?.status?.getApplications===N.Request},tasksLoading(){return this.$store.state.sora?.status?.getTasks===N.Request||this.fetchingTasks},credential(){return this.$store.state.sora.credential},config(){return this.$store.state.sora.config},tasks(){return this.$store.state.sora.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await Z({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`sora/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`sora/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`sora/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!I(this.uploadTracker,e=>this.$t(e),e=>H.warning(e)))return;let e={...this.config,async:!0};if(!B())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}H.info(this.$t(`sora.message.startingTask`)),U(`sora`,M.generate(e,{token:t})).then(()=>{H.success(this.$t(`sora.message.startTaskSuccess`))}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?H.error(this.$t(`sora.message.usedUp`)):H.error(this.$t(`sora.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function Nt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return h(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var Pt=V(Mt,[[`render`,Nt]]);export{Pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as e,tt as t,z as n}from"./vendor-chart-Dw-P17PN.js";import{j as r}from"./index-
|
|
1
|
+
import{N as e,tt as t,z as n}from"./vendor-chart-Dw-P17PN.js";import{j as r}from"./index-CVIbScOR.js";var i=n({name:`SettingsIndex`,mounted(){let e=this.$route.query.tab||``;window.dispatchEvent(new CustomEvent(`open-user-settings`,{detail:{tab:e}}))}}),a={class:`settings-page`};function o(n,r,i,o,s,c){return t(),e(`div`,a)}var s=r(i,[[`render`,o]]);export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,at as s,ht as c,j as l,mt as u,ot as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{n as m,t as h}from"./row-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,at as s,ht as c,j as l,mt as u,ot as d,tt as f,z as p}from"./vendor-chart-Dw-P17PN.js";import{n as m,t as h}from"./row-CdtGuvk2.js";import{i as g,n as _,r as v,t as y}from"./container-VI0MzukK.js";import{n as b,t as x}from"./dropdown-C5Bh_We5.js";import{a as S,i as C,n as w,r as T,t as E}from"./avatar-Cw63ZCtR.js";import{$t as D,J as O,Jr as k,P as A,Qr as j,_i as M,ei as N,j as P,ni as F,nt as I,pt as L}from"./index-CVIbScOR.js";import{t as R}from"./BottomFooter-sTVs9-uF.js";var z=p({name:`TopHeader`,components:{ElCol:m,Logo:w,ElRow:h,ElDropdown:x,ElMenu:T,ElMenuItem:C,ElDropdownItem:b,ElButton:M,ElSubMenu:S},data(){return{defaultAvatar:E,products:`chat`}},computed:{site(){return this.$store.state?.site},dark(){return this.$store.getters?.dark},active(){return this.$route.matched?.[0]?.path},user(){return this.$store.getters?.user},authenticated(){return this.$store.getters?.authenticated},isDesktopChrome(){return j()},isMacChrome(){return j()&&N()}},methods:{openTab(e){if(F()){A.open({url:e}).catch(t=>{console.warn(`Browser.open failed, falling back to window.open`,t),window.open(e,`_blank`)});return}window.open(e,`_blank`)},onSelect(e){e&&this.$router.push(e)},onHome(){this.$router.push({name:L})},onLogin(){this.$store.dispatch(`login`,{redirect:this.$route.fullPath})},onDownload(){this.$router.push({name:I})},onProfile(){let e=k();this.openTab(D(`${e}/user/profile`))},onVerify(){let e=k();this.openTab(D(`${e}/user/verify`))},onConsole(){this.$router.push({name:O})},async onLogout(){this.$store.dispatch(`logout`)}}}),B={key:0,class:`mt-4 pr-10`},V={key:1,class:`float-right`},H=[`src`];function U(p,m,h,g,_,v){let y=s(`logo`),b=s(`el-col`),x=s(`el-menu-item`),S=s(`el-sub-menu`),C=s(`el-menu`),w=s(`el-button`),T=s(`language-selector`),E=s(`dark-selector`),D=s(`el-dropdown-item`),O=s(`el-dropdown-menu`),k=s(`el-dropdown`),A=s(`el-row`),j=d(`t`);return f(),l(A,{class:t([`header`,{"desktop-chrome":p.isDesktopChrome,"is-mac":p.isMacChrome}])},{default:u(()=>[i(b,{md:4,xs:24,class:`brand-col`},{default:u(()=>[i(y,{onClick:p.onHome},null,8,[`onClick`])]),_:1}),i(b,{md:16,xs:13},{default:u(()=>[i(C,{"default-active":p.active,mode:`horizontal`,class:`menu`,ellipsis:!0,onSelect:p.onSelect},{default:u(()=>[i(S,{index:p.products},{title:u(()=>[n(r(p.$t(`common.nav.products`)),1)]),default:u(()=>[p.site?.features?.chatgpt?.enabled?c((f(),l(x,{key:0,index:`/chat`},null,512)),[[j,`index.title.chat`]]):a(``,!0),p.site?.features?.midjourney?.enabled?c((f(),l(x,{key:1,index:`/midjourney`},null,512)),[[j,`index.title.midjourney`]]):a(``,!0),p.site?.features?.qrart?.enabled?c((f(),l(x,{key:2,index:`/qrart`},null,512)),[[j,`index.title.qrart`]]):a(``,!0),p.site?.features?.suno?.enabled?c((f(),l(x,{key:3,index:`/suno`},null,512)),[[j,`index.title.suno`]]):a(``,!0),p.site?.features?.luma?.enabled?c((f(),l(x,{key:4,index:`/luma`},null,512)),[[j,`index.title.luma`]]):a(``,!0),p.site?.features?.headshots?.enabled?c((f(),l(x,{key:5,index:`/headshots`},null,512)),[[j,`index.title.headshots`]]):a(``,!0)]),_:1},8,[`index`]),c(i(x,{onRoute:e=>void 0,onClick:p.onDownload},null,8,[`onClick`]),[[j,`common.nav.mobileApp`]]),c(i(x,{onRoute:e=>void 0,onClick:m[0]||=e=>p.openTab(`https://platform.acedata.cloud`)},null,512),[[j,`common.nav.apiPlatform`]]),c(i(x,{onRoute:e=>void 0,onClick:m[1]||=e=>p.openTab(`https://platform.acedata.cloud/support`)},null,512),[[j,`common.nav.support`]]),c(i(x,{onRoute:e=>void 0,onClick:m[2]||=e=>p.openTab(`https://platform.acedata.cloud/earning`)},null,512),[[j,`common.nav.referral`]])]),_:1},8,[`default-active`,`onSelect`])]),_:1}),i(b,{md:4,xs:11},{default:u(()=>[p.authenticated?(f(),o(`div`,V,[e(`div`,{class:`console`,onClick:m[3]||=(...e)=>p.onConsole&&p.onConsole(...e)},r(p.$t(`common.button.console`)),1),i(k,{trigger:`click`},{dropdown:u(()=>[i(O,null,{default:u(()=>[i(D,{onClick:p.onProfile},{default:u(()=>[n(r(p.$t(`common.button.profile`)),1)]),_:1},8,[`onClick`]),i(D,{onClick:p.onLogout},{default:u(()=>[n(r(p.$t(`common.button.logout`)),1)]),_:1},8,[`onClick`])]),_:1})]),default:u(()=>[e(`img`,{src:p.user?.avatar||p.defaultAvatar,class:`avatar`},null,8,H)]),_:1})])):(f(),o(`div`,B,[i(w,{type:`primary`,class:`float-right`,size:`small`,round:``,onClick:p.onLogin},{default:u(()=>[n(r(p.$t(`common.button.login`)),1)]),_:1},8,[`onClick`]),i(T,{class:`locale float-right mr-4`}),i(E,{class:`float-right mr-4`})]))]),_:1})]),_:1},8,[`class`])}var W=p({name:`LayoutIndex`,components:{TopHeader:P(z,[[`render`,U]]),BottomFooter:R,ElContainer:y,ElMain:g,ElFooter:_,ElHeader:v}});function G(e,t,n,r,a,o){let c=s(`top-header`),d=s(`el-header`),p=s(`router-view`),m=s(`el-main`),h=s(`bottom-footer`),g=s(`el-footer`),_=s(`el-container`);return f(),l(_,{class:`wrapper min-h-[100vh]`},{default:u(()=>[i(d,{class:`header p-0 h-auto`},{default:u(()=>[i(c)]),_:1}),i(m,{class:`main`},{default:u(()=>[i(p)]),_:1}),i(g,{class:`footer p-0 h-auto`},{default:u(()=>[i(h)]),_:1})]),_:1})}var K=P(W,[[`render`,G]]);export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,rt as p,tt as m,x as h,z as g}from"./vendor-chart-Dw-P17PN.js";import{r as _,t as v}from"./select-DlW_4H3t.js";import{t as y}from"./upload-NEt87PZ4.js";import{t as b}from"./tooltip-BYBJPcZV.js";import{t as x}from"./image-C3e5pYdE.js";import{t as S}from"./alert-xa4qD-Fe.js";import{n as C,r as w}from"./radio-Bj0tEwH8.js";import{t as T}from"./drawer-5rJXE0y9.js";import{t as E}from"./switch-CVKpq9gb.js";import{ni as D}from"./constants-qNbtmSmx.js";import{Ht as O,Kr as k,Kt as A,Ut as j,Vt as ee,Wt as te,Yr as M,_i as N,en as P,j as F,oi as I,or as L,tr as R,zn as z}from"./index-CaaGWjWz.js";import{t as B}from"./index.es-ChYr3ccY.js";import{t as V}from"./CopyToClipboard-Dpqkkmd1.js";import{t as H}from"./ImagePreview-DWw0Go0f.js";import{n as U}from"./taskDrawerMixin-DyAUhFEq.js";import{t as W}from"./Consumption-_5s609Be.js";import{i as G,n as K,t as q}from"./pagination-7x9FPQoF.js";import{t as J}from"./vue-plyr-wiIKa-zl.js";import{t as Y}from"./ApiCodeButton-B2n0Brc3.js";import{t as X}from"./BotPlaceholder-pWxgOlNM.js";import{t as Z}from"./NoTasks-DhYUH2SG.js";import{t as Q}from"./PromptTextarea-D1yTfPjT.js";var ne=g({name:`LayoutPika`,components:{ElDrawer:T,ElButton:N,FontAwesomeIcon:B},mixins:[U]}),re={class:`main flex flex-row flex-1`},ie={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function oe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),g=c(`el-button`),_=c(`el-drawer`);return m(),o(`div`,re,[e(`div`,ie,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,ae,[u(t.$slots,`result`,{},void 0,!0)]),l(i(g,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[h,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var se=F(ne,[[`render`,oe],[`__scopeId`,`data-v-cbfdbeb3`]]),ce=g({name:`IngredientsSelector`,components:{ElSwitch:E,InfoIcon:G},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug(`set ingredients`,e),e||this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,model:`2.0`})}}},mounted(){this.value===void 0&&(this.value=!1)}}),le={class:`field`},ue={class:`title font-bold`};function de(t,n,a,s,l,u){let d=c(`el-switch`),f=c(`info-icon`);return m(),o(`div`,le,[e(`h2`,ue,r(t.$t(`pika.name.ingredients`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`]),i(f,{content:t.$t(`pika.description.ingredients`),class:`info`},null,8,[`content`])])}var fe=F(ce,[[`render`,de],[`__scopeId`,`data-v-17c0af5c`]]),pe=g({name:`EffectSelector`,components:{ElSelect:_,ElOption:v},data(){return{}},computed:{options(){return[{value:`Levitate`,label:this.$t(`pika.style.effect1`)},{value:`Decapitate`,label:this.$t(`pika.style.effect2`)},{value:`Eye-pop`,label:this.$t(`pika.style.effect3`)},{value:`Ta-da`,label:this.$t(`pika.style.effect4`)},{value:`Deflate`,label:this.$t(`pika.style.effect5`)},{value:`Crumble`,label:this.$t(`pika.style.effect6`)},{value:`Dissolve`,label:this.$t(`pika.style.effect7`)},{value:`Squish`,label:this.$t(`pika.style.effect8`)},{value:`Inflate`,label:this.$t(`pika.style.effect9`)},{value:`Melt`,label:this.$t(`pika.style.effect10`)},{value:`Cake-ify`,label:this.$t(`pika.style.effect11`)},{value:`Crush`,label:this.$t(`pika.style.effect12`)},{value:`Explode`,label:this.$t(`pika.style.effect13`)}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,effect:e})}}}}),me={class:`field`},he={class:`title font-bold`},ge={class:`float-left`};function _e(t,n,a,l,u,h){let g=c(`el-option`),_=c(`el-select`);return m(),o(`div`,me,[e(`h2`,he,r(t.$t(`pika.name.effect`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`),clearable:``},{default:f(()=>[(m(!0),o(s,null,p(t.options,t=>(m(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,ge,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ve=F(pe,[[`render`,_e],[`__scopeId`,`data-v-d1c54475`]]),ye=g({name:`IngredientsModelSelector`,components:{ElRadioButton:C,ElRadioGroup:w},data(){return{options:[{label:this.$t(`pika.button.precise`),value:`precise`},{label:this.$t(`pika.button.creative`),value:`creative`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||=D}}),be={class:`field`},xe={class:`title font-bold`};function Se(t,a,l,u,h,g){let _=c(`el-radio-button`),v=c(`el-radio-group`);return m(),o(`div`,be,[e(`h2`,xe,r(t.$t(`pika.name.ingredientsModel`)),1),i(v,{modelValue:t.value,"onUpdate:modelValue":a[0]||=e=>t.value=e,class:`quality`},{default:f(()=>[(m(!0),o(s,null,p(t.options,e=>(m(),d(_,{key:e.value,label:e.value},{default:f(()=>[n(r(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var Ce=F(ye,[[`render`,Se],[`__scopeId`,`data-v-b72865fa`]]),we=g({name:`ModelSelector`,components:{ElSelect:_,ElOption:v},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`2.0`,label:`2.0`},{value:`1.5`,label:`1.5`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||=`2.0`}}),Te={class:`field`},Ee={class:`title font-bold`};function De(t,n,a,l,u,h){let g=c(`el-option`),_=c(`el-select`);return m(),o(`div`,Te,[e(`h2`,Ee,r(t.$t(`pika.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`)},{default:f(()=>[(m(!0),o(s,null,p(t.options,e=>(m(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Oe=F(we,[[`render`,De],[`__scopeId`,`data-v-7b2e870a`]]),ke=g({name:`ImageUrlInput`,components:{ElUpload:y,ElButton:N,InfoIcon:G,ImagePreview:H,FontAwesomeIcon:B},mixins:[te,O],data(){return{fileList:[],uploadUrl:M()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){let e=this.urls?.[0];this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){I.warning(this.$t(`pika.message.uploadStartImageExceed`))},onError(){I.error(this.$t(`pika.message.uploadStartImageError`))},async onRemove(){I.error(this.$t(`pika.message.uploadStartImageError`))},onSetStartImageUrl(){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Ae={class:`field`},je={class:`title font-bold`},Me={class:`upload-wrapper`};function Ne(t,a,s,l,u,d){let p=c(`image-preview`),h=c(`font-awesome-icon`),g=c(`el-button`),_=c(`el-upload`),v=c(`info-icon`);return m(),o(`div`,Ae,[e(`h2`,je,r(t.$t(`pika.name.imageUrl`)),1),e(`div`,Me,[i(_,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":a[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value upload-wrapper`,limit:3,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[i(p,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:f(()=>[i(g,{size:`small`,type:`primary`,round:``},{default:f(()=>[i(h,{icon:`fa-solid fa-upload`,class:`mr-1`}),n(` `+r(t.$t(`pika.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])]),i(v,{content:t.$t(`pika.description.imageUrl`),class:`info`},null,8,[`content`])])}var Pe=F(ke,[[`render`,Ne],[`__scopeId`,`data-v-25cefe78`]]),Fe=g({name:`PromptInput`,components:{PromptTextarea:Q},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ie(e,t,n,r,i,a){let o=c(`prompt-textarea`);return m(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pika.name.prompt`),info:e.$t(`pika.description.prompt`),placeholder:e.$t(`pika.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Le=g({name:`PresetPanel`,components:{ImageUrlInput:Pe,ElButton:N,FontAwesomeIcon:B,Consumption:W,PromptInput:F(Fe,[[`render`,Ie]]),IngredientsSelector:fe,IngredientsModelSelector:Ce,ModelSelector:Oe,EffectSelector:ve},emits:[`generate`],computed:{config(){return this.$store.state.pika?.config},consumption(){return A(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Re={class:`flex flex-col h-full`},ze={class:`flex-1 overflow-y-auto p-5`},Be={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ve(t,s,l,u,p,h){let g=c(`prompt-input`),_=c(`model-selector`),v=c(`ingredients-selector`),y=c(`effect-selector`),b=c(`image-url-input`),x=c(`ingredients-model-selector`),S=c(`consumption`),C=c(`font-awesome-icon`),w=c(`el-button`);return m(),o(`div`,Re,[e(`div`,ze,[i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),t.config?.ingredients?(m(),d(b,{key:0,class:`mb-4`})):a(``,!0),t.config?.ingredients?(m(),d(x,{key:1,class:`mb-4`})):a(``,!0)]),e(`div`,Be,[i(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(C,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`pika.button.generate`)),1)]),_:1},8,[`onClick`])])])}var He=F(Le,[[`render`,Ve]]),Ue=g({name:`VideoPlayer`,components:{VuePlyr:J},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:1080,options:[1080]}}}}}),We=[`data-poster`],Ge=[`src`];function Ke(t,n,r,a,s,l){let u=c(`vue-plyr`);return m(),o(`div`,null,[i(u,{options:t.options,class:`video`},{default:f(()=>[e(`video`,{controls:``,playsinline:``,preload:`metadata`,"data-poster":t.modelValue?.image_url},[e(`source`,{size:`1080`,src:t.modelValue?.video_url,type:`video/mp4`},null,8,Ge)],8,We)]),_:1},8,[`options`])])}var qe=g({name:`TaskPreview`,components:{ElImage:x,CopyToClipboard:V,FontAwesomeIcon:B,ElAlert:S,VideoPlayer:F(Ue,[[`render`,Ke],[`__scopeId`,`data-v-897d9fe0`]]),ElTooltip:b,ElButton:N,ApiCodeButton:Y},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e}},methods:{onDownload(e){console.log(`on download`),window.open(e,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),Je={class:`left`},Ye={class:`main`},Xe={class:`bot`},Ze={class:`datetime`},Qe={class:`info`},$e={key:0,class:`prompt mt-2`},et={key:0},tt={key:1},nt={key:0,class:t({content:!0,failed:!0})},rt={class:`image-wrapper`},it={key:0,class:t({operations:!0,"mt-2":!0})},at={key:0,class:`description`},ot={class:`description`},st={key:1,class:`description`},ct={key:1,class:t({content:!0})},lt={class:`description`},ut={class:`description`},dt={key:0,class:`description`},ft={class:`description`},$={key:2,class:t({content:!0})},pt={class:`description`};function mt(t,l,u,h,g,_){let v=c(`el-image`),y=c(`VideoPlayer`),b=c(`el-button`),x=c(`el-tooltip`),S=c(`api-code-button`),C=c(`font-awesome-icon`),w=c(`copy-to-clipboard`),T=c(`el-alert`);return m(!0),o(s,null,p(t.videos,(s,c)=>(m(),o(`div`,{key:c,class:`preview`},[e(`div`,Je,[i(v,{src:`https://cdn.acedata.cloud/i80tgn.png`,class:`avatar`})]),e(`div`,Ye,[e(`div`,Xe,[n(r(t.$t(`pika.name.pikaBot`))+` `,1),e(`span`,Ze,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Qe,[t.modelValue?.request?.prompt?(m(),o(`p`,$e,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(m(),o(`span`,et,` - (`+r(t.$t(`pika.status.pending`))+`) `,1)),s?.state===`processing`||s?.state===`pending`?(m(),o(`span`,tt,` - (`+r(t.$t(`pika.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0?(m(),o(`div`,nt,[e(`div`,rt,[i(y,{"model-value":s},null,8,[`model-value`])]),s?(m(),o(`div`,it,[i(x,{class:`box-item`,effect:`dark`,content:t.$t(`pika.message.downloadVideo`),placement:`top-start`},{default:f(()=>[s?.video_url?(m(),d(b,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:e=>t.onDownload(s?.video_url)},{default:f(()=>[n(r(t.$t(`pika.button.download`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:2},1032,[`content`]),i(S,{path:`/pika/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(T,{closable:!1,class:`mt-2 success`},{default:f(()=>[t.modelValue?.request?.model?(m(),o(`p`,at,[i(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.model`))+`: `+r(t.modelValue?.request?.model),1)])):a(``,!0),e(`p`,ot,[i(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(w,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,st,[i(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(m(),o(`div`,ct,[i(T,{closable:!1,class:`failure`},{template:f(()=>[i(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.failure`)),1)]),default:f(()=>[e(`p`,lt,[i(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(w,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,ut,[i(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(w,{content:t.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,dt,[i(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),e(`p`,ft,[i(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(w,{content:t.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0),!t.modelValue?.response||s?.state===`processing`||s?.state===`pending`?(m(),o(`div`,$,[i(T,{closable:!1,class:`info`},{template:f(()=>[i(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.failure`)),1)]),default:f(()=>[e(`p`,pt,[i(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(w,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0)])]))),128)}var ht=g({name:`RecentPanel`,components:{TaskPreview:F(qe,[[`render`,mt],[`__scopeId`,`data-v-52856c99`]]),BotPlaceholder:X,NoTasks:Z,ScrollList:K},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),gt={key:0},_t={key:2,class:`w-full h-full flex items-center justify-center`};function vt(e,t,n,r,l,u){let h=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return m(),o(s,null,[e.tasks?.items===void 0?(m(),o(`div`,gt,[i(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(m(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(m(!0),o(s,null,p(e.tasks?.items,(e,t)=>(m(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(m(),o(`div`,_t,[i(v)])):a(``,!0)],64)}var yt=g({name:`PikaIndex`,components:{ConfigPanel:He,Layout:se,RecentPanel:F(ht,[[`render`,vt]])},mixins:[j],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===k.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===k.Request||this.fetchingTasks},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===k.Request},needApply(){return this.$store.state.pika.status.getApplications===k.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await q({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`pika/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pika/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){R.create({application:this.application}).then(({data:e})=>{this.application=e,I.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&I.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pika/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ee(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let e={...this.config,async:!0};if(!P())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}I.info(this.$t(`pika.message.startingTask`)),L(`pika`,z.generate(e,{token:t})).then(()=>{I.success(this.$t(`pika.message.startTaskSuccess`)),this.$store.commit(`pika/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?I.error(this.$t(`pika.message.usedUp`)):I.error(this.$t(`pika.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function bt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return m(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var xt=F(yt,[[`render`,bt],[`__scopeId`,`data-v-fee6c9ea`]]);export{xt as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{A as e,Gt as t,I as n,Jt as r,L as i,M as a,N as o,T as s,at as c,ht as l,it as u,j as d,mt as f,rt as p,tt as m,x as h,z as g}from"./vendor-chart-Dw-P17PN.js";import{r as _,t as v}from"./select-DvoqOdpJ.js";import{t as y}from"./upload-YiAKN8Py.js";import{t as b}from"./tooltip-C4ECsqjH.js";import{t as x}from"./image-D5GTCt7T.js";import{t as S}from"./alert-OQpRj2T1.js";import{n as C,r as w}from"./radio-Bj0tEwH8.js";import{t as T}from"./drawer-I7xPkGcQ.js";import{t as E}from"./switch-B9HKxKEO.js";import{ni as D}from"./constants-DxuoPabX.js";import{Ht as O,Kr as k,Kt as A,Ut as j,Vt as ee,Wt as te,Yr as M,_i as N,en as P,j as F,oi as I,or as L,tr as R,zn as z}from"./index-CVIbScOR.js";import{t as B}from"./index.es-DFowd1fY.js";import{t as V}from"./CopyToClipboard-DDOSZiCt.js";import{t as H}from"./ImagePreview-83gb1Wk3.js";import{n as U}from"./taskDrawerMixin-DyAUhFEq.js";import{t as W}from"./Consumption-ucYx29ld.js";import{i as G,n as K,t as q}from"./pagination-DeLGsK5x.js";import{t as J}from"./vue-plyr-wiIKa-zl.js";import{t as Y}from"./ApiCodeButton-Ds-DXrRl.js";import{t as X}from"./BotPlaceholder-KUVrB1fh.js";import{t as Z}from"./NoTasks-VnYzvYev.js";import{t as Q}from"./PromptTextarea-DpyGubYO.js";var ne=g({name:`LayoutPika`,components:{ElDrawer:T,ElButton:N,FontAwesomeIcon:B},mixins:[U]}),re={class:`main flex flex-row flex-1`},ie={class:`config w-[320px] flex-none h-full overflow-y-auto bg-[var(--app-sidebar-bg)] border-r border-[var(--app-border-subtle)]`},ae={class:`result h-full p-6 flex-1 flex flex-col min-w-0 overflow-x-hidden bg-[var(--app-content-bg)]`};function oe(t,n,r,a,s,d){let p=c(`font-awesome-icon`),g=c(`el-button`),_=c(`el-drawer`);return m(),o(`div`,re,[e(`div`,ie,[u(t.$slots,`config`,{},void 0,!0)]),e(`div`,ae,[u(t.$slots,`result`,{},void 0,!0)]),l(i(g,{circle:``,class:`menu`,onClick:n[0]||=e=>t.drawer=!0},{default:f(()=>[i(p,{icon:`fa-solid fa-magic`})]),_:1},512),[[h,!t.tasksEmpty]]),i(_,{modelValue:t.drawer,"onUpdate:modelValue":n[1]||=e=>t.drawer=e,direction:`ltr`,"with-header":!1,size:`350px`},{default:f(()=>[u(t.$slots,`config`,{},void 0,!0)]),_:3},8,[`modelValue`])])}var se=F(ne,[[`render`,oe],[`__scopeId`,`data-v-cbfdbeb3`]]),ce=g({name:`IngredientsSelector`,components:{ElSwitch:E,InfoIcon:G},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients},set(e){console.debug(`set ingredients`,e),e||this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,ingredients_mode:void 0,image_url:void 0}),this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients:e,model:`2.0`})}}},mounted(){this.value===void 0&&(this.value=!1)}}),le={class:`field`},ue={class:`title font-bold`};function de(t,n,a,s,l,u){let d=c(`el-switch`),f=c(`info-icon`);return m(),o(`div`,le,[e(`h2`,ue,r(t.$t(`pika.name.ingredients`)),1),i(d,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`},null,8,[`modelValue`]),i(f,{content:t.$t(`pika.description.ingredients`),class:`info`},null,8,[`content`])])}var fe=F(ce,[[`render`,de],[`__scopeId`,`data-v-17c0af5c`]]),pe=g({name:`EffectSelector`,components:{ElSelect:_,ElOption:v},data(){return{}},computed:{options(){return[{value:`Levitate`,label:this.$t(`pika.style.effect1`)},{value:`Decapitate`,label:this.$t(`pika.style.effect2`)},{value:`Eye-pop`,label:this.$t(`pika.style.effect3`)},{value:`Ta-da`,label:this.$t(`pika.style.effect4`)},{value:`Deflate`,label:this.$t(`pika.style.effect5`)},{value:`Crumble`,label:this.$t(`pika.style.effect6`)},{value:`Dissolve`,label:this.$t(`pika.style.effect7`)},{value:`Squish`,label:this.$t(`pika.style.effect8`)},{value:`Inflate`,label:this.$t(`pika.style.effect9`)},{value:`Melt`,label:this.$t(`pika.style.effect10`)},{value:`Cake-ify`,label:this.$t(`pika.style.effect11`)},{value:`Crush`,label:this.$t(`pika.style.effect12`)},{value:`Explode`,label:this.$t(`pika.style.effect13`)}]},value:{get(){return this.$store.state.pika?.config?.effect},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,effect:e})}}}}),me={class:`field`},he={class:`title font-bold`},ge={class:`float-left`};function _e(t,n,a,l,u,h){let g=c(`el-option`),_=c(`el-select`);return m(),o(`div`,me,[e(`h2`,he,r(t.$t(`pika.name.effect`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`),clearable:``},{default:f(()=>[(m(!0),o(s,null,p(t.options,t=>(m(),d(g,{key:t.value,label:t.label,value:t.value},{default:f(()=>[e(`span`,ge,r(t.label),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var ve=F(pe,[[`render`,_e],[`__scopeId`,`data-v-d1c54475`]]),ye=g({name:`IngredientsModelSelector`,components:{ElRadioButton:C,ElRadioGroup:w},data(){return{options:[{label:this.$t(`pika.button.precise`),value:`precise`},{label:this.$t(`pika.button.creative`),value:`creative`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.ingredients_mode},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,ingredients_mode:e})}}},mounted(){this.value||=D}}),be={class:`field`},xe={class:`title font-bold`};function Se(t,a,l,u,h,g){let _=c(`el-radio-button`),v=c(`el-radio-group`);return m(),o(`div`,be,[e(`h2`,xe,r(t.$t(`pika.name.ingredientsModel`)),1),i(v,{modelValue:t.value,"onUpdate:modelValue":a[0]||=e=>t.value=e,class:`quality`},{default:f(()=>[(m(!0),o(s,null,p(t.options,e=>(m(),d(_,{key:e.value,label:e.value},{default:f(()=>[n(r(e.label),1)]),_:2},1032,[`label`]))),128))]),_:1},8,[`modelValue`])])}var Ce=F(ye,[[`render`,Se],[`__scopeId`,`data-v-b72865fa`]]),we=g({name:`ModelSelector`,components:{ElSelect:_,ElOption:v},props:{modelValue:{type:String,default:void 0}},emits:[`update:modelValue`],data(){return{options:[{value:`2.0`,label:`2.0`},{value:`1.5`,label:`1.5`}]}},computed:{value:{get(){return this.$store.state.pika?.config?.model},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika.config,model:e})}}},mounted(){this.value||=`2.0`}}),Te={class:`field`},Ee={class:`title font-bold`};function De(t,n,a,l,u,h){let g=c(`el-option`),_=c(`el-select`);return m(),o(`div`,Te,[e(`h2`,Ee,r(t.$t(`pika.name.model`)),1),i(_,{modelValue:t.value,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:`value`,placeholder:t.$t(`pika.placeholder.select`)},{default:f(()=>[(m(!0),o(s,null,p(t.options,e=>(m(),d(g,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])])}var Oe=F(we,[[`render`,De],[`__scopeId`,`data-v-7b2e870a`]]),ke=g({name:`ImageUrlInput`,components:{ElUpload:y,ElButton:N,InfoIcon:G,ImagePreview:H,FontAwesomeIcon:B},mixins:[te,O],data(){return{fileList:[],uploadUrl:M()+`/api/v1/files/`}},computed:{headers(){return{Authorization:`Bearer ${this.$store.state.token.access}`}},urls(){return this.fileList.map(e=>e?.response?.file_url)},value:{get(){return this.$store.state.pika?.config?.image_url},set(){let e=this.urls?.[0];this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:e})}}},mounted(){this.value||=void 0,this.onSetStartImageUrl()},methods:{onExceed(){I.warning(this.$t(`pika.message.uploadStartImageExceed`))},onError(){I.error(this.$t(`pika.message.uploadStartImageError`))},async onRemove(){I.error(this.$t(`pika.message.uploadStartImageError`))},onSetStartImageUrl(){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,image_url:this.urls})},async onSuccess(){this.onSetStartImageUrl()}}}),Ae={class:`field`},je={class:`title font-bold`},Me={class:`upload-wrapper`};function Ne(t,a,s,l,u,d){let p=c(`image-preview`),h=c(`font-awesome-icon`),g=c(`el-button`),_=c(`el-upload`),v=c(`info-icon`);return m(),o(`div`,Ae,[e(`h2`,je,r(t.$t(`pika.name.imageUrl`)),1),e(`div`,Me,[i(_,{ref:`uploader`,"file-list":t.fileList,"onUpdate:fileList":a[0]||=e=>t.fileList=e,accept:`.png,.jpg,.jpeg,.gif,.bmp,.webp`,name:`file`,class:`value upload-wrapper`,limit:3,multiple:!0,"list-type":`picture`,action:t.uploadUrl,"on-exceed":t.onExceed,"on-error":t.onError,"on-remove":t.onRemove,"on-success":t.onSuccess,headers:t.headers},{file:f(({file:e})=>[i(p,{url:e.url||e.response?.file_url,name:e.name,percentage:e.percentage,onRemove:n=>t.fileList.splice(t.fileList.indexOf(e),1)},null,8,[`url`,`name`,`percentage`,`onRemove`])]),default:f(()=>[i(g,{size:`small`,type:`primary`,round:``},{default:f(()=>[i(h,{icon:`fa-solid fa-upload`,class:`mr-1`}),n(` `+r(t.$t(`pika.button.uploadImageUrl`)),1)]),_:1})]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-remove`,`on-success`,`headers`])]),i(v,{content:t.$t(`pika.description.imageUrl`),class:`info`},null,8,[`content`])])}var Pe=F(ke,[[`render`,Ne],[`__scopeId`,`data-v-25cefe78`]]),Fe=g({name:`PromptInput`,components:{PromptTextarea:Q},computed:{prompt:{get(){return this.$store.state.pika?.config?.prompt},set(e){this.$store.commit(`pika/setConfig`,{...this.$store.state.pika?.config,prompt:e})}}},mounted(){this.prompt||=``}});function Ie(e,t,n,r,i,a){let o=c(`prompt-textarea`);return m(),d(o,{modelValue:e.prompt,"onUpdate:modelValue":t[0]||=t=>e.prompt=t,title:e.$t(`pika.name.prompt`),info:e.$t(`pika.description.prompt`),placeholder:e.$t(`pika.placeholder.prompt`)},null,8,[`modelValue`,`title`,`info`,`placeholder`])}var Le=g({name:`PresetPanel`,components:{ImageUrlInput:Pe,ElButton:N,FontAwesomeIcon:B,Consumption:W,PromptInput:F(Fe,[[`render`,Ie]]),IngredientsSelector:fe,IngredientsModelSelector:Ce,ModelSelector:Oe,EffectSelector:ve},emits:[`generate`],computed:{config(){return this.$store.state.pika?.config},consumption(){return A(this.config,this.service?.cost)},service(){return this.$store.state.pika?.service}},methods:{onGenerate(){this.$emit(`generate`)}}}),Re={class:`flex flex-col h-full`},ze={class:`flex-1 overflow-y-auto p-5`},Be={class:`flex flex-col items-center justify-center px-5 pb-5`};function Ve(t,s,l,u,p,h){let g=c(`prompt-input`),_=c(`model-selector`),v=c(`ingredients-selector`),y=c(`effect-selector`),b=c(`image-url-input`),x=c(`ingredients-model-selector`),S=c(`consumption`),C=c(`font-awesome-icon`),w=c(`el-button`);return m(),o(`div`,Re,[e(`div`,ze,[i(g,{class:`mb-4`}),i(_,{class:`mb-4`}),i(v,{class:`mb-4`}),i(y,{class:`mb-4`}),t.config?.ingredients?(m(),d(b,{key:0,class:`mb-4`})):a(``,!0),t.config?.ingredients?(m(),d(x,{key:1,class:`mb-4`})):a(``,!0)]),e(`div`,Be,[i(S,{value:t.consumption,service:t.service},null,8,[`value`,`service`]),i(w,{type:`primary`,class:`btn w-full`,round:``,onClick:t.onGenerate},{default:f(()=>[i(C,{icon:`fa-solid fa-magic`,class:`mr-2`}),n(` `+r(t.$t(`pika.button.generate`)),1)]),_:1},8,[`onClick`])])])}var He=F(Le,[[`render`,Ve]]),Ue=g({name:`VideoPlayer`,components:{VuePlyr:J},props:{modelValue:{type:Object,required:!0}},data(){return{options:{quality:{default:1080,options:[1080]}}}}}),We=[`data-poster`],Ge=[`src`];function Ke(t,n,r,a,s,l){let u=c(`vue-plyr`);return m(),o(`div`,null,[i(u,{options:t.options,class:`video`},{default:f(()=>[e(`video`,{controls:``,playsinline:``,preload:`metadata`,"data-poster":t.modelValue?.image_url},[e(`source`,{size:`1080`,src:t.modelValue?.video_url,type:`video/mp4`},null,8,Ge)],8,We)]),_:1},8,[`options`])])}var qe=g({name:`TaskPreview`,components:{ElImage:x,CopyToClipboard:V,FontAwesomeIcon:B,ElAlert:S,VideoPlayer:F(Ue,[[`render`,Ke],[`__scopeId`,`data-v-897d9fe0`]]),ElTooltip:b,ElButton:N,ApiCodeButton:Y},props:{modelValue:{type:Object,required:!0}},data(){return{}},computed:{application(){return this.$store.state.pika?.application},config(){return this.$store.state.pika?.config},videos(){let e=[],t=this.modelValue?.request?.action;return Array.isArray(this.modelValue?.response?.data)&&this.modelValue?.response?.data?.forEach(n=>{let r=n;t&&(r.action=t),e.push(r)}),e}},methods:{onDownload(e){console.log(`on download`),window.open(e,`_blank`)},onReload(e){let t=e.target,n=new URL(t.src),r=n.searchParams.get(`retry`);if(!r)n.searchParams.set(`retry`,`1`);else if(parseInt(r)<2)n.searchParams.set(`retry`,(parseInt(r)+1).toString());else return;t.src=n.toString()},onOpenVideo(e){window.open(e,`_blank`)}}}),Je={class:`left`},Ye={class:`main`},Xe={class:`bot`},Ze={class:`datetime`},Qe={class:`info`},$e={key:0,class:`prompt mt-2`},et={key:0},tt={key:1},nt={key:0,class:t({content:!0,failed:!0})},rt={class:`image-wrapper`},it={key:0,class:t({operations:!0,"mt-2":!0})},at={key:0,class:`description`},ot={class:`description`},st={key:1,class:`description`},ct={key:1,class:t({content:!0})},lt={class:`description`},ut={class:`description`},dt={key:0,class:`description`},ft={class:`description`},$={key:2,class:t({content:!0})},pt={class:`description`};function mt(t,l,u,h,g,_){let v=c(`el-image`),y=c(`VideoPlayer`),b=c(`el-button`),x=c(`el-tooltip`),S=c(`api-code-button`),C=c(`font-awesome-icon`),w=c(`copy-to-clipboard`),T=c(`el-alert`);return m(!0),o(s,null,p(t.videos,(s,c)=>(m(),o(`div`,{key:c,class:`preview`},[e(`div`,Je,[i(v,{src:`https://cdn.acedata.cloud/i80tgn.png`,class:`avatar`})]),e(`div`,Ye,[e(`div`,Xe,[n(r(t.$t(`pika.name.pikaBot`))+` `,1),e(`span`,Ze,r(t.$dayjs.format(``+new Date(parseFloat((t.modelValue?.created_at||``).toString())*1e3))),1)]),e(`div`,Qe,[t.modelValue?.request?.prompt?(m(),o(`p`,$e,[n(r(t.modelValue?.request?.prompt)+` `,1),t.modelValue?.response?a(``,!0):(m(),o(`span`,et,` - (`+r(t.$t(`pika.status.pending`))+`) `,1)),s?.state===`processing`||s?.state===`pending`?(m(),o(`span`,tt,` - (`+r(t.$t(`pika.status.processing`))+`) `,1)):a(``,!0)])):a(``,!0)]),t.modelValue?.response?.success===!0?(m(),o(`div`,nt,[e(`div`,rt,[i(y,{"model-value":s},null,8,[`model-value`])]),s?(m(),o(`div`,it,[i(x,{class:`box-item`,effect:`dark`,content:t.$t(`pika.message.downloadVideo`),placement:`top-start`},{default:f(()=>[s?.video_url?(m(),d(b,{key:0,type:`info`,size:`small`,class:`btn-action`,onClick:e=>t.onDownload(s?.video_url)},{default:f(()=>[n(r(t.$t(`pika.button.download`)),1)]),_:1},8,[`onClick`])):a(``,!0)]),_:2},1032,[`content`]),i(S,{path:`/pika/videos`,body:t.modelValue?.request},null,8,[`body`])])):a(``,!0),i(T,{closable:!1,class:`mt-2 success`},{default:f(()=>[t.modelValue?.request?.model?(m(),o(`p`,at,[i(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.model`))+`: `+r(t.modelValue?.request?.model),1)])):a(``,!0),e(`p`,ot,[i(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(w,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,st,[i(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0)]),_:1})])):a(``,!0),t.modelValue?.response?.success===!1?(m(),o(`div`,ct,[i(T,{closable:!1,class:`failure`},{template:f(()=>[i(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.failure`)),1)]),default:f(()=>[e(`p`,lt,[i(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(w,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])]),e(`p`,ut,[i(C,{icon:`fa-solid fa-circle-info`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.failureReason`))+`: `+r(t.modelValue?.response?.error?.message)+` `,1),i(w,{content:t.modelValue?.response?.error?.message,class:`btn-copy`},null,8,[`content`])]),t.modelValue?.elapsed?(m(),o(`p`,dt,[i(C,{icon:`fa-solid fa-clock`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.elapsed`))+`: `+r(t.modelValue?.elapsed?.toFixed(2))+`s `,1)])):a(``,!0),e(`p`,ft,[i(C,{icon:`fa-solid fa-hashtag`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.traceId`))+`: `+r(t.modelValue?.response?.trace_id)+` `,1),i(w,{content:t.modelValue?.response?.trace_id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0),!t.modelValue?.response||s?.state===`processing`||s?.state===`pending`?(m(),o(`div`,$,[i(T,{closable:!1,class:`info`},{template:f(()=>[i(C,{icon:`fa-solid fa-exclamation-triangle`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.failure`)),1)]),default:f(()=>[e(`p`,pt,[i(C,{icon:`fa-solid fa-magic`,class:`mr-1`}),n(` `+r(t.$t(`pika.name.taskId`))+`: `+r(t.modelValue?.id)+` `,1),i(w,{content:t.modelValue?.id,class:`btn-copy`},null,8,[`content`])])]),_:1})])):a(``,!0)])]))),128)}var ht=g({name:`RecentPanel`,components:{TaskPreview:F(qe,[[`render`,mt],[`__scopeId`,`data-v-52856c99`]]),BotPlaceholder:X,NoTasks:Z,ScrollList:K},props:{loading:{type:Boolean,default:!1}},emits:[`reach-top`],data(){return{job:0}},computed:{tasks(){return{...this.$store.state.pika?.tasks,items:this.$store.state.pika?.tasks?.items?.slice()}}},methods:{getScrollElement(){return this.$refs.scrollList?.getScrollElement?.()}}}),gt={key:0},_t={key:2,class:`w-full h-full flex items-center justify-center`};function vt(e,t,n,r,l,u){let h=c(`bot-placeholder`),g=c(`task-preview`),_=c(`scroll-list`),v=c(`no-tasks`);return m(),o(s,null,[e.tasks?.items===void 0?(m(),o(`div`,gt,[i(h)])):e.tasks?.items?.length&&e.tasks?.items?.length>0?(m(),d(_,{key:1,ref:`scrollList`,class:`tasks h-full w-full overflow-y-auto`,loading:e.loading,onReachTop:t[0]||=t=>e.$emit(`reach-top`)},{default:f(()=>[(m(!0),o(s,null,p(e.tasks?.items,(e,t)=>(m(),d(g,{key:t,"model-value":e},null,8,[`model-value`]))),128))]),_:1},8,[`loading`])):a(``,!0),e.tasks?.items?.length===0?(m(),o(`div`,_t,[i(v)])):a(``,!0)],64)}var yt=g({name:`PikaIndex`,components:{ConfigPanel:He,Layout:se,RecentPanel:F(ht,[[`render`,vt]])},mixins:[j],inject:[`initialized`],data(){return{task:void 0,job:0,loadingMore:!1,fetchingTasks:!1}},computed:{applicationsLoading(){return this.$store.state.pika?.status?.getApplications===k.Request},tasksLoading(){return this.$store.state.pika?.status?.getTasks===k.Request||this.fetchingTasks},service(){return this.$store.state.pika.service},credential(){return this.$store.state.pika.credential},config(){return this.$store.state.pika.config},initializing(){return this.$store.state.pika.status.getApplications===k.Request},needApply(){return this.$store.state.pika.status.getApplications===k.Success&&!this.application},application(){return this.$store.state.pika.application},applications(){return this.$store.state.pika.applications},tasks(){return this.$store.state.pika.tasks}},watch:{tasks:{handler(e,t){e?.items?.length>t?.items?.length&&console.debug(`new tasks detected`)},deep:!0},initialized:{async handler(e){e&&(console.debug(`layout initialized`),await this.onGetTasks(),await this.onScrollDown(),this.job=window.setInterval(()=>{this.onGetTasks()},5e3))},immediate:!0}},async mounted(){await this.onGetService()},async unmounted(){window.clearInterval(this.job)},methods:{async onReachTop(){await q({tasks:this.tasks,getTasks:()=>this.tasks,loading:this.loadingMore,setLoading:e=>this.loadingMore=e,isBlocked:()=>this.tasksLoading||this.applicationsLoading,fetch:e=>this.onGetTasks({createdAtMax:e}),getScrollElement:()=>this.getTasksScrollElement()})},async onGetService(){console.debug(`start onGetService`),await this.$store.dispatch(`pika/getService`),console.debug(`end onGetService`)},async onGetApplication(){console.debug(`start onGetApplication`),await this.$store.dispatch(`pika/getApplications`),console.debug(`end onGetApplication`),await this.onGetTasks()},onApply(){R.create({application:this.application}).then(({data:e})=>{this.application=e,I.success(this.$t(`application.message.applySuccessfully`))}).catch(e=>{e?.response?.data?.code===`duplication`&&I.error(this.$t(`application.message.alreadyApplied`))})},async onScrollDown(){await this.$nextTick();let e=this.getTasksScrollElement();e&&(e.scrollTop=e.scrollHeight)},async onGetTasks(e){if(this.applicationsLoading||this.fetchingTasks){console.debug(`loading`);return}console.debug(`start onGetTasks`,e);let{limit:t=5,createdAtMin:n,createdAtMax:r}=e||{};console.debug(`limit`,t,`createdAtMin`,n,`createdAtMax`,r),this.fetchingTasks=!0;try{await this.$store.dispatch(`pika/getTasks`,{limit:t,createdAtMin:n,createdAtMax:r})}finally{this.fetchingTasks=!1}},async onGenerate(){if(!ee(this.uploadTracker,e=>this.$t(e),e=>I.warning(e)))return;let e={...this.config,async:!0};if(!P())return;let t=this.credential?.token;if(!t){console.error(`no token specified`);return}I.info(this.$t(`pika.message.startingTask`)),L(`pika`,z.generate(e,{token:t})).then(()=>{I.success(this.$t(`pika.message.startTaskSuccess`)),this.$store.commit(`pika/setConfig`,{config:void 0})}).catch(e=>{(e?.response?.data)?.error?.code===`used_up`?I.error(this.$t(`pika.message.usedUp`)):I.error(this.$t(`pika.message.startTaskFailed`))}).finally(async()=>{setTimeout(async()=>{await this.onGetTasks(),await this.onScrollDown()},1e3)})},getTasksScrollElement(){return this.$refs.recentPanel?.getScrollElement?.()}}});function bt(e,t,n,r,a,o){let s=c(`config-panel`),l=c(`recent-panel`),u=c(`layout`);return m(),d(u,null,{config:f(()=>[i(s,{onGenerate:e.onGenerate},null,8,[`onGenerate`])]),result:f(()=>[i(l,{ref:`recentPanel`,class:`panel recent`,loading:e.loadingMore,onReachTop:e.onReachTop},null,8,[`loading`,`onReachTop`])]),_:1})}var xt=F(yt,[[`render`,bt],[`__scopeId`,`data-v-fee6c9ea`]]);export{xt as default};
|