@acedatacloud/nexior 3.276.2 → 3.276.4
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-C8TdRvY9.js → ApiCodeButton-DpYCu-EK.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-jb8bzPLa.js → AskUserQuestionCard-CFwxSrmZ.js} +1 -1
- package/dist/assets/{Auth-CevT-APY.js → Auth-7LLt4q3p.js} +1 -1
- package/dist/assets/{Bare-B1hu6q7Z.js → Bare-JAoG6sFQ.js} +1 -1
- package/dist/assets/{BotPlaceholder-DzIzZltA.js → BotPlaceholder-BVXWzbpi.js} +1 -1
- package/dist/assets/{BottomFooter-BIZMLZ5i.js → BottomFooter-BTcNTyiV.js} +1 -1
- package/dist/assets/{Callback-BnArHSvk.js → Callback-CW861dqy.js} +1 -1
- package/dist/assets/{Console-BqpoQ6Rt.js → Console-BOxYP152.js} +1 -1
- package/dist/assets/{Consumption-DLzGFeUT.js → Consumption-QfvilMcG.js} +1 -1
- package/dist/assets/{Conversation-BPaCX6gr.js → Conversation-C1Jb8AgW.js} +1 -1
- package/dist/assets/{CopyToClipboard-LZRed5aB.js → CopyToClipboard-C8gyDUMn.js} +1 -1
- package/dist/assets/{Detail-CnZ-bcZY.js → Detail-BMuX9lMp.js} +2 -2
- package/dist/assets/{Extra-D6o35zFO.js → Extra-BshQjZAE.js} +1 -1
- package/dist/assets/{FilePreview-Dj6VOjhF.js → FilePreview-sx756NB5.js} +1 -1
- package/dist/assets/{Hailuo-C2eHP_WO.js → Hailuo-y5ZOpsGB.js} +1 -1
- package/dist/assets/{History-BUdtyskA.js → History-CBejCufL.js} +1 -1
- package/dist/assets/{ImagePreview-B2FwyzyM.js → ImagePreview-DkXTeOKK.js} +1 -1
- package/dist/assets/{ImageWrapper-_6c4eeKK.js → ImageWrapper-3eqDS8_u.js} +1 -1
- package/dist/assets/{Index-BoG5tSrk.js → Index-05qa1gOC.js} +1 -1
- package/dist/assets/{Index-DgPyFPeb.js → Index-B8H2_z9_.js} +1 -1
- package/dist/assets/{Index-CECIU01b.js → Index-B9wup2zp.js} +1 -1
- package/dist/assets/{Index-C6amW6vz.js → Index-BCYh1z7D.js} +1 -1
- package/dist/assets/{Index-EpovLoMr.js → Index-BJ5FlOXw.js} +1 -1
- package/dist/assets/{Index-C9iJDxXm.js → Index-BJFLDUCM.js} +1 -1
- package/dist/assets/{Index-Dz4NPEQR.js → Index-BRWua7Pn.js} +1 -1
- package/dist/assets/{Index-BPbDPB0M.js → Index-BS_kWluw.js} +1 -1
- package/dist/assets/{Index-rG7e6yXk.js → Index-Be7Y4LIt.js} +1 -1
- package/dist/assets/{Index-CAAN1-_p.js → Index-Bi4e1Cno.js} +1 -1
- package/dist/assets/{Index-DIAtAXGz.js → Index-CEt4sPAp.js} +1 -1
- package/dist/assets/{Index-F3vpxi6E.js → Index-CKtL81ue.js} +1 -1
- package/dist/assets/{Index-BRMiltIw.js → Index-CLgbPHLC.js} +1 -1
- package/dist/assets/{Index-DXBSOAj0.js → Index-CpdPDUM5.js} +1 -1
- package/dist/assets/{Index-hX7fovd_.js → Index-D1ObDODx.js} +1 -1
- package/dist/assets/{Index-BqLQt-5m.js → Index-DREci_3x.js} +1 -1
- package/dist/assets/{Index-rQFLYHuV.js → Index-DbNh8zrA.js} +1 -1
- package/dist/assets/{Index-CD1M-uJN.js → Index-Di-zu-p8.js} +1 -1
- package/dist/assets/{Index-CUKPMLC-.js → Index-DlZMH8SN.js} +1 -1
- package/dist/assets/{Index-Cu81R2TY.js → Index-DuiQE6-J.js} +1 -1
- package/dist/assets/{Index-CkITI13f.js → Index-N6d4HE9o.js} +1 -1
- package/dist/assets/{Index-CZKWwYGB.js → Index-VyvPGs_5.js} +1 -1
- package/dist/assets/{Index-CzZR-m2_.js → Index-d635oMC0.js} +1 -1
- package/dist/assets/{Index-Bbr9Hgc0.js → Index-irgLZ7_Q.js} +1 -1
- package/dist/assets/{Index-BzP5ATX6.js → Index-twlRmX4y.js} +1 -1
- package/dist/assets/{Index-Bm2glD67.js → Index-vDMn1c6V.js} +1 -1
- package/dist/assets/{Invitees-BifLqHGu.js → Invitees-C0R3g-Zf.js} +1 -1
- package/dist/assets/{List-CIOMae5H.js → List-D6nFAmNC.js} +1 -1
- package/dist/assets/{List-Br93CnR9.js → List-DWwcbcPH.js} +1 -1
- package/dist/assets/{List-CMDhlz5R.js → List-DiYo0Int.js} +1 -1
- package/dist/assets/{Main-NAvdrrX0.js → Main-DXUAcE9k.js} +1 -1
- package/dist/assets/{Model-BUjfzCpS.js → Model-CqYI1sS8.js} +1 -1
- package/dist/assets/{Navigator-ym7KWo_7.js → Navigator-C2kRAciX.js} +1 -1
- package/dist/assets/{NoTasks-Bk9F1-iz.js → NoTasks-Dk1WXppl.js} +1 -1
- package/dist/assets/{NotFound-m9TVl0hk.js → NotFound-Bqzv83rR.js} +1 -1
- package/dist/assets/{Pagination-ZFaMc_mv.js → Pagination-DYjyzEjF.js} +1 -1
- package/dist/assets/{Pay-DD8YE5fV.js → Pay-DKdYx4a8.js} +1 -1
- package/dist/assets/{Player-CTNTmM4y.js → Player-5nZKlwHx.js} +1 -1
- package/dist/assets/{Seedance-VRmh5uYq.js → Seedance-CNYLui9X.js} +1 -1
- package/dist/assets/{Status-DvNWBZrq.js → Status-Dx6FNAbD.js} +1 -1
- package/dist/assets/{Subscribe-CgnDdnH3.js → Subscribe-Q4ATea2Y.js} +1 -1
- package/dist/assets/{TabSwitcher-BI7dOxCK.js → TabSwitcher-BRab7qRM.js} +1 -1
- package/dist/assets/{Tts-DX6zLgZp.js → Tts-DegoQTKa.js} +1 -1
- package/dist/assets/{VideoPlayer--5snxkv4.js → VideoPlayer-BLPGe-uP.js} +1 -1
- package/dist/assets/{avatar-DoKzF3gM.js → avatar-TKtEO4Yl.js} +1 -1
- package/dist/assets/{basic-BrTbjgdS.js → basic-Db4GCedU.js} +1 -1
- package/dist/assets/{chat-C8jjNDSm.js → chat-C6NbygCS.js} +1 -1
- package/dist/assets/codingBridge-Df_5ydBi.js +2 -0
- package/dist/assets/{codingBridgeNotify-B3rz48kE.js → codingBridgeNotify-4sUlZ3Lg.js} +2 -2
- package/dist/assets/{collapse-Ds9keFcU.js → collapse-BH0qROl8.js} +1 -1
- package/dist/assets/{createTaskActions-_LT4UGX1.js → createTaskActions-xgaPM_qk.js} +1 -1
- package/dist/assets/{date-picker-ye73-4_d.js → date-picker-DnWtfIDn.js} +1 -1
- package/dist/assets/{dropdown-ByGJfhDP.js → dropdown-BpL2qpyg.js} +1 -1
- package/dist/assets/{esm-DJ62h-fH.js → esm-D7H9sAYC.js} +3 -3
- package/dist/assets/{esm-BvAIkUfu.js → esm-D8MgG7kP.js} +1 -1
- package/dist/assets/{esm-L7PMWDOK.js → esm-DRVKxMaD.js} +2 -2
- package/dist/assets/esm-I-Ydzkdh.js +1 -0
- package/dist/assets/{esm-C2P77e7r.js → esm-SCvm8sjU.js} +2 -2
- package/dist/assets/{esm-UykDnDSA.js → esm-y0EduL6s.js} +1 -1
- package/dist/assets/{esm-BgbAZhOw.js → esm-yeJT_40P.js} +1 -1
- package/dist/assets/{fish-5YNJOUMS.js → fish-C13ospyo.js} +1 -1
- package/dist/assets/{flux-D8BMfN_b.js → flux-CuTQgrEI.js} +1 -1
- package/dist/assets/{grokvideo-DAEDe2lC.js → grokvideo-Cxkcup4s.js} +1 -1
- package/dist/assets/{hailuo-Ep2afX61.js → hailuo-ld7fCVPo.js} +1 -1
- package/dist/assets/{headshots-moxuhQ8q.js → headshots-BmUEgkoj.js} +1 -1
- package/dist/assets/{image-CUt2yKJT.js → image-CjzS-up0.js} +1 -1
- package/dist/assets/{index-Dzx62HWL.js → index-BY8YIwDb.js} +3 -3
- package/dist/assets/{index.browser.esm-DtVKnbsq.js → index.browser.esm-li52u8xd.js} +1 -1
- package/dist/assets/{index.es-BIezN10l.js → index.es-CH5vwGaN.js} +1 -1
- package/dist/assets/{input-number-CXFB1_xE.js → input-number-N0auilju.js} +1 -1
- package/dist/assets/{kling-C0C920Il.js → kling-COeQELLT.js} +1 -1
- package/dist/assets/{luma-btnACTNr.js → luma-sQSQhtbj.js} +1 -1
- package/dist/assets/{midjourney-CnVJEo9h.js → midjourney-CTQ-KItL.js} +1 -1
- package/dist/assets/{nanobanana-uQnyuVgy.js → nanobanana-C22a0oYN.js} +1 -1
- package/dist/assets/{openaiimage-B4szqKdR.js → openaiimage-Dq7MWBVX.js} +1 -1
- package/dist/assets/{pagination-t1m3PdtM.js → pagination-CjEVtILV.js} +1 -1
- package/dist/assets/{pika-B6ZkmISK.js → pika-DU0QitGG.js} +1 -1
- package/dist/assets/{pixverse-CMewIDDG.js → pixverse-C-xOT5MG.js} +1 -1
- package/dist/assets/{popover-Dggo6GYh.js → popover-1vWQQB0V.js} +1 -1
- package/dist/assets/{producer-CLqQs_Oy.js → producer-BGA_s87O.js} +1 -1
- package/dist/assets/{qrart-cUqnnNos.js → qrart-tF6e5Ure.js} +1 -1
- package/dist/assets/{row-Dpgq35ln.js → row-JqIo0dw3.js} +1 -1
- package/dist/assets/{seedance-iA_B79lT.js → seedance-CPhZgXeS.js} +1 -1
- package/dist/assets/{seedream-DSZGr5VZ.js → seedream-DueKINO1.js} +1 -1
- package/dist/assets/{select-Byt7Qw1F.js → select-B14L-681.js} +1 -1
- package/dist/assets/{serp-BML2l1cV.js → serp-DKsD2P4f.js} +1 -1
- package/dist/assets/{slider-Chudll8H.js → slider-ypi7YrnL.js} +1 -1
- package/dist/assets/{solana-wallets-DHdSmT1K.js → solana-wallets-B-Ar3QV5.js} +2 -2
- package/dist/assets/{solana-wallets-vue-F4mtRLNf.js → solana-wallets-vue-BxEXL9wo.js} +1 -1
- package/dist/assets/{sora-DBuX8eeJ.js → sora-Bvuj-CwF.js} +1 -1
- package/dist/assets/{suno-BnJ56a_f.js → suno-DBUXJjOG.js} +1 -1
- package/dist/assets/{switch-CqHzcX_8.js → switch-Dir3SgN_.js} +1 -1
- package/dist/assets/{tabs-DZcdINxf.js → tabs-CllsgUVI.js} +1 -1
- package/dist/assets/{upload-CDJi96y4.js → upload-CgRMUkQi.js} +1 -1
- package/dist/assets/{veo-Di_xCBIf.js → veo-DJcppRgO.js} +1 -1
- package/dist/assets/{wan-DChv5HaI.js → wan-CXX5Z70L.js} +1 -1
- package/dist/assets/{web-BlcKxuW2.js → web-AJVUYB9i.js} +1 -1
- package/dist/assets/{web-CKMhgTwv.js → web-B9iHXzqN.js} +1 -1
- package/dist/assets/{web-Hdenr60p.js → web-Bgfp9ZAB.js} +1 -1
- package/dist/assets/{web-CXAG0ZQx.js → web-Cr9qE3HH.js} +1 -1
- package/dist/assets/{web-CmEs3R8h.js → web-jBZ5VzL9.js} +1 -1
- package/dist/assets/{webextrator-CzvKAcAC.js → webextrator-CXlTr4A9.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/codingBridge-oM7Uohq5.js +0 -2
- package/dist/assets/esm-cc-LpyGe.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Ut as o,X as s,et as c,k as l,lt as u,tt as d,ut as f}from"./vendor-chart-mdwpew_o.js";import{t as p}from"./button-DWzbdjZV.js";import{n as m,t as h}from"./table-fY8LUehs.js";import{t as g}from"./card-B1OoUKT4.js";import{n as _,t as v}from"./row-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,Ut as o,X as s,et as c,k as l,lt as u,tt as d,ut as f}from"./vendor-chart-mdwpew_o.js";import{t as p}from"./button-DWzbdjZV.js";import{n as m,t as h}from"./table-fY8LUehs.js";import{t as g}from"./card-B1OoUKT4.js";import{n as _,t as v}from"./row-JqIo0dw3.js";import{t as y}from"./Pagination-DYjyzEjF.js";import{t as b}from"./skeleton-Cn4UY-T8.js";import{t as x}from"./switch-Dir3SgN_.js";import{An as S,B as C,E as w,P as T,Pr as E,Tr as D,_r as O,gr as k,kr as A,lr as j,ur as M}from"./index-BY8YIwDb.js";import{t as N}from"./index.es-CH5vwGaN.js";import{t as P}from"./CopyToClipboard-C8gyDUMn.js";var F=a({name:`ConsoleApplicationList`,components:{Pagination:y,CopyToClipboard:P,ElTable:h,ElRow:v,ElButton:p,ElCol:_,ElTag:E,ElSkeleton:b,ElSwitch:x,ElTableColumn:m,ElCard:g,FontAwesomeIcon:N},data(){return{credentialType:j,serviceType:M,individualApplications:[],globalApplications:[],individualApplicationsTotal:void 0,globalApplicationsTotal:void 0,loading:!1,buying:!1,limit:10,form:{amount:1},active:{service:void 0,application:void 0}}},computed:{redirect(){return this.$route.query?.redirect},page(){return parseInt(this.$route.query.page?.toString()||`1`)},showPayment(){return!D()}},watch:{page:{handler(){this.onFetchData()}}},mounted(){this.onInitializeGlobalApplication(),this.onFetchData()},methods:{updateAllowConsumeGlobal(e,t){!e||!e.id||S.updateAllConsumeGlobal(e.id,{...e,allow_consume_global:!!t}).then(()=>{A.success(this.$t(`application.message.updateSuccessfully`).toString())}).catch(()=>{A.error(this.$t(`application.message.updateFailed`).toString())})},onGoUsage(e){this.$router.push({name:C,query:{application_id:e.id,type:e?.service?.type}})},onBuyMore(e){e?.id&&this.$router.push({name:T,params:{id:e.id}})},onPageChange(e){this.$router.push({name:this.$route.name?.toString(),query:{...this.$route.query,page:e}})},onFetchApplications(e=k.INDIVIDUAL){return new Promise((t,n)=>{S.getAll({limit:this.limit,...e===k.INDIVIDUAL?{offset:(this.page-1)*this.limit}:{},user_id:this.$store.getters.user.id,ordering:`-created_at`,type:O.USAGE,scope:e}).then(({data:n})=>{e===k.INDIVIDUAL?(this.individualApplications=n.items,this.individualApplicationsTotal=n.count):(this.globalApplications=n.items,this.globalApplicationsTotal=n.count),t(n)}).catch(e=>{A.error(this.$t(`application.message.fetchFailed`).toString()),n(e)})})},onFetchData(){this.loading=!0,Promise.all([this.onFetchApplications(k.INDIVIDUAL),this.onFetchApplications(k.GLOBAL)]).then(()=>{this.loading=!1}).catch(()=>{this.loading=!1})},onInitializeGlobalApplication(){S.create({type:O.USAGE,scope:k.GLOBAL,user_id:this.$store.getters.user.id}).finally(()=>{this.onFetchApplications(k.GLOBAL)})},getRemainingAmount(e){if(e.remaining_amount===void 0||e.remaining_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.remaining_amount?.toFixed(6)} ${t}`},getUsedAmount(e){if(e.used_amount===void 0||e.used_amount===null)return``;let t=this.$t(`service.unit.${e?.service?.unit||`credit`}s`);return`${e.used_amount?.toFixed(6)} ${t}`}}}),I={class:`title`},L={key:1,class:`summary-card`},R={class:`icon-wrapper`},z={class:`label`},B={class:`value`},V={class:`description`},H={key:1,class:`flex flex-row justify-between align-center`},U={class:`summary-card`},W={class:`flex justify-start items-center gap-2 mb-2 w-full`},G={class:`icon-wrapper !mb-0`},K={class:`text-[var(--el-text-color-regular)] text-[14px] truncate`},q={class:`label`},J={class:`value`},Y={class:`description`},X={class:`flex flex-col items-end gap-2`},Z={class:`copy`},Q={key:0,class:`expired-at`},$={class:`flex flex-wrap items-center justify-end gap-1`},ee={class:`pagination`};function te(a,p,m,h,g,_){let v=c(`el-col`),y=c(`el-row`),b=c(`el-skeleton`),x=c(`font-awesome-icon`),S=c(`el-card`),C=c(`copy-to-clipboard`),w=c(`el-button`),T=c(`el-table-column`),E=c(`el-tag`),D=c(`el-switch`),O=c(`el-table`),k=c(`pagination`),A=d(`loading`);return s(),e(y,{class:`application-list`},{default:u(()=>[r(v,{span:24},{default:u(()=>[r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[t(`h2`,I,o(a.$t(`common.title.allApplications`)),1)]),_:1})]),_:1}),r(y,{gutter:15,class:`mb-3`},{default:u(()=>[r(v,{md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[a.loading?(s(),e(b,{key:0})):(s(),l(`div`,L,[t(`div`,R,[r(x,{icon:`fa-solid fa-cubes-stacked`})]),t(`p`,z,o(a.$t(`application.title.count`)),1),t(`p`,B,o(a.individualApplicationsTotal),1),t(`p`,V,o(a.$t(`application.message.countDescription`)),1)]))]),_:1})]),_:1}),a.showPayment&&a.globalApplications?.length>0?(s(),e(v,{key:0,md:12,xs:24},{default:u(()=>[r(S,{shadow:`hover`,class:`relative min-h-[180px] mb-2`,"body-style":{padding:`18px 20px`}},{default:u(()=>[a.loading?(s(),e(b,{key:0})):(s(),l(`div`,H,[t(`div`,U,[t(`div`,W,[t(`div`,G,[r(x,{icon:`fa-solid fa-wallet`})]),t(`span`,K,[n(o(a.$t(`application.field.id`))+`: `+o(a.globalApplications?.[0]?.id)+` `,1),a.globalApplications?.[0]?.id?(s(),e(C,{key:0,content:a.globalApplications?.[0]?.id,class:`inline-block`},null,8,[`content`])):i(``,!0)])]),t(`p`,q,o(a.$t(`application.title.globalBalance`)),1),t(`p`,J,o(a.globalApplications?.[0]?.remaining_amount?.toFixed(6)||`0.000000`)+` `+o(a.$t(`service.unit.credits`)),1),t(`p`,Y,o(a.$t(`application.message.globalBalanceDescription`)),1)]),t(`div`,X,[r(w,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:p[0]||=e=>a.onGoUsage(a.globalApplications?.[0])},{default:u(()=>[r(x,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.usage`)),1)]),_:1}),a.showPayment?(s(),e(w,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:p[1]||=e=>a.onBuyMore(a.globalApplications?.[0])},{default:u(()=>[r(x,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.buyMore`)),1)]),_:1})):i(``,!0)])]))]),_:1})]),_:1})):i(``,!0)]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[r(S,{shadow:`hover`,class:`applications-table-card`},{default:u(()=>[f((s(),e(O,{data:a.individualApplications,stripe:``,class:`applications-table !min-h-[calc(100vh-420px)]`,"table-layout":`fixed`,"empty-text":a.$t(`common.message.noData`)},{default:u(()=>[r(T,{prop:`id`,label:a.$t(`application.field.id`),width:`200px`,"class-name":`text-center`},{default:u(e=>[t(`span`,null,o(e.row.id),1),t(`span`,Z,[r(C,{content:e?.row?.id,class:`inline-block`},null,8,[`content`])])]),_:1},8,[`label`]),r(T,{label:a.$t(`application.field.type`),width:`90px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[t.row?.type===`Period`?(s(),e(E,{key:0,type:`success`,effect:`dark`,round:``},{default:u(()=>[n(o(a.$t(`application.type.period`)),1)]),_:1})):t.row?.type===`Usage`?(s(),e(E,{key:1,effect:`dark`,round:``},{default:u(()=>[n(o(a.$t(`application.type.usage`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(T,{label:a.$t(`application.field.name`),width:`180px`},{default:u(r=>[t(`span`,null,o(r.row?.service?.title),1),r.row?.role===`grantee`?(s(),e(E,{key:0,type:`info`,size:`small`,round:``,class:`ml-2`},{default:u(()=>[n(o(a.$t(`application.badge.shared`)),1)]),_:1})):i(``,!0)]),_:1},8,[`label`]),r(T,{prop:`remaining_amount`,label:a.$t(`application.field.remainingAmount`),width:`150px`,"class-name":`text-center`},{default:u(e=>[t(`span`,null,o(a.getRemainingAmount(e.row)),1)]),_:1},8,[`label`]),r(T,{prop:`used_amount`,label:a.$t(`application.field.usedAmount`),width:`150px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[t(`span`,null,o(a.getUsedAmount(e.row)),1)]),_:1},8,[`label`]),r(T,{prop:`allow_consume_global`,label:a.$t(`application.field.allowConsumeGlobal`),width:`120px`,"class-name":`hidden sm:table-cell text-center`,"label-class-name":`hidden sm:table-cell`},{default:u(t=>[t.row.service?.type===a.serviceType.API?(s(),e(D,{key:0,modelValue:t.row.allow_consume_global,"onUpdate:modelValue":e=>t.row.allow_consume_global=e,"active-value":!0,"inactive-value":!1,onChange:e=>a.updateAllowConsumeGlobal(t.row,e)},null,8,[`modelValue`,`onUpdate:modelValue`,`onChange`])):i(``,!0)]),_:1},8,[`label`]),r(T,{label:a.$t(`application.field.expiredAt`),width:`180px`,"class-name":`hidden sm:table-cell`,"label-class-name":`hidden sm:table-cell`},{default:u(e=>[e.row.expired_at?(s(),l(`span`,Q,o(a.$dayjs.format(e.row.expired_at)),1)):i(``,!0)]),_:1},8,[`label`]),r(T,{fixed:`right`,width:`200px`},{default:u(c=>[t(`div`,$,[r(w,{class:`!m-0 !px-2`,size:`small`,round:``,onClick:e=>a.onGoUsage(c?.row)},{default:u(()=>[r(x,{icon:`fa-solid fa-chart-line`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.usage`)),1)]),_:1},8,[`onClick`]),a.showPayment?(s(),e(w,{key:0,class:`!m-0 !px-2`,type:`primary`,round:``,size:`small`,onClick:e=>a.onBuyMore(c?.row)},{default:u(()=>[r(x,{icon:`fa-solid fa-coins`,class:`mr-1 text-[12px]`}),n(` `+o(a.$t(`application.button.buyMore`)),1)]),_:1},8,[`onClick`])):i(``,!0)])]),_:1})]),_:1},8,[`data`,`empty-text`])),[[A,a.loading]])]),_:1})]),_:1})]),_:1}),r(y,null,{default:u(()=>[r(v,{span:24},{default:u(()=>[t(`div`,ee,[r(k,{"current-page":a.page,"page-size":a.limit,total:a.individualApplicationsTotal,onChange:a.onPageChange},null,8,[`current-page`,`page-size`,`total`,`onChange`])])]),_:1})]),_:1})]),_:1})]),_:1})}var ne=w(F,[[`render`,te],[`__scopeId`,`data-v-7182b838`]]);export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,T as o,Ut as s,X as c,et as l,k as u,lt as d}from"./vendor-chart-mdwpew_o.js";import{t as f}from"./button-DWzbdjZV.js";import{t as p}from"./Navigator-
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{D as e,E as t,M as n,N as r,O as i,P as a,T as o,Ut as s,X as c,et as l,k as u,lt as d}from"./vendor-chart-mdwpew_o.js";import{t as f}from"./button-DWzbdjZV.js";import{t as p}from"./Navigator-C2kRAciX.js";import{t as m}from"./checkbox-hfJFSY6z.js";import{t as h}from"./divider-Ba_Z3oBh.js";import"./constants-C-bSXdJ_.js";import{An as g,E as _,Mr as v,Mt as y,Sr as b,_r as x,gr as S,kr as C,yr as w}from"./index-BY8YIwDb.js";import{t as T}from"./Status-Dx6FNAbD.js";var E=a({name:`ApplicationConfirm`,components:{ElDialog:v,ElDivider:h,ElCheckbox:m,ElButton:f},props:{visible:{type:Boolean,required:!1,default:!1}},emits:[`update:visible`,`apply`],data(){return{checked:!0}},watch:{},methods:{getBaseUrlPlatform:b,onApply(){if(!this.checked){C.error(this.$t(`application.message.notAgreePolicy`));return}this.$emit(`apply`)}}}),D={class:`content py-[10px] px-[40px]`},O={class:`my-4`},k={class:`policy mb-[10px]`},A={class:`policy-title text-[12px] relative -bottom-[3px]`},j=[`href`];function M(i,a,o,u,f,p){let m=l(`el-divider`),h=l(`el-checkbox`),g=l(`el-button`),_=l(`el-dialog`);return c(),e(_,{"model-value":i.visible,width:`500px`,title:i.$t(`application.message.welcome`),center:``,onClose:a[1]||=e=>i.$emit(`update:visible`,!1)},{default:d(()=>[t(`div`,D,[t(`p`,O,s(i.$t(`application.message.notApplied`)),1),r(m,{class:`my-2`}),t(`div`,k,[r(h,{modelValue:i.checked,"onUpdate:modelValue":a[0]||=e=>i.checked=e,size:`large`,class:`policy-checkbox mr-[10px]`},null,8,[`modelValue`]),t(`span`,A,s(i.$t(`application.message.readPolicy`)),1),t(`a`,{class:`policy-title text-[12px] relative -bottom-[3px] text-[var(--el-color-primary)] cursor-pointer no-underline`,target:`_blank`,href:i.getBaseUrlPlatform()+`/terms`},` \xA0`+s(i.$t(`application.message.policy`)),9,j)]),r(g,{round:``,type:`primary`,onClick:i.onApply},{default:d(()=>[n(s(i.$t(`common.button.start`)),1)]),_:1},8,[`onClick`])])]),_:1},8,[`model-value`,`title`])}var N=a({name:`LayoutMain`,components:{Navigator:p,ApplicationStatus:T,ApplicationConfirm:_(E,[[`render`,M]])},provide(){return{initialized:o(()=>this.initialized)}},data(){return{initialized:!1,applying:!1,mobile:window.innerWidth<768,initializeRunId:0}},computed:{appName(){return this.$route.meta.appName},application(){return this.$store.state[this.appName]?.application},applications(){let e=this.$store.state[this.appName]?.applications??[];console.debug(`individualApplications`,e);let t=this.$store.state.applications??[];return console.debug(`globalApplications`,t),t.concat(e)},loading(){return this.$store.state[this.appName]?.status?.getApplications===w.Request},service(){return this.$store.state[this.appName]?.service},userId(){return this.$store.state.user?.id}},watch:{appName(){this.initialize()},userId(e,t){e&&e!==t&&this.initialize()}},mounted(){this.initialize(),window.addEventListener(`resize`,this.onResize)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize)},methods:{onResize(){this.mobile=window.innerWidth<768},async initialize(){let e=++this.initializeRunId;if(this.initialized=!1,console.debug(`Fetching all individual and global applications for`,this.appName),await Promise.allSettled([this.$store.dispatch(`getApplications`),this.$store.dispatch(`${this.appName}/getApplications`)]),e!==this.initializeRunId)return;console.debug(`Fetched all applications`,this.applications),this.$store.state.applications?.length===0&&await this.onAutoApply();let t=this.$store.state[this.appName]?.application;console.debug(`current application`,t);let n=y(this.applications,t);console.debug(`final application`,n),n&&(console.debug(`set final application`,n,n?.type),await this.$store.dispatch(`${this.appName}/setApplication`,n)),console.debug(`finished initialization`),this.initialized=!0},onApply(){this.onAutoApply()},async onAutoApply(){try{await g.create({type:x.USAGE,scope:S.GLOBAL,user_id:this.$store.getters.user.id}),this.applying=!1,await this.$store.dispatch(`getApplications`),this.showWelcomeToast()}catch(e){e?.response?.data?.code===`duplication`?await this.$store.dispatch(`getApplications`):C.error(this.$t(`application.message.applyFailed`))}},showWelcomeToast(){let e=this.$store.state.applications?.[0],t=Math.floor(e?.remaining_amount??0);C({message:t>0?this.$t(`application.message.welcomeWithCredits`,{credits:t}):this.$t(`application.message.welcomeNoCredits`),type:`success`,duration:6e3,showClose:!0})}}}),P={class:`wrapper`};function F(t,n,a,o,s,d){let f=l(`router-view`),p=l(`navigator`),m=l(`application-status`),h=l(`application-confirm`);return c(),u(`div`,P,[r(f,{class:`main`}),r(p,{class:`navigator`,direction:t.mobile?`row`:`column`},null,8,[`direction`]),t.application?(c(),e(m,{key:0,class:`status-floating fixed right-2 z-[200]`,application:t.application,applications:t.applications,"show-price":!1,authenticated:!!t.$store.state.token.access,service:t.service,onSelect:n[0]||=e=>t.$store.dispatch(`${t.appName}/setApplication`,e)},null,8,[`application`,`applications`,`authenticated`,`service`])):i(``,!0),r(h,{modelValue:t.applying,"onUpdate:modelValue":n[1]||=e=>t.applying=e,modelModifiers:{visible:!0},onApply:t.onApply},null,8,[`modelValue`,`onApply`])])}var I=_(N,[[`render`,F],[`__scopeId`,`data-v-319483e1`]]);export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as s,Ut as c,X as l,et as u,k as d,lt as f,x as p,y as m}from"./vendor-chart-mdwpew_o.js";import{t as h}from"./button-DWzbdjZV.js";import{t as g}from"./upload-CDJi96y4.js";import{t as _}from"./image-CUt2yKJT.js";import{t as v}from"./alert-BJj7gY4q.js";import{n as y,r as b}from"./radio-IJQsW93X.js";import{t as x}from"./switch-CqHzcX_8.js";import{t as S}from"./vendor-axios-Ck2ffRoh.js";import"./constants-C-bSXdJ_.js";import{E as C,Ir as w,J as T,Sr as E,kr as D,kt as ee,qt as te}from"./index-Dzx62HWL.js";import{t as O}from"./index.es-BIezN10l.js";import{t as k}from"./CopyToClipboard-LZRed5aB.js";import{t as A}from"./Hailuo-C2eHP_WO.js";import{t as j}from"./BotPlaceholder-DzIzZltA.js";import{t as M}from"./TabSwitcher-BI7dOxCK.js";var N=4,P=90,F=o({name:`FishRecorder`,components:{ElButton:h,FontAwesomeIcon:O},emits:[`done`,`cancel`,`update:script`],data(){return{state:`idle`,scriptIndex:0,seconds:0,timerId:0,maxTimerId:0,mediaRecorder:null,stream:null,chunks:[],recordedBlob:null,recordedUrl:``,uploading:!1}},computed:{formattedTime(){let e=Math.floor(this.seconds/60),t=this.seconds%60;return`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`},currentScript(){let e=`fish.script.passage${this.scriptIndex%N+1}`;return this.$t(e)}},beforeUnmount(){this.cleanup()},mounted(){this.$emit(`update:script`,this.currentScript)},methods:{nextScript(){this.scriptIndex=(this.scriptIndex+1)%N,this.$emit(`update:script`,this.currentScript)},async startRecord(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){D.error(this.$t(`fish.message.recorderUnsupported`));return}try{this.stream=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`;D.error(this.$t(t?`fish.message.micDenied`:`fish.message.micError`));return}this.chunks=[];let e=this.pickMimeType();try{this.mediaRecorder=e?new MediaRecorder(this.stream,{mimeType:e}):new MediaRecorder(this.stream)}catch{this.mediaRecorder=new MediaRecorder(this.stream)}this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.chunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.chunks,{type:this.mediaRecorder?.mimeType||`audio/webm`});this.recordedBlob=e,this.recordedUrl=URL.createObjectURL(e),this.state=`recorded`,this.releaseStream()},this.mediaRecorder.start(),this.state=`recording`,this.seconds=0,this.timerId=window.setInterval(()=>{this.seconds++},1e3),this.maxTimerId=window.setTimeout(()=>{this.state===`recording`&&this.stopRecord()},P*1e3)},stopRecord(){this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),window.clearInterval(this.timerId),window.clearTimeout(this.maxTimerId)},reset(){this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl),this.recordedUrl=``,this.recordedBlob=null,this.state=`idle`,this.seconds=0},onCancel(){this.cleanup(),this.$emit(`cancel`)},cleanup(){this.stopRecord(),this.releaseStream(),this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl)},releaseStream(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null},pickMimeType(){for(let e of[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg`])if(typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported?.(e))return e},extensionForMime(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`ogg`)?`ogg`:e.includes(`wav`)?`wav`:`mp3`},async useRecording(){if(this.recordedBlob){if(this.seconds<3){D.warning(this.$t(`fish.message.recordingTooShort`));return}this.uploading=!0;try{let e=this.$store.state.token?.access,t=this.extensionForMime(this.recordedBlob.type||``),n=new File([this.recordedBlob],`recording-${Date.now()}.${t}`,{type:this.recordedBlob.type||`audio/webm`}),r=new FormData;r.append(`file`,n);let{data:i}=await S.post(`${E()}/api/v1/files/`,r,{headers:{Authorization:`Bearer ${e}`}}),a=i?.file_url;if(!a){D.error(this.$t(`fish.message.uploadError`));return}this.$emit(`done`,{url:a,text:this.currentScript})}catch(e){D.error(this.$t(`fish.message.uploadError`)),console.error(`recorder upload failed`,e)}finally{this.uploading=!1}}}}}),I={class:`recorder`},L={key:0,class:`script`},R={class:`script-header`},z={class:`label`},B={class:`script-text`},V={class:`controls`},H={class:`status`},U={class:`hint`},W={key:1,class:`preview`},G=[`src`],K={class:`preview-actions`},q={class:`footer`};function J(o,s,p,m,h,g){let _=u(`font-awesome-icon`),v=u(`el-button`);return l(),d(`div`,I,[o.state===`recorded`?a(``,!0):(l(),d(`div`,L,[n(`div`,R,[i(_,{icon:`fa-solid fa-book-open`,class:`icon mr-1`}),n(`span`,z,c(o.$t(`fish.description.readScript`)),1),i(v,{link:``,size:`small`,class:`ml-auto`,disabled:o.state===`recording`,onClick:o.nextScript},{default:f(()=>[i(_,{icon:`fa-solid fa-shuffle`,class:`mr-1`}),r(` `+c(o.$t(`fish.button.nextScript`)),1)]),_:1},8,[`disabled`,`onClick`])]),n(`p`,B,c(o.currentScript),1)])),n(`div`,V,[o.state===`idle`?(l(),t(v,{key:0,type:`danger`,circle:``,size:`large`,title:o.$t(`fish.button.startRecord`),onClick:o.startRecord},{default:f(()=>[i(_,{icon:`fa-solid fa-microphone`})]),_:1},8,[`title`,`onClick`])):o.state===`recording`?(l(),t(v,{key:1,type:`warning`,circle:``,size:`large`,title:o.$t(`fish.button.stopRecord`),onClick:o.stopRecord},{default:f(()=>[i(_,{icon:`fa-solid fa-stop`})]),_:1},8,[`title`,`onClick`])):a(``,!0),n(`div`,H,[n(`span`,{class:e([`timer`,o.state===`recording`?`live`:``])},c(o.formattedTime),3),n(`span`,U,c(o.state===`idle`?o.$t(`fish.description.recorderIdle`):o.state===`recording`?o.$t(`fish.description.recorderRecording`):o.$t(`fish.description.recorderRecorded`)),1)])]),o.state===`recorded`&&o.recordedUrl?(l(),d(`div`,W,[n(`audio`,{src:o.recordedUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,G),n(`div`,K,[i(v,{size:`small`,disabled:o.uploading,onClick:o.reset},{default:f(()=>[i(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+c(o.$t(`fish.button.reRecord`)),1)]),_:1},8,[`disabled`,`onClick`]),i(v,{size:`small`,type:`primary`,loading:o.uploading,onClick:o.useRecording},{default:f(()=>[i(_,{icon:`fa-solid fa-check`,class:`mr-1`}),r(` `+c(o.$t(`fish.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])])])):a(``,!0),n(`div`,q,[i(v,{link:``,size:`small`,disabled:o.uploading||o.state===`recording`,onClick:o.onCancel},{default:f(()=>[r(c(o.$t(`fish.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Y=C(F,[[`render`,J],[`__scopeId`,`data-v-1958e4a1`]]),X=50*1024*1024,Z=()=>({title:``,description:``,texts:``,voicesUrl:``,visibility:`unlist`,trainMode:`fast`,enhanceAudio:!0,generateSample:!1}),Q=o({name:`FishModelConfigPanel`,components:{ElButton:h,ElInput:w,ElRadioButton:y,ElRadioGroup:b,ElSwitch:x,ElUpload:g,FontAwesomeIcon:O,Recorder:Y},mixins:[ee],emits:[`create`],data(){return{form:Z(),fileList:[],uploading:!1,creating:!1,recording:!1,textsAuto:!0}},computed:{uploadUrl(){return E()+`/api/v1/files/`},uploadHeaders(){return{Authorization:`Bearer ${this.$store.state.token?.access}`}},canCreate(){return!!this.form.title.trim()&&!!this.form.voicesUrl&&!this.uploading&&!this.creating},supportsRecorder(){return!!(typeof navigator<`u`?navigator.mediaDevices:void 0)?.getUserMedia&&typeof MediaRecorder<`u`}},methods:{onBeforeUpload(e){return e.size>X?(D.warning(this.$t(`fish.message.audioSizeExceed`)),!1):(this.uploading=!0,!0)},onExceed(){D.warning(this.$t(`fish.message.audioOnlyOne`))},onUploadError(){this.uploading=!1,D.error(this.$t(`fish.message.uploadError`))},onUploadSuccess(e,t,n){this.uploading=!1;let r=e?.file_url;if(!r){D.error(this.$t(`fish.message.uploadError`)),this.fileList=[];return}this.form.voicesUrl=r,this.fileList=n},onRecorded(e){this.form.voicesUrl=e.url,this.recording=!1,e.text&&this.textsAuto&&(this.form.texts=e.text)},onStartRecord(){this.recording=!0,this.textsAuto=!this.form.texts.trim()},onScriptChange(e){this.textsAuto&&this.recording&&(this.form.texts=e)},onTextsInput(){this.textsAuto=!1},clearAudio(){this.form.voicesUrl=``,this.fileList=[]},onCreate(){let e=this.form.title.trim();if(!e){D.warning(this.$t(`fish.message.titleRequired`));return}if(!this.form.voicesUrl){D.warning(this.$t(`fish.message.audioRequired`));return}let t={title:e,voices:this.form.voicesUrl,visibility:this.form.visibility,train_mode:this.form.trainMode,enhance_audio_quality:this.form.enhanceAudio,generate_sample:this.form.generateSample};this.form.description.trim()&&(t.description=this.form.description.trim()),this.form.texts.trim()&&(t.texts=[this.form.texts.trim()]),this.creating=!0,this.$emit(`create`,t),setTimeout(()=>{this.creating=!1,this.form=Z(),this.fileList=[]},600)}}}),ne={class:`flex flex-col h-full`},re={class:`flex-1 overflow-y-auto p-5`},ie={class:`field-block mb-4`},ae={class:`title font-bold`},oe={class:`field-block mb-4`},se={class:`flex items-baseline justify-between mb-1`},ce={class:`title font-bold`},le={key:0,class:`muted`},ue={class:`hint`},de={key:0,class:`audio-actions`},fe={key:1,class:`hint warn`},pe={key:3,class:`mt-2`},me=[`src`],he={class:`ready-actions`},ge={class:`field-block mb-4`},_e={class:`title font-bold`},ve={class:`hint`},ye={class:`field-block mb-4`},be={class:`title font-bold`},xe={class:`field-block mb-4`},Se={class:`title font-bold`},Ce={class:`field-block mb-4`},we={class:`title font-bold`},Te={class:`field-block mb-3`},Ee={class:`field-row`},De={class:`title font-bold`},Oe={class:`hint mt-0 mb-0`},ke={class:`field-block mb-2`},Ae={class:`field-row`},je={class:`title font-bold`},Me={class:`hint mt-0 mb-0`},Ne={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pe(e,o,s,p,m,h){let g=u(`el-input`),_=u(`font-awesome-icon`),v=u(`el-button`),y=u(`el-upload`),b=u(`recorder`),x=u(`el-radio-button`),S=u(`el-radio-group`),C=u(`el-switch`);return l(),d(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`h2`,ae,[r(c(e.$t(`fish.name.voiceTitle`))+` `,1),o[9]||=n(`span`,{class:`required`},`*`,-1)]),i(g,{modelValue:e.form.title,"onUpdate:modelValue":o[0]||=t=>e.form.title=t,placeholder:e.$t(`fish.placeholder.voiceTitle`),maxlength:`60`},null,8,[`modelValue`,`placeholder`])]),n(`div`,oe,[n(`div`,se,[n(`h2`,ce,[r(c(e.$t(`fish.name.referenceAudio`))+` `,1),o[10]||=n(`span`,{class:`required`},`*`,-1)]),!e.form.voicesUrl&&!e.recording?(l(),d(`span`,le,c(e.$t(`fish.description.audioRequired`)),1)):a(``,!0)]),n(`p`,ue,c(e.$t(`fish.description.uploadAudio`)),1),!e.form.voicesUrl&&!e.recording?(l(),d(`div`,de,[i(y,{"file-list":e.fileList,"onUpdate:fileList":o[1]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,.ogg,.webm,audio/*`,"show-file-list":!1,"on-exceed":e.onExceed,"on-error":e.onUploadError,"on-success":e.onUploadSuccess,"before-upload":e.onBeforeUpload,headers:e.uploadHeaders},{default:f(()=>[i(v,{type:`primary`,plain:``,round:``,loading:e.uploading},{default:f(()=>[i(_,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+c(e.$t(`fish.button.uploadAudio`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`before-upload`,`headers`]),i(v,{type:`primary`,round:``,disabled:!e.supportsRecorder,onClick:e.onStartRecord},{default:f(()=>[i(_,{icon:`fa-solid fa-microphone`,class:`icon mr-1`}),r(` `+c(e.$t(`fish.button.recordAudio`)),1)]),_:1},8,[`disabled`,`onClick`])])):a(``,!0),!e.supportsRecorder&&!e.form.voicesUrl&&!e.recording?(l(),d(`p`,fe,c(e.$t(`fish.message.recorderUnsupported`)),1)):a(``,!0),e.recording?(l(),t(b,{key:2,class:`mt-2`,onDone:e.onRecorded,onCancel:o[2]||=t=>e.recording=!1,"onUpdate:script":e.onScriptChange},null,8,[`onDone`,`onUpdate:script`])):a(``,!0),e.form.voicesUrl&&!e.recording?(l(),d(`div`,pe,[n(`audio`,{src:e.form.voicesUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,me),n(`div`,he,[i(v,{link:``,size:`small`,onClick:e.clearAudio},{default:f(()=>[i(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+c(e.$t(`fish.button.replaceAudio`)),1)]),_:1},8,[`onClick`])])])):a(``,!0)]),n(`div`,ge,[n(`h2`,_e,c(e.$t(`fish.name.audioTexts`)),1),n(`p`,ve,c(e.$t(`fish.description.audioTexts`)),1),i(g,{modelValue:e.form.texts,"onUpdate:modelValue":o[3]||=t=>e.form.texts=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.audioTexts`),maxlength:`500`,onInput:e.onTextsInput},null,8,[`modelValue`,`placeholder`,`onInput`])]),n(`div`,ye,[n(`h2`,be,c(e.$t(`fish.name.voiceDescription`)),1),i(g,{modelValue:e.form.description,"onUpdate:modelValue":o[4]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.voiceDescription`),maxlength:`500`},null,8,[`modelValue`,`placeholder`])]),n(`div`,xe,[n(`h2`,Se,c(e.$t(`fish.name.visibility`)),1),i(S,{modelValue:e.form.visibility,"onUpdate:modelValue":o[5]||=t=>e.form.visibility=t,size:`small`},{default:f(()=>[i(x,{label:`private`,value:`private`},{default:f(()=>[r(c(e.$t(`fish.value.private`)),1)]),_:1}),i(x,{label:`unlist`,value:`unlist`},{default:f(()=>[r(c(e.$t(`fish.value.unlist`)),1)]),_:1}),i(x,{label:`public`,value:`public`},{default:f(()=>[r(c(e.$t(`fish.value.public`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Ce,[n(`h2`,we,c(e.$t(`fish.name.trainMode`)),1),i(S,{modelValue:e.form.trainMode,"onUpdate:modelValue":o[6]||=t=>e.form.trainMode=t,size:`small`},{default:f(()=>[i(x,{label:`fast`,value:`fast`},{default:f(()=>[r(c(e.$t(`fish.value.trainModeFast`)),1)]),_:1}),i(x,{label:`precise`,value:`precise`},{default:f(()=>[r(c(e.$t(`fish.value.trainModePrecise`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Te,[n(`div`,Ee,[n(`h2`,De,c(e.$t(`fish.name.enhanceAudio`)),1),i(C,{modelValue:e.form.enhanceAudio,"onUpdate:modelValue":o[7]||=t=>e.form.enhanceAudio=t},null,8,[`modelValue`])]),n(`p`,Oe,c(e.$t(`fish.description.enhanceAudio`)),1)]),n(`div`,ke,[n(`div`,Ae,[n(`h2`,je,c(e.$t(`fish.name.generateSample`)),1),i(C,{modelValue:e.form.generateSample,"onUpdate:modelValue":o[8]||=t=>e.form.generateSample=t},null,8,[`modelValue`])]),n(`p`,Me,c(e.$t(`fish.description.generateSample`)),1)])]),n(`div`,Ne,[i(v,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canCreate||e.creating,loading:e.creating,onClick:e.onCreate},{default:f(()=>[i(_,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+c(e.$t(`fish.button.createModel`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])])])}var Fe=C(Q,[[`render`,Pe],[`__scopeId`,`data-v-d8fc0e55`]]),Ie=o({name:`FishVoiceCard`,components:{ElAlert:v,ElButton:h,ElImage:_,CopyToClipboard:k,FontAwesomeIcon:O},props:{modelValue:{type:Object,required:!0}},computed:{sampleAudioUrl(){let e=this.modelValue?.samples;if(e?.length)return e[0]?.audio},voiceId(){let e=this.modelValue;return(e?.id||e?._id||e?.reference_id||``).toString()},coverSrc(){let e=this.modelValue?.cover_image;return e&&typeof e==`string`?e:void 0},createdAtLabel(){let e=this.modelValue?.created_at;if(e==null||e===``)return null;let t=typeof e==`number`?e:parseFloat(String(e));return!Number.isFinite(t)||t<=0?null:this.$dayjs.format(``+new Date(t*1e3))}},methods:{onUseVoice(){let e=this.voiceId;e&&(this.$store.commit(`fish/setConfig`,{...this.$store.state.fish?.config,reference_id:e}),this.$router.push({name:T}))}}}),Le={class:`card`},Re={class:`left`},ze={class:`main`},Be={class:`header`},Ve={class:`title`},He={key:0,class:`datetime`},Ue={key:0,class:`description`},We={key:1,class:`sample mt-2`},Ge=[`src`],Ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Je={class:`operations mt-2`};function Ye(e,o,s,p,h,g){let _=u(`el-image`),v=u(`font-awesome-icon`),y=u(`copy-to-clipboard`),b=u(`el-alert`),x=u(`el-button`);return l(),d(`div`,Le,[n(`div`,Re,[e.coverSrc?(l(),t(_,{key:0,src:e.coverSrc,class:`cover`,fit:`cover`},{error:f(()=>[i(_,{src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`})]),placeholder:f(()=>[...o[0]||=[n(`div`,{class:`cover placeholder`},null,-1)]]),_:1},8,[`src`])):(l(),t(_,{key:1,src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`}))]),n(`div`,ze,[n(`div`,Be,[n(`span`,Ve,c(e.modelValue?.title||e.$t(`fish.name.untitledVoice`)),1),e.createdAtLabel?(l(),d(`span`,He,c(e.createdAtLabel),1)):a(``,!0)]),e.modelValue?.description?(l(),d(`p`,Ue,c(e.modelValue?.description),1)):a(``,!0),e.sampleAudioUrl?(l(),d(`div`,We,[n(`audio`,{src:e.sampleAudioUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,Ge)])):a(``,!0),i(b,{closable:!1,class:`mt-2 success`},{default:f(()=>[e.voiceId?(l(),d(`p`,Ke,[i(v,{icon:`fa-solid fa-microphone`,class:`mr-1`}),r(` `+c(e.$t(`fish.name.referenceId`))+`: `+c(e.voiceId)+` `,1),i(y,{content:e.voiceId},null,8,[`content`])])):a(``,!0),e.modelValue?.visibility?(l(),d(`p`,qe,[i(v,{icon:`fa-solid fa-eye`,class:`mr-1`}),r(` `+c(e.$t(`fish.name.visibility`))+`: `+c(e.modelValue?.visibility),1)])):a(``,!0)]),_:1}),n(`div`,Je,[i(x,{type:`primary`,size:`small`,plain:``,disabled:!e.voiceId,onClick:m(e.onUseVoice,[`stop`])},{default:f(()=>[i(v,{icon:`fa-solid fa-volume-high`,class:`mr-1`}),r(` `+c(e.$t(`fish.button.useVoice`)),1)]),_:1},8,[`disabled`,`onClick`])])])])}var Xe=o({name:`FishModelListPanel`,components:{VoiceCard:C(Ie,[[`render`,Ye],[`__scopeId`,`data-v-629e2d04`]]),BotPlaceholder:j,FontAwesomeIcon:O},props:{loading:{type:Boolean,default:!1}},computed:{voices(){return this.$store.state.fish?.voices}}}),Ze={class:`model-list-panel flex flex-col h-full`},Qe={class:`header`},$e={class:`title`},et={key:0,class:`count`},tt={class:`body flex-1 min-h-0`},$={key:0,class:`h-full`},nt={key:1,class:`w-full h-full flex flex-col items-center justify-center text-center px-6`},rt={class:`empty-title`},it={class:`empty-hint`},at={key:2,class:`w-full h-full overflow-y-auto pr-1`};function ot(e,r,o,f,m,h){let g=u(`bot-placeholder`),_=u(`font-awesome-icon`),v=u(`voice-card`);return l(),d(`div`,Ze,[n(`header`,Qe,[n(`h2`,$e,c(e.$t(`fish.title.myVoices`)),1),e.voices?.length?(l(),d(`span`,et,c(e.voices?.length),1)):a(``,!0)]),n(`div`,tt,[e.voices===void 0?(l(),d(`div`,$,[i(g)])):e.voices.length===0?(l(),d(`div`,nt,[i(_,{icon:`fa-solid fa-microphone-lines`,class:`empty-icon`}),n(`p`,rt,c(e.$t(`fish.title.noVoicesYet`)),1),n(`p`,it,c(e.$t(`fish.description.noVoicesYet`)),1)])):(l(),d(`div`,at,[(l(!0),d(p,null,s(e.voices,e=>(l(),t(v,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]))])])}var st=o({name:`FishModelIndex`,components:{ModelConfigPanel:Fe,Layout:A,ModelListPanel:C(Xe,[[`render`,ot],[`__scopeId`,`data-v-4aab2294`]]),TabSwitcher:M},inject:[`initialized`],data(){return{loading:!1}},computed:{credential(){return this.$store.state.fish?.credential}},watch:{initialized:{async handler(e){e&&await this.onGetVoices()},immediate:!0}},async mounted(){await this.onGetService()},methods:{async onGetService(){await this.$store.dispatch(`fish/getService`)},async onGetVoices(){await this.$store.dispatch(`fish/getVoices`)},async onCreate(e){let t=this.credential?.token;if(!t){console.error(`no token specified`);return}this.loading=!0,D.info(this.$t(`fish.message.creatingModel`));try{await te.createModel(e,{token:t}),D.success(this.$t(`fish.message.createModelSuccess`)),await this.onGetVoices()}catch(e){let t=e?.response?.data;t?.error?.code===`used_up`?D.error(this.$t(`fish.message.usedUp`)):D.error(t?.error?.message||this.$t(`fish.message.createModelFailed`))}finally{this.loading=!1}}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 min-h-0`};function ut(e,r,a,o,s,c){let d=u(`tab-switcher`),p=u(`model-config-panel`),m=u(`model-list-panel`),h=u(`layout`);return l(),t(h,null,{config:f(()=>[n(`div`,ct,[i(d),n(`div`,lt,[i(p,{onCreate:e.onCreate},null,8,[`onCreate`])])])]),result:f(()=>[i(m,{loading:e.loading},null,8,[`loading`])]),_:1})}var dt=C(st,[[`render`,ut]]);export{dt as default};
|
|
1
|
+
import"./rolldown-runtime--c01j_DQ.js";import{Bt as e,D as t,E as n,M as r,N as i,O as a,P as o,Q as s,Ut as c,X as l,et as u,k as d,lt as f,x as p,y as m}from"./vendor-chart-mdwpew_o.js";import{t as h}from"./button-DWzbdjZV.js";import{t as g}from"./upload-CgRMUkQi.js";import{t as _}from"./image-CjzS-up0.js";import{t as v}from"./alert-BJj7gY4q.js";import{n as y,r as b}from"./radio-IJQsW93X.js";import{t as x}from"./switch-Dir3SgN_.js";import{t as S}from"./vendor-axios-Ck2ffRoh.js";import"./constants-C-bSXdJ_.js";import{E as C,Ir as w,J as T,Sr as E,kr as D,kt as ee,qt as te}from"./index-BY8YIwDb.js";import{t as O}from"./index.es-CH5vwGaN.js";import{t as k}from"./CopyToClipboard-C8gyDUMn.js";import{t as A}from"./Hailuo-y5ZOpsGB.js";import{t as j}from"./BotPlaceholder-BVXWzbpi.js";import{t as M}from"./TabSwitcher-BRab7qRM.js";var N=4,P=90,F=o({name:`FishRecorder`,components:{ElButton:h,FontAwesomeIcon:O},emits:[`done`,`cancel`,`update:script`],data(){return{state:`idle`,scriptIndex:0,seconds:0,timerId:0,maxTimerId:0,mediaRecorder:null,stream:null,chunks:[],recordedBlob:null,recordedUrl:``,uploading:!1}},computed:{formattedTime(){let e=Math.floor(this.seconds/60),t=this.seconds%60;return`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`},currentScript(){let e=`fish.script.passage${this.scriptIndex%N+1}`;return this.$t(e)}},beforeUnmount(){this.cleanup()},mounted(){this.$emit(`update:script`,this.currentScript)},methods:{nextScript(){this.scriptIndex=(this.scriptIndex+1)%N,this.$emit(`update:script`,this.currentScript)},async startRecord(){if(!navigator.mediaDevices?.getUserMedia||typeof MediaRecorder>`u`){D.error(this.$t(`fish.message.recorderUnsupported`));return}try{this.stream=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`;D.error(this.$t(t?`fish.message.micDenied`:`fish.message.micError`));return}this.chunks=[];let e=this.pickMimeType();try{this.mediaRecorder=e?new MediaRecorder(this.stream,{mimeType:e}):new MediaRecorder(this.stream)}catch{this.mediaRecorder=new MediaRecorder(this.stream)}this.mediaRecorder.ondataavailable=e=>{e.data&&e.data.size>0&&this.chunks.push(e.data)},this.mediaRecorder.onstop=()=>{let e=new Blob(this.chunks,{type:this.mediaRecorder?.mimeType||`audio/webm`});this.recordedBlob=e,this.recordedUrl=URL.createObjectURL(e),this.state=`recorded`,this.releaseStream()},this.mediaRecorder.start(),this.state=`recording`,this.seconds=0,this.timerId=window.setInterval(()=>{this.seconds++},1e3),this.maxTimerId=window.setTimeout(()=>{this.state===`recording`&&this.stopRecord()},P*1e3)},stopRecord(){this.mediaRecorder&&this.mediaRecorder.state!==`inactive`&&this.mediaRecorder.stop(),window.clearInterval(this.timerId),window.clearTimeout(this.maxTimerId)},reset(){this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl),this.recordedUrl=``,this.recordedBlob=null,this.state=`idle`,this.seconds=0},onCancel(){this.cleanup(),this.$emit(`cancel`)},cleanup(){this.stopRecord(),this.releaseStream(),this.recordedUrl&&URL.revokeObjectURL(this.recordedUrl)},releaseStream(){this.stream?.getTracks().forEach(e=>e.stop()),this.stream=null},pickMimeType(){for(let e of[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/ogg`])if(typeof MediaRecorder<`u`&&MediaRecorder.isTypeSupported?.(e))return e},extensionForMime(e){return e.includes(`webm`)?`webm`:e.includes(`mp4`)?`m4a`:e.includes(`ogg`)?`ogg`:e.includes(`wav`)?`wav`:`mp3`},async useRecording(){if(this.recordedBlob){if(this.seconds<3){D.warning(this.$t(`fish.message.recordingTooShort`));return}this.uploading=!0;try{let e=this.$store.state.token?.access,t=this.extensionForMime(this.recordedBlob.type||``),n=new File([this.recordedBlob],`recording-${Date.now()}.${t}`,{type:this.recordedBlob.type||`audio/webm`}),r=new FormData;r.append(`file`,n);let{data:i}=await S.post(`${E()}/api/v1/files/`,r,{headers:{Authorization:`Bearer ${e}`}}),a=i?.file_url;if(!a){D.error(this.$t(`fish.message.uploadError`));return}this.$emit(`done`,{url:a,text:this.currentScript})}catch(e){D.error(this.$t(`fish.message.uploadError`)),console.error(`recorder upload failed`,e)}finally{this.uploading=!1}}}}}),I={class:`recorder`},L={key:0,class:`script`},R={class:`script-header`},z={class:`label`},B={class:`script-text`},V={class:`controls`},H={class:`status`},U={class:`hint`},W={key:1,class:`preview`},G=[`src`],K={class:`preview-actions`},q={class:`footer`};function J(o,s,p,m,h,g){let _=u(`font-awesome-icon`),v=u(`el-button`);return l(),d(`div`,I,[o.state===`recorded`?a(``,!0):(l(),d(`div`,L,[n(`div`,R,[i(_,{icon:`fa-solid fa-book-open`,class:`icon mr-1`}),n(`span`,z,c(o.$t(`fish.description.readScript`)),1),i(v,{link:``,size:`small`,class:`ml-auto`,disabled:o.state===`recording`,onClick:o.nextScript},{default:f(()=>[i(_,{icon:`fa-solid fa-shuffle`,class:`mr-1`}),r(` `+c(o.$t(`fish.button.nextScript`)),1)]),_:1},8,[`disabled`,`onClick`])]),n(`p`,B,c(o.currentScript),1)])),n(`div`,V,[o.state===`idle`?(l(),t(v,{key:0,type:`danger`,circle:``,size:`large`,title:o.$t(`fish.button.startRecord`),onClick:o.startRecord},{default:f(()=>[i(_,{icon:`fa-solid fa-microphone`})]),_:1},8,[`title`,`onClick`])):o.state===`recording`?(l(),t(v,{key:1,type:`warning`,circle:``,size:`large`,title:o.$t(`fish.button.stopRecord`),onClick:o.stopRecord},{default:f(()=>[i(_,{icon:`fa-solid fa-stop`})]),_:1},8,[`title`,`onClick`])):a(``,!0),n(`div`,H,[n(`span`,{class:e([`timer`,o.state===`recording`?`live`:``])},c(o.formattedTime),3),n(`span`,U,c(o.state===`idle`?o.$t(`fish.description.recorderIdle`):o.state===`recording`?o.$t(`fish.description.recorderRecording`):o.$t(`fish.description.recorderRecorded`)),1)])]),o.state===`recorded`&&o.recordedUrl?(l(),d(`div`,W,[n(`audio`,{src:o.recordedUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,G),n(`div`,K,[i(v,{size:`small`,disabled:o.uploading,onClick:o.reset},{default:f(()=>[i(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+c(o.$t(`fish.button.reRecord`)),1)]),_:1},8,[`disabled`,`onClick`]),i(v,{size:`small`,type:`primary`,loading:o.uploading,onClick:o.useRecording},{default:f(()=>[i(_,{icon:`fa-solid fa-check`,class:`mr-1`}),r(` `+c(o.$t(`fish.button.useRecording`)),1)]),_:1},8,[`loading`,`onClick`])])])):a(``,!0),n(`div`,q,[i(v,{link:``,size:`small`,disabled:o.uploading||o.state===`recording`,onClick:o.onCancel},{default:f(()=>[r(c(o.$t(`fish.button.cancel`)),1)]),_:1},8,[`disabled`,`onClick`])])])}var Y=C(F,[[`render`,J],[`__scopeId`,`data-v-1958e4a1`]]),X=50*1024*1024,Z=()=>({title:``,description:``,texts:``,voicesUrl:``,visibility:`unlist`,trainMode:`fast`,enhanceAudio:!0,generateSample:!1}),Q=o({name:`FishModelConfigPanel`,components:{ElButton:h,ElInput:w,ElRadioButton:y,ElRadioGroup:b,ElSwitch:x,ElUpload:g,FontAwesomeIcon:O,Recorder:Y},mixins:[ee],emits:[`create`],data(){return{form:Z(),fileList:[],uploading:!1,creating:!1,recording:!1,textsAuto:!0}},computed:{uploadUrl(){return E()+`/api/v1/files/`},uploadHeaders(){return{Authorization:`Bearer ${this.$store.state.token?.access}`}},canCreate(){return!!this.form.title.trim()&&!!this.form.voicesUrl&&!this.uploading&&!this.creating},supportsRecorder(){return!!(typeof navigator<`u`?navigator.mediaDevices:void 0)?.getUserMedia&&typeof MediaRecorder<`u`}},methods:{onBeforeUpload(e){return e.size>X?(D.warning(this.$t(`fish.message.audioSizeExceed`)),!1):(this.uploading=!0,!0)},onExceed(){D.warning(this.$t(`fish.message.audioOnlyOne`))},onUploadError(){this.uploading=!1,D.error(this.$t(`fish.message.uploadError`))},onUploadSuccess(e,t,n){this.uploading=!1;let r=e?.file_url;if(!r){D.error(this.$t(`fish.message.uploadError`)),this.fileList=[];return}this.form.voicesUrl=r,this.fileList=n},onRecorded(e){this.form.voicesUrl=e.url,this.recording=!1,e.text&&this.textsAuto&&(this.form.texts=e.text)},onStartRecord(){this.recording=!0,this.textsAuto=!this.form.texts.trim()},onScriptChange(e){this.textsAuto&&this.recording&&(this.form.texts=e)},onTextsInput(){this.textsAuto=!1},clearAudio(){this.form.voicesUrl=``,this.fileList=[]},onCreate(){let e=this.form.title.trim();if(!e){D.warning(this.$t(`fish.message.titleRequired`));return}if(!this.form.voicesUrl){D.warning(this.$t(`fish.message.audioRequired`));return}let t={title:e,voices:this.form.voicesUrl,visibility:this.form.visibility,train_mode:this.form.trainMode,enhance_audio_quality:this.form.enhanceAudio,generate_sample:this.form.generateSample};this.form.description.trim()&&(t.description=this.form.description.trim()),this.form.texts.trim()&&(t.texts=[this.form.texts.trim()]),this.creating=!0,this.$emit(`create`,t),setTimeout(()=>{this.creating=!1,this.form=Z(),this.fileList=[]},600)}}}),ne={class:`flex flex-col h-full`},re={class:`flex-1 overflow-y-auto p-5`},ie={class:`field-block mb-4`},ae={class:`title font-bold`},oe={class:`field-block mb-4`},se={class:`flex items-baseline justify-between mb-1`},ce={class:`title font-bold`},le={key:0,class:`muted`},ue={class:`hint`},de={key:0,class:`audio-actions`},fe={key:1,class:`hint warn`},pe={key:3,class:`mt-2`},me=[`src`],he={class:`ready-actions`},ge={class:`field-block mb-4`},_e={class:`title font-bold`},ve={class:`hint`},ye={class:`field-block mb-4`},be={class:`title font-bold`},xe={class:`field-block mb-4`},Se={class:`title font-bold`},Ce={class:`field-block mb-4`},we={class:`title font-bold`},Te={class:`field-block mb-3`},Ee={class:`field-row`},De={class:`title font-bold`},Oe={class:`hint mt-0 mb-0`},ke={class:`field-block mb-2`},Ae={class:`field-row`},je={class:`title font-bold`},Me={class:`hint mt-0 mb-0`},Ne={class:`flex flex-col items-center justify-center px-5 pb-5`};function Pe(e,o,s,p,m,h){let g=u(`el-input`),_=u(`font-awesome-icon`),v=u(`el-button`),y=u(`el-upload`),b=u(`recorder`),x=u(`el-radio-button`),S=u(`el-radio-group`),C=u(`el-switch`);return l(),d(`div`,ne,[n(`div`,re,[n(`div`,ie,[n(`h2`,ae,[r(c(e.$t(`fish.name.voiceTitle`))+` `,1),o[9]||=n(`span`,{class:`required`},`*`,-1)]),i(g,{modelValue:e.form.title,"onUpdate:modelValue":o[0]||=t=>e.form.title=t,placeholder:e.$t(`fish.placeholder.voiceTitle`),maxlength:`60`},null,8,[`modelValue`,`placeholder`])]),n(`div`,oe,[n(`div`,se,[n(`h2`,ce,[r(c(e.$t(`fish.name.referenceAudio`))+` `,1),o[10]||=n(`span`,{class:`required`},`*`,-1)]),!e.form.voicesUrl&&!e.recording?(l(),d(`span`,le,c(e.$t(`fish.description.audioRequired`)),1)):a(``,!0)]),n(`p`,ue,c(e.$t(`fish.description.uploadAudio`)),1),!e.form.voicesUrl&&!e.recording?(l(),d(`div`,de,[i(y,{"file-list":e.fileList,"onUpdate:fileList":o[1]||=t=>e.fileList=t,name:`file`,limit:1,class:`upload-wrapper`,action:e.uploadUrl,accept:`.mp3,.wav,.m4a,.ogg,.webm,audio/*`,"show-file-list":!1,"on-exceed":e.onExceed,"on-error":e.onUploadError,"on-success":e.onUploadSuccess,"before-upload":e.onBeforeUpload,headers:e.uploadHeaders},{default:f(()=>[i(v,{type:`primary`,plain:``,round:``,loading:e.uploading},{default:f(()=>[i(_,{icon:`fa-solid fa-upload`,class:`icon mr-1`}),r(` `+c(e.$t(`fish.button.uploadAudio`)),1)]),_:1},8,[`loading`])]),_:1},8,[`file-list`,`action`,`on-exceed`,`on-error`,`on-success`,`before-upload`,`headers`]),i(v,{type:`primary`,round:``,disabled:!e.supportsRecorder,onClick:e.onStartRecord},{default:f(()=>[i(_,{icon:`fa-solid fa-microphone`,class:`icon mr-1`}),r(` `+c(e.$t(`fish.button.recordAudio`)),1)]),_:1},8,[`disabled`,`onClick`])])):a(``,!0),!e.supportsRecorder&&!e.form.voicesUrl&&!e.recording?(l(),d(`p`,fe,c(e.$t(`fish.message.recorderUnsupported`)),1)):a(``,!0),e.recording?(l(),t(b,{key:2,class:`mt-2`,onDone:e.onRecorded,onCancel:o[2]||=t=>e.recording=!1,"onUpdate:script":e.onScriptChange},null,8,[`onDone`,`onUpdate:script`])):a(``,!0),e.form.voicesUrl&&!e.recording?(l(),d(`div`,pe,[n(`audio`,{src:e.form.voicesUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,me),n(`div`,he,[i(v,{link:``,size:`small`,onClick:e.clearAudio},{default:f(()=>[i(_,{icon:`fa-solid fa-rotate-left`,class:`mr-1`}),r(` `+c(e.$t(`fish.button.replaceAudio`)),1)]),_:1},8,[`onClick`])])])):a(``,!0)]),n(`div`,ge,[n(`h2`,_e,c(e.$t(`fish.name.audioTexts`)),1),n(`p`,ve,c(e.$t(`fish.description.audioTexts`)),1),i(g,{modelValue:e.form.texts,"onUpdate:modelValue":o[3]||=t=>e.form.texts=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.audioTexts`),maxlength:`500`,onInput:e.onTextsInput},null,8,[`modelValue`,`placeholder`,`onInput`])]),n(`div`,ye,[n(`h2`,be,c(e.$t(`fish.name.voiceDescription`)),1),i(g,{modelValue:e.form.description,"onUpdate:modelValue":o[4]||=t=>e.form.description=t,type:`textarea`,rows:2,placeholder:e.$t(`fish.placeholder.voiceDescription`),maxlength:`500`},null,8,[`modelValue`,`placeholder`])]),n(`div`,xe,[n(`h2`,Se,c(e.$t(`fish.name.visibility`)),1),i(S,{modelValue:e.form.visibility,"onUpdate:modelValue":o[5]||=t=>e.form.visibility=t,size:`small`},{default:f(()=>[i(x,{label:`private`,value:`private`},{default:f(()=>[r(c(e.$t(`fish.value.private`)),1)]),_:1}),i(x,{label:`unlist`,value:`unlist`},{default:f(()=>[r(c(e.$t(`fish.value.unlist`)),1)]),_:1}),i(x,{label:`public`,value:`public`},{default:f(()=>[r(c(e.$t(`fish.value.public`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Ce,[n(`h2`,we,c(e.$t(`fish.name.trainMode`)),1),i(S,{modelValue:e.form.trainMode,"onUpdate:modelValue":o[6]||=t=>e.form.trainMode=t,size:`small`},{default:f(()=>[i(x,{label:`fast`,value:`fast`},{default:f(()=>[r(c(e.$t(`fish.value.trainModeFast`)),1)]),_:1}),i(x,{label:`precise`,value:`precise`},{default:f(()=>[r(c(e.$t(`fish.value.trainModePrecise`)),1)]),_:1})]),_:1},8,[`modelValue`])]),n(`div`,Te,[n(`div`,Ee,[n(`h2`,De,c(e.$t(`fish.name.enhanceAudio`)),1),i(C,{modelValue:e.form.enhanceAudio,"onUpdate:modelValue":o[7]||=t=>e.form.enhanceAudio=t},null,8,[`modelValue`])]),n(`p`,Oe,c(e.$t(`fish.description.enhanceAudio`)),1)]),n(`div`,ke,[n(`div`,Ae,[n(`h2`,je,c(e.$t(`fish.name.generateSample`)),1),i(C,{modelValue:e.form.generateSample,"onUpdate:modelValue":o[8]||=t=>e.form.generateSample=t},null,8,[`modelValue`])]),n(`p`,Me,c(e.$t(`fish.description.generateSample`)),1)])]),n(`div`,Ne,[i(v,{type:`primary`,class:`btn w-full`,round:``,disabled:!e.canCreate||e.creating,loading:e.creating,onClick:e.onCreate},{default:f(()=>[i(_,{icon:`fa-solid fa-magic`,class:`mr-2`}),r(` `+c(e.$t(`fish.button.createModel`)),1)]),_:1},8,[`disabled`,`loading`,`onClick`])])])}var Fe=C(Q,[[`render`,Pe],[`__scopeId`,`data-v-d8fc0e55`]]),Ie=o({name:`FishVoiceCard`,components:{ElAlert:v,ElButton:h,ElImage:_,CopyToClipboard:k,FontAwesomeIcon:O},props:{modelValue:{type:Object,required:!0}},computed:{sampleAudioUrl(){let e=this.modelValue?.samples;if(e?.length)return e[0]?.audio},voiceId(){let e=this.modelValue;return(e?.id||e?._id||e?.reference_id||``).toString()},coverSrc(){let e=this.modelValue?.cover_image;return e&&typeof e==`string`?e:void 0},createdAtLabel(){let e=this.modelValue?.created_at;if(e==null||e===``)return null;let t=typeof e==`number`?e:parseFloat(String(e));return!Number.isFinite(t)||t<=0?null:this.$dayjs.format(``+new Date(t*1e3))}},methods:{onUseVoice(){let e=this.voiceId;e&&(this.$store.commit(`fish/setConfig`,{...this.$store.state.fish?.config,reference_id:e}),this.$router.push({name:T}))}}}),Le={class:`card`},Re={class:`left`},ze={class:`main`},Be={class:`header`},Ve={class:`title`},He={key:0,class:`datetime`},Ue={key:0,class:`description`},We={key:1,class:`sample mt-2`},Ge=[`src`],Ke={key:0,class:`text-[var(--el-text-color-regular)] text-xs mb-2`},qe={key:1,class:`text-[var(--el-text-color-regular)] text-xs mb-0`},Je={class:`operations mt-2`};function Ye(e,o,s,p,h,g){let _=u(`el-image`),v=u(`font-awesome-icon`),y=u(`copy-to-clipboard`),b=u(`el-alert`),x=u(`el-button`);return l(),d(`div`,Le,[n(`div`,Re,[e.coverSrc?(l(),t(_,{key:0,src:e.coverSrc,class:`cover`,fit:`cover`},{error:f(()=>[i(_,{src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`})]),placeholder:f(()=>[...o[0]||=[n(`div`,{class:`cover placeholder`},null,-1)]]),_:1},8,[`src`])):(l(),t(_,{key:1,src:`https://cdn.acedata.cloud/e40fccc727.png`,class:`cover fallback`,fit:`cover`}))]),n(`div`,ze,[n(`div`,Be,[n(`span`,Ve,c(e.modelValue?.title||e.$t(`fish.name.untitledVoice`)),1),e.createdAtLabel?(l(),d(`span`,He,c(e.createdAtLabel),1)):a(``,!0)]),e.modelValue?.description?(l(),d(`p`,Ue,c(e.modelValue?.description),1)):a(``,!0),e.sampleAudioUrl?(l(),d(`div`,We,[n(`audio`,{src:e.sampleAudioUrl,controls:``,preload:`metadata`,class:`w-full`},null,8,Ge)])):a(``,!0),i(b,{closable:!1,class:`mt-2 success`},{default:f(()=>[e.voiceId?(l(),d(`p`,Ke,[i(v,{icon:`fa-solid fa-microphone`,class:`mr-1`}),r(` `+c(e.$t(`fish.name.referenceId`))+`: `+c(e.voiceId)+` `,1),i(y,{content:e.voiceId},null,8,[`content`])])):a(``,!0),e.modelValue?.visibility?(l(),d(`p`,qe,[i(v,{icon:`fa-solid fa-eye`,class:`mr-1`}),r(` `+c(e.$t(`fish.name.visibility`))+`: `+c(e.modelValue?.visibility),1)])):a(``,!0)]),_:1}),n(`div`,Je,[i(x,{type:`primary`,size:`small`,plain:``,disabled:!e.voiceId,onClick:m(e.onUseVoice,[`stop`])},{default:f(()=>[i(v,{icon:`fa-solid fa-volume-high`,class:`mr-1`}),r(` `+c(e.$t(`fish.button.useVoice`)),1)]),_:1},8,[`disabled`,`onClick`])])])])}var Xe=o({name:`FishModelListPanel`,components:{VoiceCard:C(Ie,[[`render`,Ye],[`__scopeId`,`data-v-629e2d04`]]),BotPlaceholder:j,FontAwesomeIcon:O},props:{loading:{type:Boolean,default:!1}},computed:{voices(){return this.$store.state.fish?.voices}}}),Ze={class:`model-list-panel flex flex-col h-full`},Qe={class:`header`},$e={class:`title`},et={key:0,class:`count`},tt={class:`body flex-1 min-h-0`},$={key:0,class:`h-full`},nt={key:1,class:`w-full h-full flex flex-col items-center justify-center text-center px-6`},rt={class:`empty-title`},it={class:`empty-hint`},at={key:2,class:`w-full h-full overflow-y-auto pr-1`};function ot(e,r,o,f,m,h){let g=u(`bot-placeholder`),_=u(`font-awesome-icon`),v=u(`voice-card`);return l(),d(`div`,Ze,[n(`header`,Qe,[n(`h2`,$e,c(e.$t(`fish.title.myVoices`)),1),e.voices?.length?(l(),d(`span`,et,c(e.voices?.length),1)):a(``,!0)]),n(`div`,tt,[e.voices===void 0?(l(),d(`div`,$,[i(g)])):e.voices.length===0?(l(),d(`div`,nt,[i(_,{icon:`fa-solid fa-microphone-lines`,class:`empty-icon`}),n(`p`,rt,c(e.$t(`fish.title.noVoicesYet`)),1),n(`p`,it,c(e.$t(`fish.description.noVoicesYet`)),1)])):(l(),d(`div`,at,[(l(!0),d(p,null,s(e.voices,e=>(l(),t(v,{key:e.id,"model-value":e},null,8,[`model-value`]))),128))]))])])}var st=o({name:`FishModelIndex`,components:{ModelConfigPanel:Fe,Layout:A,ModelListPanel:C(Xe,[[`render`,ot],[`__scopeId`,`data-v-4aab2294`]]),TabSwitcher:M},inject:[`initialized`],data(){return{loading:!1}},computed:{credential(){return this.$store.state.fish?.credential}},watch:{initialized:{async handler(e){e&&await this.onGetVoices()},immediate:!0}},async mounted(){await this.onGetService()},methods:{async onGetService(){await this.$store.dispatch(`fish/getService`)},async onGetVoices(){await this.$store.dispatch(`fish/getVoices`)},async onCreate(e){let t=this.credential?.token;if(!t){console.error(`no token specified`);return}this.loading=!0,D.info(this.$t(`fish.message.creatingModel`));try{await te.createModel(e,{token:t}),D.success(this.$t(`fish.message.createModelSuccess`)),await this.onGetVoices()}catch(e){let t=e?.response?.data;t?.error?.code===`used_up`?D.error(this.$t(`fish.message.usedUp`)):D.error(t?.error?.message||this.$t(`fish.message.createModelFailed`))}finally{this.loading=!1}}}}),ct={class:`flex flex-col h-full`},lt={class:`flex-1 min-h-0`};function ut(e,r,a,o,s,c){let d=u(`tab-switcher`),p=u(`model-config-panel`),m=u(`model-list-panel`),h=u(`layout`);return l(),t(h,null,{config:f(()=>[n(`div`,ct,[i(d),n(`div`,lt,[i(p,{onCreate:e.onCreate},null,8,[`onCreate`])])])]),result:f(()=>[i(m,{loading:e.loading},null,8,[`loading`])]),_:1})}var dt=C(st,[[`render`,ut]]);export{dt as default};
|