/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */

"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["870"],{5985:function(e,t,n){n.r(t),n.d(t,{AdminSettings:function(){return m}});var r=n(3772),o=n(8156),u=n.n(o),a=n(2721),i=n(3990),s=n(8563),c=n(3505);function l(e,t,n,r,o,u,a){try{var i=e[u](a),s=i.value}catch(e){n(e);return}i.done?t(s):Promise.resolve(s).then(r,o)}var p=function(){var e=(0,r.useAPIClient)(),t=(0,r.useRequest)(function(){return e.resource("aiSettings").get().then(function(e){var t;return null==e||null==(t=e.data)?void 0:t.data})}).data;return{form:(0,o.useMemo)(function(){return(0,s.createForm)({initialValues:t})},[t])}},f=function(){var e=(0,c.useForm)(),t=(0,r.useAPIClient)(),n=a.App.useApp().message,o=(0,i.NT)();return{type:"primary",htmlType:"submit",onClick:function(){var r;return(r=function(){return function(e,t){var n,r,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function i(u){return function(i){var s=[u,i];if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return[4,e.submit()];case 1:return r.sent(),[4,t.resource("aiSettings").update({values:e.values,filterByTk:1})];case 2:return r.sent(),n.success(o("Saved successfully")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var u=r.apply(e,t);function a(e){l(u,n,o,a,i,"next",e)}function i(e){l(u,n,o,a,i,"throw",e)}a(void 0)})})()}}},m=function(){var e=(0,i.NT)();return u().createElement(a.Card,null,u().createElement(r.SchemaComponent,{scope:{t:e,useFormProps:p,useSubmitActionProps:f},schema:{type:"void",name:"ai-settings","x-component":"FormV2","x-use-component-props":"useFormProps",properties:{storage:{type:"string","x-decorator":"FormItem",title:'{{ t("Files storage") }}',"x-component":"RemoteSelect","x-component-props":{service:{resource:"aiSettings",action:"listStorages"},manual:!1},default:"local"},submit:{type:"void","x-component":"Action",title:'{{t("Save")}}',"x-component-props":{type:"primary"},"x-use-component-props":"useSubmitActionProps"}}}}))}}}]);