4 lines
12 KiB
JavaScript
4 lines
12 KiB
JavaScript
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode("#assistant_prefs[data-v-a70ef319]{max-width:800px}#assistant_prefs .line[data-v-a70ef319],#assistant_prefs .settings-hint[data-v-a70ef319]{display:flex;align-items:center;margin-top:12px}#assistant_prefs .line .icon[data-v-a70ef319],#assistant_prefs .settings-hint .icon[data-v-a70ef319]{margin-right:4px}#assistant_prefs .link-with-icon[data-v-a70ef319]{display:flex;align-items:center;gap:4px}#assistant_prefs .checkbox-text[data-v-a70ef319]{display:flex;flex-direction:column}#assistant_prefs h2[data-v-a70ef319]{justify-content:start;display:flex;align-items:center;gap:8px;margin-top:8px}#assistant_prefs .line>label[data-v-a70ef319]{width:300px;display:flex;align-items:center}#assistant_prefs .line>input[data-v-a70ef319]{width:300px}#assistant_prefs .line .text-field[data-v-a70ef319]{margin-left:8px;width:300px}#assistant_prefs .notecard[data-v-a70ef319],#assistant_prefs .text-field[data-v-a70ef319]{max-width:900px}#assistant_prefs .chat-with-ai[data-v-a70ef319]{display:flex;flex-direction:column}#assistant_prefs .chat-with-ai>.line>label[data-v-a70ef319]{width:900px!important;font-weight:700}")),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
import{a as v,o as h,h as s,k as f,b as l,m as A,r as m,g as o,f as x,j as r,w as c,e as U}from"./runtime-dom.esm-bundler-Dyqpejx9.chunk.mjs";import{_ as I}from"./_plugin-vue_export-helper-RS-qxU5_.chunk.mjs";import{A as L}from"./AssistantIcon-QNp3ITeF.chunk.mjs";import{N as S}from"./NcNoteCard-C6JdnZUp-D73c8eHL.chunk.mjs";import{d as F,b as z,s as O}from"./index-DhgIrZpo.chunk.mjs";import{_ as G}from"./index-Dk4MzVw6.chunk.mjs";import{N as H,a as B,b as M}from"./NcFormGroup-CnSfPFey-Cl1sBjGf.chunk.mjs";import $ from"./index-Ds-TrDn_.chunk.mjs";import{l as R}from"./index-CYie652Q.chunk.mjs";import{a as j}from"./index-D953jVe0.chunk.mjs";import{d as q}from"./utils-RJiw7P1o.chunk.mjs";import"./index-0D_mItKm.chunk.mjs";import"./index-B7npabGH.chunk.mjs";const D={name:"OpenInNewIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},E=["aria-hidden","aria-label"],P=["fill","width","height"],W={d:"M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z"},Z={key:0};function J(a,e,p,g,i,u){return h(),v("span",A(a.$attrs,{"aria-hidden":p.title?null:"true","aria-label":p.title,class:"material-design-icon open-in-new-icon",role:"img",onClick:e[0]||(e[0]=w=>a.$emit("click",w))}),[(h(),v("svg",{fill:p.fillColor,class:"material-design-icon__svg",width:p.size,height:p.size,viewBox:"0 0 24 24"},[s("path",W,[p.title?(h(),v("title",Z,l(p.title),1)):f("",!0)])],8,P))],16,E)}const K=I(D,[["render",J]]),Q={name:"AdminSettings",components:{AssistantIcon:L,NcNoteCard:S,NcRichContenteditable:F,NcTextField:G,NcFormGroup:M,NcFormBox:B,NcFormBoxSwitch:H,OpenInNewIcon:K},data(){return{state:R("assistant","admin-config"),textFieldSaveTimer:null,inputErrorTimer:null,optionsToSave:{}}},computed:{},methods:{isUnsignedIntStr(a){return/^\d+$/.test(a)},onCheckboxChanged(a,e){this.state[e]=a,this.saveOptions({[e]:this.state[e]?"1":"0"})},delayedValueUpdate(a,e){q(()=>{this.optionsToSave[e]=a,this.saveOptions(this.optionsToSave)},2e3)},saveOptions(a){const e={values:a},p=j("/apps/assistant/admin-config");return $.put(p,e).then(()=>{z(t("assistant","Assistant admin options saved"))}).catch(g=>{console.error("Failed to save assistant admin options",g),O(t("assistant","Failed to save assistant admin options")+": "+(g.response?.data?.message??g.response?.request?.responseText))})}}},X={id:"assistant_prefs",class:"section"},Y={href:"https://docs.nextcloud.com/server/latest/admin_manual/ai/index.html",class:"external link-with-icon",target:"_blank"},tt={id:"assistant-content"},et={class:"checkbox-text"},at={href:"https://github.com/nextcloud/llm2#readme",class:"external link-with-icon",target:"_blank"},st={href:"https://apps.nextcloud.com/apps/integration_openai",class:"external link-with-icon",target:"_blank"},nt={class:"checkbox-text"},it={href:"https://github.com/nextcloud/text2image_stablediffusion#readme",class:"external link-with-icon",target:"_blank"},lt={href:"https://apps.nextcloud.com/apps/integration_openai",class:"external link-with-icon",target:"_blank"},ot={class:"checkbox-text"},rt={href:"https://github.com/nextcloud/stt_whisper2#readme",class:"external link-with-icon",target:"_blank"},dt={href:"https://apps.nextcloud.com/apps/integration_openai",class:"external link-with-icon",target:"_blank"},ct={class:"chat-with-ai"},ut={class:"line"},pt={for:"chat_user_instructions"},_t={class:"line"},ht={for:"chat_user_instructions_title"},mt={class:"line"},bt={for:"chat_last_n_messages"};function ft(a,e,p,g,i,u){const w=m("AssistantIcon"),b=m("OpenInNewIcon"),_=m("NcNoteCard"),k=m("NcFormBoxSwitch"),V=m("NcFormBox"),N=m("NcFormGroup"),C=m("NcRichContenteditable"),T=m("NcTextField");return h(),v("div",X,[s("h2",null,[o(w,{class:"icon"}),r(" "+l(a.t("assistant","Nextcloud Assistant")),1)]),o(_,{type:"info"},{default:c(()=>[r(l(a.t("assistant","Find more details on how to set up Assistant and recommended backends in the Administration documentation."))+" ",1),e[13]||(e[13]=s("br",null,null,-1)),s("a",Y,[r(l(a.t("assistant","Administration documentation"))+" ",1),o(b,{size:16})])]),_:1}),i.state.text_to_sticker_available&&!i.state.text_to_image_picker_available?(h(),x(_,{key:0,type:"warning"},{default:c(()=>[r(l(a.t("assistant",'The sticker generation feature won`t work without being able to generate images. Please install and enable a "Generate image" provider or disable the "Generate sticker" task type.')),1)]),_:1})):f("",!0),s("div",tt,[s("div",null,[o(N,{label:a.t("assistant","Select which features you want to enable"),"hide-label":!0,class:"switch-group"},{default:c(()=>[o(V,null,{default:c(()=>[o(k,{"model-value":i.state.assistant_enabled,"onUpdate:modelValue":e[0]||(e[0]=d=>u.onCheckboxChanged(d,"assistant_enabled"))},{default:c(()=>[r(l(a.t("assistant","Nextcloud Assistant in header")),1)]),_:1},8,["model-value"]),o(k,{"model-value":i.state.free_prompt_picker_enabled,disabled:!i.state.free_prompt_task_type_available,"onUpdate:modelValue":e[1]||(e[1]=d=>u.onCheckboxChanged(d,"free_prompt_picker_enabled"))},{default:c(()=>[r(l(a.t("assistant","AI text generation in the smart picker")),1)]),_:1},8,["model-value","disabled"]),o(k,{"model-value":i.state.text_to_image_picker_enabled,disabled:!i.state.text_to_image_picker_available,"onUpdate:modelValue":e[2]||(e[2]=d=>u.onCheckboxChanged(d,"text_to_image_picker_enabled"))},{default:c(()=>[r(l(a.t("assistant","Text-to-image in the smart picker")),1)]),_:1},8,["model-value","disabled"]),o(k,{"model-value":i.state.text_to_sticker_picker_enabled,disabled:!i.state.text_to_image_picker_available,"onUpdate:modelValue":e[3]||(e[3]=d=>u.onCheckboxChanged(d,"text_to_sticker_picker_enabled"))},{default:c(()=>[r(l(a.t("assistant","Text-to-sticker in the smart picker")),1)]),_:1},8,["model-value","disabled"]),o(k,{"model-value":i.state.speech_to_text_picker_enabled,disabled:!i.state.speech_to_text_picker_available,"onUpdate:modelValue":e[4]||(e[4]=d=>u.onCheckboxChanged(d,"speech_to_text_picker_enabled"))},{default:c(()=>[r(l(a.t("assistant","Speech-to-text in the smart picker")),1)]),_:1},8,["model-value","disabled"])]),_:1})]),_:1},8,["label"]),i.state.task_processing_available?f("",!0):(h(),x(_,{key:0,type:"warning"},{default:c(()=>[r(l(a.t("assistant","To be able to use the Assistant, please install at least one AI task processing provider.")),1)]),_:1})),i.state.free_prompt_task_type_available?f("",!0):(h(),x(_,{key:1,type:"warning"},{default:c(()=>[s("div",et,[s("span",null,l(a.t("assistant",'To enable text generation in the smart picker, please install an AI task processing provider for the "Free text to text prompt" task type:')),1),s("ul",null,[s("li",null,[s("a",at,[e[14]||(e[14]=r(" Local Large language model app ",-1)),o(b,{size:16})])]),s("li",null,[s("a",st,[e[15]||(e[15]=r(" OpenAI/LocalAI Integration ",-1)),o(b,{size:16})])])])])]),_:1})),i.state.text_to_image_picker_available?f("",!0):(h(),x(_,{key:2,type:"warning"},{default:c(()=>[s("div",nt,[s("span",null,l(a.t("assistant",'To enable the sticker generation picker or the image generation picker, please install and enable a "Generate image" provider:')),1),s("ul",null,[s("li",null,[s("a",it,[e[16]||(e[16]=r(" Local Text-To-Image StableDiffusion ",-1)),o(b,{size:16})])]),s("li",null,[s("a",lt,[e[17]||(e[17]=r(" OpenAI/LocalAI Integration ",-1)),o(b,{size:16})])])])])]),_:1})),i.state.speech_to_text_picker_available?f("",!0):(h(),x(_,{key:3,type:"warning"},{default:c(()=>[s("div",ot,[s("span",null,l(a.t("assistant",'To enable speech-to-text in the smart picker, please install and enable a "Transcribe audio" provider:')),1),s("ul",null,[s("li",null,[s("a",rt,[e[18]||(e[18]=r(" Local Speech-To-Text Whisper ",-1)),o(b,{size:16})])]),s("li",null,[s("a",dt,[e[19]||(e[19]=r(" OpenAI/LocalAI Integration ",-1)),o(b,{size:16})])])])])]),_:1}))]),s("div",ct,[s("h4",null,l(a.t("assistant","Chat with AI")),1),s("div",ut,[s("label",pt,l(a.t("assistant","Chat User Instructions for Chat Completions")),1)]),o(_,{type:"info"},{default:c(()=>[r(l(a.t("assistant","It is passed on to the LLM for it to better understand the context."))+" ",1),e[20]||(e[20]=s("br",null,null,-1)),r(" "+l(a.t("assistant",`"{user}" is a placeholder for the user's display name.`)),1)]),_:1}),o(C,{id:"chat_user_instructions",modelValue:i.state.chat_user_instructions,"onUpdate:modelValue":[e[5]||(e[5]=d=>i.state.chat_user_instructions=d),e[6]||(e[6]=d=>u.delayedValueUpdate(i.state.chat_user_instructions,"chat_user_instructions"))],class:"text-field","auto-complete":()=>{},"link-auto-complete":!1,placeholder:a.t("assistant","Chat User Instructions for Chat Completions"),"aria-label":a.t("assistant","Chat User Instructions for Chat Completions"),dir:"auto",onSubmit:e[7]||(e[7]=d=>u.delayedValueUpdate(i.state.chat_user_instructions,"chat_user_instructions"))},null,8,["modelValue","placeholder","aria-label"]),s("div",_t,[s("label",ht,l(a.t("assistant","Chat User Instructions for Title Generation")),1)]),o(_,{type:"info"},{default:c(()=>[r(l(a.t("assistant","It is passed on to the LLMs to better generate a chat title"))+" ",1),e[21]||(e[21]=s("br",null,null,-1)),r(" "+l(a.t("assistant",`"{user}" is a placeholder for the user's display name here as well.`)),1)]),_:1}),o(C,{id:"chat_user_instructions_title",modelValue:i.state.chat_user_instructions_title,"onUpdate:modelValue":[e[8]||(e[8]=d=>i.state.chat_user_instructions_title=d),e[9]||(e[9]=d=>u.delayedValueUpdate(i.state.chat_user_instructions_title,"chat_user_instructions_title"))],class:"text-field","auto-complete":()=>{},"link-auto-complete":!1,placeholder:a.t("assistant","Chat User Instructions for Title Generation"),"aria-label":a.t("assistant","Chat User Instructions for Title Generation"),dir:"auto",onSubmit:e[10]||(e[10]=d=>u.delayedValueUpdate(i.state.chat_user_instructions_title,"chat_user_instructions_title"))},null,8,["modelValue","placeholder","aria-label"]),s("div",mt,[s("label",bt,l(a.t("assistant","Last N messages to consider for chat completions")),1)]),o(_,{type:"info"},{default:c(()=>[r(l(a.t("assistant","This includes the user instructions and the LLM's messages")),1)]),_:1}),o(T,{id:"chat_last_n_messages",modelValue:i.state.chat_last_n_messages,"onUpdate:modelValue":[e[11]||(e[11]=d=>i.state.chat_last_n_messages=d),e[12]||(e[12]=d=>u.delayedValueUpdate(i.state.chat_last_n_messages,"chat_last_n_messages"))],type:"number",class:"text-field",error:!u.isUnsignedIntStr(i.state.chat_last_n_messages),title:a.t("assistant","Number of messages to consider for chat completions (excluding the user instructions, which is always considered)")},null,8,["modelValue","error","title"])])])])}const gt=I(Q,[["render",ft],["__scopeId","data-v-a70ef319"]]),y=U(gt);y.mixin({methods:{t,n}}),y.mount("#assistant_prefs");
|
|
//# sourceMappingURL=assistant-adminSettings.mjs.map
|