(()=>{var e,n={52149:(e,n,r)=>{"use strict";var o=r(85471),i=r(65043),a=r(32073),s=r(88837),l=r(67607),c=r(54332),u=r(52201),d=r(432),p=r.n(d);const f={name:"DragVerticalIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var h=r(14486);const g=(0,h.A)(f,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon drag-vertical-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports;var v=r(10620),m=r(41645),b=r(32981),y=r(63814),x=r(96763);const _={name:"AdminAI",components:{NcCheckboxRadioSwitch:a.A,NcSettingsSection:s.A,NcSelect:l.A,draggable:p(),DragVerticalIcon:g,ArrowDownIcon:v.A,ArrowUpIcon:m.A,NcButton:c.A,NcNoteCard:u.A},data:()=>({loading:!1,dirty:!1,groups:[],loadingGroups:!1,sttProviders:(0,b.C)("settings","ai-stt-providers"),translationProviders:(0,b.C)("settings","ai-translation-providers"),textProcessingProviders:(0,b.C)("settings","ai-text-processing-providers"),textProcessingTaskTypes:(0,b.C)("settings","ai-text-processing-task-types"),text2imageProviders:(0,b.C)("settings","ai-text2image-providers"),taskProcessingProviders:(0,b.C)("settings","ai-task-processing-providers"),taskProcessingTaskTypes:(0,b.C)("settings","ai-task-processing-task-types"),settings:(0,b.C)("settings","ai-settings")}),computed:{hasStt(){return this.sttProviders.length>0},hasTextProcessing(){return Object.keys(this.settings["ai.textprocessing_provider_preferences"]).length>0&&Array.isArray(this.textProcessingTaskTypes)},tpTaskTypes(){return Object.keys(this.settings["ai.textprocessing_provider_preferences"]).filter((t=>!!this.getTextProcessingTaskType(t)))},hasText2ImageProviders(){return this.text2imageProviders.length>0},hasTaskProcessing(){return Object.keys(this.settings["ai.taskprocessing_provider_preferences"]).length>0&&Array.isArray(this.taskProcessingTaskTypes)}},methods:{moveUp(t){this.settings["ai.translation_provider_preferences"].splice(Math.min(t-1,0),0,...this.settings["ai.translation_provider_preferences"].splice(t,1)),this.saveChanges()},moveDown(t){this.settings["ai.translation_provider_preferences"].splice(t+1,0,...this.settings["ai.translation_provider_preferences"].splice(t,1)),this.saveChanges()},async saveChanges(){this.loading=!0;const t={settings:this.settings};try{await i.Ay.put((0,y.Jv)("/settings/api/admin/ai"),t)}catch(t){x.error("could not save changes",t)}this.loading=!1},getTextProcessingTaskType(t){return Array.isArray(this.textProcessingTaskTypes)?this.textProcessingTaskTypes.find((e=>e.class===t)):null}}};var w=r(85072),S=r.n(w),C=r(97825),A=r.n(C),T=r(77659),E=r.n(T),k=r(55056),D=r.n(k),O=r(10540),P=r.n(O),N=r(41113),M=r.n(N),I=r(23170),j={};j.styleTagTransform=M(),j.setAttributes=D(),j.insert=E().bind(null,"head"),j.domAPI=A(),j.insertStyleElement=P(),S()(I.A,j),I.A&&I.A.locals&&I.A.locals;const R=(0,h.A)(_,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"ai-settings"},[e("NcSettingsSection",{attrs:{name:t.t("settings","Unified task processing"),description:t.t("settings","AI tasks can be implemented by different apps. Here you can set which app should be used for which task.")}},[t._l(t.taskProcessingTaskTypes,(function(n){return[e("div",{key:n},[e("h3",[t._v(t._s(t.t("settings","Task:"))+" "+t._s(n.name))]),t._v(" "),e("p",[t._v(t._s(n.description))]),t._v(" "),e("p",[t._v(" ")]),t._v(" "),e("NcSelect",{staticClass:"provider-select",attrs:{clearable:!1,options:t.taskProcessingProviders.filter((t=>t.taskType===n.id)).map((t=>t.id))},on:{input:t.saveChanges},scopedSlots:t._u([{key:"option",fn:function(e){var n;let{label:r}=e;return[t._v("\n\t\t\t\t\t\t"+t._s(null===(n=t.taskProcessingProviders.find((t=>t.id===r)))||void 0===n?void 0:n.name)+"\n\t\t\t\t\t")]}},{key:"selected-option",fn:function(e){var n;let{label:r}=e;return[t._v("\n\t\t\t\t\t\t"+t._s(null===(n=t.taskProcessingProviders.find((t=>t.id===r)))||void 0===n?void 0:n.name)+"\n\t\t\t\t\t")]}}],null,!0),model:{value:t.settings["ai.taskprocessing_provider_preferences"][n.id],callback:function(e){t.$set(t.settings["ai.taskprocessing_provider_preferences"],n.id,e)},expression:"settings['ai.taskprocessing_provider_preferences'][type.id]"}}),t._v(" "),e("p",[t._v(" ")])],1)]})),t._v(" "),t.hasTaskProcessing?t._e():[e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t\t"+t._s(t.t("settings","None of your currently installed apps provide Task processing functionality"))+"\n\t\t\t")])]],2),t._v(" "),e("NcSettingsSection",{attrs:{name:t.t("settings","Machine translation"),description:t.t("settings","Machine translation can be implemented by different apps. Here you can define the precedence of the machine translation apps you have installed at the moment.")}},[e("draggable",{on:{change:t.saveChanges},model:{value:t.settings["ai.translation_provider_preferences"],callback:function(e){t.$set(t.settings,"ai.translation_provider_preferences",e)},expression:"settings['ai.translation_provider_preferences']"}},t._l(t.settings["ai.translation_provider_preferences"],(function(n,r){var o;return e("div",{key:n,staticClass:"draggable__item"},[e("DragVerticalIcon"),t._v(" "),e("span",{staticClass:"draggable__number"},[t._v(t._s(r+1))]),t._v(" "+t._s(null===(o=t.translationProviders.find((t=>t.class===n)))||void 0===o?void 0:o.name)+"\n\t\t\t\t"),e("NcButton",{attrs:{"aria-label":"Move up",type:"tertiary"},on:{click:function(e){return t.moveUp(r)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("ArrowUpIcon")]},proxy:!0}],null,!0)}),t._v(" "),e("NcButton",{attrs:{"aria-label":"Move down",type:"tertiary"},on:{click:function(e){return t.moveDown(r)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("ArrowDownIcon")]},proxy:!0}],null,!0)})],1)})),0)],1),t._v(" "),e("NcSettingsSection",{attrs:{name:t.t("settings","Speech-To-Text"),description:t.t("settings","Speech-To-Text can be implemented by different apps. Here you can set which app should be used.")}},[t._l(t.sttProviders,(function(n){return[e("NcCheckboxRadioSwitch",{key:n.class,attrs:{checked:t.settings["ai.stt_provider"],value:n.class,name:"stt_provider",type:"radio"},on:{"update:checked":[function(e){return t.$set(t.settings,"ai.stt_provider",e)},t.saveChanges]}},[t._v("\n\t\t\t\t"+t._s(n.name)+"\n\t\t\t")])]})),t._v(" "),t.hasStt?t._e():[e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t\t"+t._s(t.t("settings","None of your currently installed apps provide Speech-To-Text functionality"))+"\n\t\t\t")])]],2),t._v(" "),e("NcSettingsSection",{attrs:{name:t.t("settings","Image generation"),description:t.t("settings","Image generation can be implemented by different apps. Here you can set which app should be used.")}},[t._l(t.text2imageProviders,(function(n){return[e("NcCheckboxRadioSwitch",{key:n.id,attrs:{checked:t.settings["ai.text2image_provider"],value:n.id,name:"text2image_provider",type:"radio"},on:{"update:checked":[function(e){return t.$set(t.settings,"ai.text2image_provider",e)},t.saveChanges]}},[t._v("\n\t\t\t\t"+t._s(n.name)+"\n\t\t\t")])]})),t._v(" "),t.hasText2ImageProviders?t._e():[e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t\t"+t._s(t.t("settings","None of your currently installed apps provide image generation functionality"))+"\n\t\t\t")])]],2),t._v(" "),e("NcSettingsSection",{attrs:{name:t.t("settings","Text processing"),description:t.t("settings","Text processing tasks can be implemented by different apps. Here you can set which app should be used for which task.")}},[t._l(t.tpTaskTypes,(function(n){return[e("div",{key:n},[e("h3",[t._v(t._s(t.t("settings","Task:"))+" "+t._s(t.getTextProcessingTaskType(n).name))]),t._v(" "),e("p",[t._v(t._s(t.getTextProcessingTaskType(n).description))]),t._v(" "),e("p",[t._v(" ")]),t._v(" "),e("NcSelect",{staticClass:"provider-select",attrs:{clearable:!1,options:t.textProcessingProviders.filter((t=>t.taskType===n)).map((t=>t.class))},on:{input:t.saveChanges},scopedSlots:t._u([{key:"option",fn:function(e){var n;let{label:r}=e;return[t._v("\n\t\t\t\t\t\t"+t._s(null===(n=t.textProcessingProviders.find((t=>t.class===r)))||void 0===n?void 0:n.name)+"\n\t\t\t\t\t")]}},{key:"selected-option",fn:function(e){var n;let{label:r}=e;return[t._v("\n\t\t\t\t\t\t"+t._s(null===(n=t.textProcessingProviders.find((t=>t.class===r)))||void 0===n?void 0:n.name)+"\n\t\t\t\t\t")]}}],null,!0),model:{value:t.settings["ai.textprocessing_provider_preferences"][n],callback:function(e){t.$set(t.settings["ai.textprocessing_provider_preferences"],n,e)},expression:"settings['ai.textprocessing_provider_preferences'][type]"}}),t._v(" "),e("p",[t._v(" ")])],1)]})),t._v(" "),t.hasTextProcessing?t._e():[e("NcNoteCard",{attrs:{type:"info"}},[t._v("\n\t\t\t\t"+t._s(t.t("settings","None of your currently installed apps provide Text processing functionality"))+"\n\t\t\t")])]],2)],1)}),[],!1,null,"d8d94d28",null).exports;r.nc=btoa(OC.requestToken),o.Ay.prototype.t=t,window.OC=window.OC||{},window.OC.Settings=window.OC.Settings||{},(new(o.Ay.extend(R))).$mount("#ai-settings")},23170:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(71354),o=n.n(r),i=n(76314),a=n.n(i)()(o());a.push([t.id,"\n.draggable__item[data-v-d8d94d28] {\n\tmargin-bottom: 5px;\n display: flex;\n align-items: center;\n}\n.draggable__item[data-v-d8d94d28],\n.draggable__item *[data-v-d8d94d28] {\n cursor: grab;\n}\n.draggable__number[data-v-d8d94d28] {\n\tborder-radius: 20px;\n\tborder: 2px solid var(--color-primary-element);\n\tcolor: var(--color-primary-element);\n\tpadding: 0px 7px;\n\tmargin-right: 3px;\n}\n.drag-vertical-icon[data-v-d8d94d28] {\n float: left;\n}\n.ai-settings h3[data-v-d8d94d28] {\n\tfont-size: 16px; /* to offset against the 20px section heading */\n}\n.provider-select[data-v-d8d94d28] {\n\tmin-width: 350px !important;\n}\n","",{version:3,sources:["webpack://./apps/settings/src/components/AdminAI.vue"],names:[],mappings:";AAyNA;CACA,kBAAA;EACA,aAAA;EACA,mBAAA;AACA;AAEA;;EAEA,YAAA;AACA;AAEA;CACA,mBAAA;CACA,8CAAA;CACA,mCAAA;CACA,gBAAA;CACA,iBAAA;AACA;AAEA;EACA,WAAA;AACA;AAEA;CACA,eAAA,EAAA,+CAAA;AACA;AAEA;CACA,2BAAA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n\n