f7cloud_client/apps/assistant/js/assistant-fileActions.mjs
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

10 lines
7.3 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('assistant', '', 'js/index-Ds-TrDn_.chunk.mjs'),window.OC.filePath('assistant', '', 'js/index-D953jVe0.chunk.mjs'),window.OC.filePath('assistant', '', 'js/index-DhgIrZpo.chunk.mjs'),window.OC.filePath('assistant', '', 'js/index-Dk4MzVw6.chunk.mjs'),window.OC.filePath('assistant', '', 'js/runtime-dom.esm-bundler-Dyqpejx9.chunk.mjs'),window.OC.filePath('assistant', '', 'js/index-CYie652Q.chunk.mjs'),window.OC.filePath('assistant', '', 'js/index-0D_mItKm.chunk.mjs'),window.OC.filePath('assistant', '', 'js/index-B7npabGH.chunk.mjs')])))=>i.map(i=>d[i]);
import{_ as c}from"./index-D953jVe0.chunk.mjs";import{F as h,P as d,b as p,r as v}from"./index-BYewGXp2.chunk.mjs";import{l as w}from"./index-CYie652Q.chunk.mjs";import{C as E}from"./creation-CfmEXXjo.chunk.mjs";import{V as q,a as I}from"./constants-HI3vTFfS.chunk.mjs";import"./index-B7npabGH.chunk.mjs";const A='<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M309-615q15.4 0 25.7-10.3Q345-635.6 345-651q0-15.4-10.3-25.7Q324.4-687 309-687q-15.4 0-25.7 10.3Q273-666.4 273-651q0 15.4 10.3 25.7Q293.6-615 309-615Zm0 171q15.4 0 25.7-10.3Q345-464.6 345-480q0-15.4-10.3-25.7Q324.4-516 309-516q-15.4 0-25.7 10.3Q273-495.4 273-480q0 15.4 10.3 25.7Q293.6-444 309-444Zm0 171q15.4 0 25.7-10.3Q345-293.6 345-309q0-15.4-10.3-25.7Q324.4-345 309-345q-15.4 0-25.7 10.3Q273-324.4 273-309q0 15.4 10.3 25.7Q293.6-273 309-273ZM189-95q-39.05 0-66.53-27.47Q95-149.95 95-189v-582q0-39.46 27.47-67.23Q149.95-866 189-866h453l224 224v453q0 39.05-27.77 66.53Q810.46-95 771-95H189Zm0-94h582v-398.57H588V-771H189v582Zm0-582v183.43V-771v582-582Z"/></svg>',Q='<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M140-46q-38.8 0-66.4-27.6Q46-101.2 46-140v-680q0-39.21 27.6-67.11Q101.2-915 140-915h359l-95 95H140v680h463v-110h94v110q0 38.75-27.6 66.37Q641.8-46 603-46H140Zm100-204v-60h280v60H240Zm0-120v-60h200v60H240Zm421 51L476-503H326v-217h150l185-184v585Zm60-121v-347q61 19 96.5 74T853-608.5q0 49.5-38.5 102.5T721-440Zm0 176v-97q76-22 134-91.5T913-609q0-87-55-155t-137-92v-97q129 33 208 129.5t79 215q0 118.5-82 218.5T721-264Z"/></svg>',T='<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M690.15-568q-29.15 0-50.65-21.07Q618-610.15 618-640v-160q0-30.28 21.18-51.14T690.11-872Q720-872 741-850.93q21 21.08 21 50.93v160q0 30.28-20.91 51.14Q720.19-568 690.15-568ZM180-46q-38.78 0-66.39-27.61T86-140v-680q0-39.19 27.61-67.09Q141.22-915 180-915h340v95H180v680h463v-100h94v100q0 38.78-27.61 66.39Q681.77-46 643-46H180Zm100-194v-70h280v70H280Zm0-130v-60h200v60H280Zm457 57h-94v-115q-76-16-128-74.2-52-58.21-52-137.8h80q0 58 43.59 97.5T689.58-503Q750-503 794-542.43T838-640h80q0 79.6-52 137.8-52 58.2-129 74.49V-313Z"/></svg>',_=["trashbin","files.public"];function b(n){const s=new h({id:"assistant-group",displayName:i=>t("assistant","AI Assistant"),enabled(i,e){return!_.includes(e.id)&&i.length===1&&!i.some(({permissions:r})=>(r&d.READ)===0)&&i.every(({type:r})=>r===p.File)&&i.every(({mime:r})=>n.includes(r))},iconSvgInline:()=>E,order:0,async exec(){return null}});v(s)}function O(){const n=new h({id:"assistant-summarize",parent:"assistant-group",displayName:s=>t("approval","Summarize using AI"),enabled(s,i){return!_.includes(i.id)&&s.length===1&&!s.some(({permissions:e})=>(e&d.READ)===0)&&s.every(({type:e})=>e===p.File)&&s.every(({mime:e})=>q.includes(e))},iconSvgInline:()=>A,order:0,async exec(s){const{default:i}=await c(async()=>{const{default:a}=await import("./index-Ds-TrDn_.chunk.mjs");return{default:a}},__vite__mapDeps([0,1]),import.meta.url),{generateOcsUrl:e}=await c(async()=>{const{generateOcsUrl:a}=await import("./index-D953jVe0.chunk.mjs").then(o=>o.z);return{generateOcsUrl:a}},[],import.meta.url),{showError:r,showSuccess:l}=await c(async()=>{const{showError:a,showSuccess:o}=await import("./index-DhgIrZpo.chunk.mjs").then(m=>m.r);return{showError:a,showSuccess:o}},__vite__mapDeps([2,1,3,4,0,5,6,7]),import.meta.url),u=e("/apps/assistant/api/v1/file-action/{fileId}/core:text2text:summary",{fileId:s.fileid});try{await i.post(u),l(t("assistant","Summarization AI task submitted successfully.")+`
`+t("assistant","You will be notified when it is ready.")+`
`+t("assistant",'It can also be checked in the Assistant in the "Work with text -> Summarize" menu.'))}catch(a){console.error(a),r(t("assistant","Failed to launch the AI file action"))}return null}});v(n)}function S(){const n=new h({id:"assistant-tts",parent:"assistant-group",displayName:s=>t("assistant","Text-To-Speech using AI"),enabled(s,i){return!_.includes(i.id)&&s.length===1&&!s.some(({permissions:e})=>(e&d.READ)===0)&&s.every(({type:e})=>e===p.File)&&s.every(({mime:e})=>q.includes(e))},iconSvgInline:()=>Q,order:0,async exec(s){const{default:i}=await c(async()=>{const{default:a}=await import("./index-Ds-TrDn_.chunk.mjs");return{default:a}},__vite__mapDeps([0,1]),import.meta.url),{generateOcsUrl:e}=await c(async()=>{const{generateOcsUrl:a}=await import("./index-D953jVe0.chunk.mjs").then(o=>o.z);return{generateOcsUrl:a}},[],import.meta.url),{showError:r,showSuccess:l}=await c(async()=>{const{showError:a,showSuccess:o}=await import("./index-DhgIrZpo.chunk.mjs").then(m=>m.r);return{showError:a,showSuccess:o}},__vite__mapDeps([2,1,3,4,0,5,6,7]),import.meta.url),u=e("/apps/assistant/api/v1/file-action/{fileId}/core:text2speech",{fileId:s.fileid});try{await i.post(u),l(t("assistant","Text-to-Speech AI task submitted successfully.")+`
`+t("assistant","You will be notified when it is ready.")+`
`+t("assistant",'It can also be checked in the Assistant in the "Work with audio -> Generate speech" menu.'))}catch(a){console.error(a),r(t("assistant","Failed to launch the AI file action"))}return null}});v(n)}function x(){const n=new h({id:"assistant-stt",parent:"assistant-group",displayName:s=>t("assistant","Transcribe audio using AI"),enabled(s,i){return!_.includes(i.id)&&s.length===1&&!s.some(({permissions:e})=>(e&d.READ)===0)&&s.every(({type:e})=>e===p.File)&&s.every(({mime:e})=>I.includes(e))},iconSvgInline:()=>T,order:0,async exec(s){const{default:i}=await c(async()=>{const{default:a}=await import("./index-Ds-TrDn_.chunk.mjs");return{default:a}},__vite__mapDeps([0,1]),import.meta.url),{generateOcsUrl:e}=await c(async()=>{const{generateOcsUrl:a}=await import("./index-D953jVe0.chunk.mjs").then(o=>o.z);return{generateOcsUrl:a}},[],import.meta.url),{showError:r,showSuccess:l}=await c(async()=>{const{showError:a,showSuccess:o}=await import("./index-DhgIrZpo.chunk.mjs").then(m=>m.r);return{showError:a,showSuccess:o}},__vite__mapDeps([2,1,3,4,0,5,6,7]),import.meta.url),u=e("/apps/assistant/api/v1/file-action/{fileId}/core:audio2text",{fileId:s.fileid});try{await i.post(u),l(t("assistant","Transcription AI task submitted successfully.")+`
`+t("assistant","You will be notified when it is ready.")+`
`+t("assistant",'It can also be checked in the Assistant in the "Work with audio -> Transcribe audio" menu.'))}catch(a){console.error(a),r(t("assistant","Failed to launch the AI file action"))}return null}});v(n)}const Z=w("assistant","assistant-enabled",!1),f=w("assistant","summarize-available",!1),g=w("assistant","stt-available",!1),y=w("assistant","tts-available",!1);if(Z){if(f||g||y){const n=[];(f||y)&&n.push(...q),g&&n.push(...I),b(n)}g&&x(),f&&O(),y&&S()}
//# sourceMappingURL=assistant-fileActions.mjs.map