plugin-ai-api 1.1.0 → 1.1.1
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/client/97.1bc5103fd9d995a8.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/97.96da323832251796.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +8 -8
- package/dist/locale/en-US.json +139 -138
- package/dist/locale/vi-VN.json +139 -138
- package/dist/locale/zh-CN.json +139 -138
- package/dist/server/billing.js +17 -9
- package/dist/server/collections/ai-api-model-prices.js +8 -0
- package/dist/server/collections/ai-api-usage-records.js +1 -0
- package/dist/server/migrations/20260827000000-add-cache-input-price.js +66 -0
- package/dist/server/routes/auth.js +16 -0
- package/dist/server/routes/embeddings.js +11 -1
- package/dist/server/usage.js +1 -0
- package/dist/server/utils/direct-llm-context.js +9 -8
- package/dist/server/validation.js +1 -0
- package/package.json +1 -1
- package/src/client/index.tsx +10 -10
- package/src/client/models/index.ts +12 -12
- package/src/client-v2/pages/ModelPricingPage.tsx +15 -0
- package/src/index.ts +11 -11
- package/src/locale/en-US.json +139 -138
- package/src/locale/vi-VN.json +139 -138
- package/src/locale/zh-CN.json +139 -138
- package/src/server/__tests__/billing-quota.test.ts +8 -2
- package/src/server/__tests__/billing.test.ts +13 -0
- package/src/server/__tests__/usage.test.ts +1 -0
- package/src/server/billing.ts +29 -6
- package/src/server/collections/ai-api-model-prices.ts +8 -0
- package/src/server/collections/ai-api-usage-records.ts +1 -0
- package/src/server/migrations/20260827000000-add-cache-input-price.ts +49 -0
- package/src/server/routes/auth.ts +21 -1
- package/src/server/routes/embeddings.ts +17 -3
- package/src/server/usage.ts +1 -0
- package/src/server/utils/direct-llm-context.ts +21 -11
- package/src/server/validation.ts +1 -0
- package/dist/client/97.9b6b2d2b01a4c060.js +0 -10
- package/dist/client-v2/97.36a42eff36bb3d8a.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunkplugin_ai_api=self.webpackChunkplugin_ai_api||[]).push([["97"],{760:function(e,t,r){r.r(t),r.d(t,{default:function(){return g}});var n=r(155),i=r.n(n),o=r(59),l=r(185),a=r.n(l),c=r(694),u=r(650),s=r(630);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r,n,i,o,l){try{var a=e[o](l),c=a.value}catch(e){r(e);return}a.done?t(c):Promise.resolve(c).then(n,i)}function f(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function l(e){d(o,n,i,l,a,"next",e)}function a(e){d(o,n,i,l,a,"throw",e)}l(void 0)})}}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw n}}return o}}(e,t)||h(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}}function v(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function g(){var e=(0,c.useFlowContext)(),t=(0,u.k)(),r=b(o.Form.useForm(),1)[0],l=o.Form.useWatch("llmService",r),d=b((0,n.useState)([]),2),g=d[0],S=d[1],w=b((0,n.useState)([]),2),P=w[0],E=w[1],I=b((0,n.useState)([]),2),k=I[0],F=I[1],O=b((0,n.useState)(!1),2),M=O[0],x=O[1],T=b((0,n.useState)(!1),2),j=T[0],C=T[1],q=b((0,n.useState)(!1),2),A=q[0],D=q[1],L=b((0,n.useState)(),2),N=L[0],U=L[1],_=b((0,n.useState)(!1),2),B=_[0],R=_[1],V=(0,n.useCallback)(function(){return f(function(){var t,r,n,i;return v(this,function(l){switch(l.label){case 0:C(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,Promise.all([e.api.request({url:"aiApiModelPrices:list",method:"get",params:{pageSize:200,sort:"-effectiveFrom"}}),e.api.request({url:"ai:listLLMServices",method:"get"})])];case 2:return r=(t=b.apply(void 0,[l.sent(),2]))[0],n=t[1],S((0,s.m)(r,[])),E((0,s.m)(n,[])),[3,5];case 3:return i=l.sent(),o.message.error((0,s.g)(i)),[3,5];case 4:return C(!1),[7];case 5:return[2]}})})()},[e.api]);(0,n.useEffect)(function(){V()},[V]);var z=function(e){U(e),r.setFieldsValue(y(p({},e),{effectiveFrom:a()(e.effectiveFrom),effectiveTo:e.effectiveTo?a()(e.effectiveTo):void 0})),R(!0),G(e.llmService,e.model)},G=function(r,n){return f(function(){var i,l,a;return v(this,function(c){switch(c.label){case 0:x(!0),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,e.api.request({url:"ai:listModels",method:"get",params:{llmService:r}})];case 2:return i=c.sent(),l=(0,s.m)(i,[]),F(n&&!l.some(function(e){return e.id===n})?[{id:n}].concat(function(e){if(Array.isArray(e))return m(e)}(l)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||h(l)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):l),[3,5];case 3:return a=c.sent(),F(n?[{id:n}]:[]),o.message.error("".concat(t("Failed to load models"),": ").concat((0,s.g)(a))),[3,5];case 4:return x(!1),[7];case 5:return[2]}})})()},J=[{title:t("LLM service"),dataIndex:"llmService",key:"llmService",width:180},{title:t("Model"),dataIndex:"model",key:"model",width:180},{title:t("Input price / 1M"),dataIndex:"inputPricePerMillionTokens",key:"inputPrice",width:150},{title:t("Cache input price / 1M"),dataIndex:"cacheInputPricePerMillionTokens",key:"cacheInputPrice",width:170},{title:t("Output price / 1M"),dataIndex:"outputPricePerMillionTokens",key:"outputPrice",width:150},{title:t("Fixed request cost"),dataIndex:"fixedCostPerRequest",key:"fixedCost",width:150},{title:t("Currency"),dataIndex:"currency",key:"currency",width:90},{title:t("Status"),dataIndex:"enabled",key:"enabled",width:100,render:function(e){return i().createElement(o.Tag,{color:e?"green":"default"},e?t("Enabled"):t("Disabled"))}},{title:t("Actions"),key:"actions",fixed:"right",width:150,render:function(r,n){return i().createElement(o.Space,null,i().createElement(o.Button,{type:"link",onClick:function(){return z(n)}},t("Edit")),i().createElement(o.Popconfirm,{title:t("Delete this price?"),onConfirm:function(){var r;return r=n.id,f(function(){var n;return v(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiModelPrices:destroy/".concat(r),method:"post"})];case 1:return i.sent(),o.message.success(t("Deleted successfully")),[4,V()];case 2:return i.sent(),[3,4];case 3:return n=i.sent(),o.message.error((0,s.g)(n)),[3,4];case 4:return[2]}})})()}},i().createElement(o.Button,{type:"link",danger:!0},t("Delete"))))}}];return i().createElement(o.Card,{title:t("Model pricing"),extra:i().createElement(o.Button,{type:"primary",onClick:function(){U(void 0),F([]),r.setFieldsValue({currency:"USD",inputPricePerMillionTokens:"0",cacheInputPricePerMillionTokens:"0",outputPricePerMillionTokens:"0",fixedCostPerRequest:"0",effectiveFrom:a()(),enabled:!0}),R(!0)}},t("Add price"))},i().createElement(o.Table,{rowKey:"id",columns:J,dataSource:g,loading:j,scroll:{x:1200}}),i().createElement(o.Modal,{title:N?t("Edit price"):t("Add price"),open:B,onCancel:function(){return R(!1)},onOk:function(){return f(function(){var n,i,l,a,c,u,m;return v(this,function(d){switch(d.label){case 0:return[4,r.validateFields()];case 1:a=d.sent(),c=P.find(function(e){return e.name===a.llmService}),u=y(p({},a),{provider:null!=(n=null==c?void 0:c.provider)?n:a.provider,effectiveFrom:a.effectiveFrom.toISOString(),effectiveTo:null!=(i=null==(l=a.effectiveTo)?void 0:l.toISOString())?i:null}),D(!0),d.label=2;case 2:return d.trys.push([2,5,6,7]),[4,e.api.request({url:N?"aiApiModelPrices:update/".concat(N.id):"aiApiModelPrices:create",method:"post",data:u})];case 3:return d.sent(),o.message.success(t("Saved successfully")),R(!1),[4,V()];case 4:return d.sent(),[3,7];case 5:return m=d.sent(),o.message.error((0,s.g)(m)),[3,7];case 6:return D(!1),[7];case 7:return[2]}})})()},confirmLoading:A,destroyOnClose:!0},i().createElement(o.Form,{form:r,layout:"vertical",preserve:!1},i().createElement(o.Form.Item,{name:"llmService",label:t("LLM service"),rules:[{required:!0}]},i().createElement(o.Select,{showSearch:!0,optionFilterProp:"label",onChange:function(e){r.setFieldValue("model",void 0),F([]),G(e)},options:P.map(function(e){return{label:e.title||e.name,value:e.name}})})),i().createElement(o.Form.Item,{name:"provider",hidden:!0},i().createElement(o.Input,null)),i().createElement(o.Form.Item,{name:"model",label:t("Model"),rules:[{required:!0}]},i().createElement(o.Select,{showSearch:!0,optionFilterProp:"label",loading:M,disabled:!l,placeholder:t("Select a model"),options:k.map(function(e){return{label:e.id,value:e.id}})})),i().createElement(o.Form.Item,{name:"currency",label:t("Currency"),rules:[{required:!0}]},i().createElement(o.Input,null)),i().createElement(o.Form.Item,{name:"inputPricePerMillionTokens",label:t("Input price / 1M"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"cacheInputPricePerMillionTokens",label:t("Cache input price / 1M"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"outputPricePerMillionTokens",label:t("Output price / 1M"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"fixedCostPerRequest",label:t("Fixed request cost"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"effectiveFrom",label:t("Effective from"),rules:[{required:!0}]},i().createElement(o.DatePicker,{showTime:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"effectiveTo",label:t("Effective to")},i().createElement(o.DatePicker,{showTime:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},i().createElement(o.Switch,null)),i().createElement(o.Form.Item,{name:"notes",label:t("Notes")},i().createElement(o.Input.TextArea,{rows:3})))))}},650:function(e,t,r){r.d(t,{k:function(){return l}});var n=r(155),i=r(694),o=JSON.parse('{"UU":"plugin-ai-api"}');function l(){var e=(0,i.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[o.UU,"client"]})},[e])}},630:function(e,t,r){function n(e,t){var r,n;return e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?null!=(r=null==(n=e.data)?void 0:n.data)?r:t:t}function i(e){var t;return(null!=(t=Error)&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t)?e.message:String(e)}r.d(t,{g:function(){return i},m:function(){return n}})}}]);
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-acl/client"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-ai-api",["@nocobase/client-v2","dayjs","react","antd","@nocobase/client","@nocobase/plugin-acl/client","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-ai-api"]=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-acl/client"),require("@nocobase/flow-engine")):e["plugin-ai-api"]=t(e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@nocobase/client"],e["@nocobase/plugin-acl/client"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,i,o,a){return function(){"use strict";var u,c,l,p={342:function(e){e.exports=i},485:function(t){t.exports=e},694:function(e){e.exports=a},79:function(e){e.exports=o},59:function(e){e.exports=r},185:function(e){e.exports=t},155:function(e){e.exports=n}},s={};function f(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return p[e](n,n.exports,f),n.exports}f.m=p,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({286:"a1ee0420172cd5de",302:"fbc46ebf5bf300d7",562:"44b16aad4718b4c7",685:"ae483e17b6b49c98",757:"6568d3504ad29352",97:"9b6b2d2b01a4c060"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},f.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var i,o,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="plugin-ai-api:"+n){i=c;break}}i||(o=!0,(i=document.createElement("script")).timeout=120,f.nc&&i.setAttribute("nonce",f.nc),i.setAttribute("data-rspack","plugin-ai-api:"+n),i.src=e),d[e]=[t];var l=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var r=d[e];if(delete d[e],i.parentNode&&i.parentNode.removeChild(i),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),o&&document.head.appendChild(i)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(b=f.g.location+"");var d,b,g=f.g.document;if(!b&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(b=g.currentScript.src),!b)){var h=g.getElementsByTagName("script");if(h.length)for(var y=h.length-1;y>-1&&(!b||!/^http(s?):/.test(b));)b=h[y--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");f.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},f.f.j=function(e,t){var n=f.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var i=f.p+f.u(e),o=Error();f.l(i,function(t){if(f.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",o.name="ChunkLoadError",o.type=r,o.request=i,n[1](o)}},"chunk-"+e,e)}},c=function(e,t){var n,r,i=t[0],o=t[1],a=t[2],c=0;if(i.some(function(e){return 0!==u[e]})){for(n in o)f.o(o,n)&&(f.m[n]=o[n]);a&&a(f)}for(e&&e(t);c<i.length;c++)r=i[c],f.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunkplugin_ai_api=self.webpackChunkplugin_ai_api||[]).forEach(c.bind(null,0)),l.push=c.bind(null,l.push.bind(l));var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-ai-api/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-ai-api/dist/client/")}if(!e){var i=window.__nocobase_modern_client_prefix__||"v",o="/"+(i=String(i).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",u=a.indexOf(o);e=u>=0?a.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+i+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-ai-api/dist/client/"}f.p=e}(),!function(){f.r(v),f.d(v,{default:function(){return w}});var e=f(342),t=f(79),n=f.n(t),r="pm.plugin-ai-api.configuration",i=f(155),o=f.n(i);function a(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,i)}function u(e,t,n){return(u=s()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t="function"==typeof Map?new Map:void 0;return(p=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,e)})(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var d=o().lazy(function(){return f.e("302").then(f.bind(f,581))}),b=o().lazy(function(){return f.e("97").then(f.bind(f,760))}),g=o().lazy(function(){return f.e("562").then(f.bind(f,641))}),h=o().lazy(function(){return f.e("685").then(f.bind(f,244))}),y=o().lazy(function(){return f.e("757").then(f.bind(f,364))}),m=(0,e.lazy)(function(){return f.e("286").then(f.bind(f,421))},"AiApiRolePermissions").AiApiRolePermissions,w=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=c(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,s()?Reflect.construct(e,t||[],c(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&l(i,e),t=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return this.app.pluginSettingsManager.add("ai-api",{icon:"ApiOutlined",title:this.t("AI API Gateway"),aclSnippet:r}),this.app.pluginSettingsManager.add("ai-api.config",{title:this.t("Configuration"),Component:d,aclSnippet:r,sort:1}),this.app.pluginSettingsManager.add("ai-api.model-pricing",{title:this.t("Model pricing"),Component:b,aclSnippet:r,sort:2}),this.app.pluginSettingsManager.add("ai-api.model-metadata",{title:this.t("Model metadata"),Component:g,aclSnippet:r,sort:3}),this.app.pluginSettingsManager.add("ai-api.usage-groups",{title:this.t("Usage groups"),Component:h,aclSnippet:r,sort:5}),this.app.pluginSettingsManager.add("ai-api.usage",{title:this.t("Usage"),Component:y,aclSnippet:r,sort:6}),(null==(e=this.app.pm.get(n()))?void 0:e.settingsUI)&&e.settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"aiApi",label:t("AI API",{ns:["plugin-ai-api","client"]}),sort:25,children:o().createElement(n,null,o().createElement(m,{role:r}))}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function u(e){a(o,r,i,u,c,"next",e)}function c(e){a(o,r,i,u,c,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,t),i}(p(e.Plugin))}(),v}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-acl/client"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-ai-api",["@nocobase/client-v2","dayjs","react","antd","@nocobase/client","@nocobase/plugin-acl/client","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-ai-api"]=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/plugin-acl/client"),require("@nocobase/flow-engine")):e["plugin-ai-api"]=t(e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@nocobase/client"],e["@nocobase/plugin-acl/client"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,i,o,a){return function(){"use strict";var u,c,l,p={342:function(e){e.exports=i},485:function(t){t.exports=e},694:function(e){e.exports=a},79:function(e){e.exports=o},59:function(e){e.exports=r},185:function(e){e.exports=t},155:function(e){e.exports=n}},s={};function f(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return p[e](n,n.exports,f),n.exports}f.m=p,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({286:"a1ee0420172cd5de",302:"fbc46ebf5bf300d7",562:"44b16aad4718b4c7",685:"ae483e17b6b49c98",757:"6568d3504ad29352",97:"1bc5103fd9d995a8"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},f.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var i,o,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="plugin-ai-api:"+n){i=c;break}}i||(o=!0,(i=document.createElement("script")).timeout=120,f.nc&&i.setAttribute("nonce",f.nc),i.setAttribute("data-rspack","plugin-ai-api:"+n),i.src=e),d[e]=[t];var l=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var r=d[e];if(delete d[e],i.parentNode&&i.parentNode.removeChild(i),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),o&&document.head.appendChild(i)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(b=f.g.location+"");var d,b,g=f.g.document;if(!b&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(b=g.currentScript.src),!b)){var h=g.getElementsByTagName("script");if(h.length)for(var y=h.length-1;y>-1&&(!b||!/^http(s?):/.test(b));)b=h[y--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");f.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},f.f.j=function(e,t){var n=f.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var i=f.p+f.u(e),o=Error();f.l(i,function(t){if(f.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",o.name="ChunkLoadError",o.type=r,o.request=i,n[1](o)}},"chunk-"+e,e)}},c=function(e,t){var n,r,i=t[0],o=t[1],a=t[2],c=0;if(i.some(function(e){return 0!==u[e]})){for(n in o)f.o(o,n)&&(f.m[n]=o[n]);a&&a(f)}for(e&&e(t);c<i.length;c++)r=i[c],f.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunkplugin_ai_api=self.webpackChunkplugin_ai_api||[]).forEach(c.bind(null,0)),l.push=c.bind(null,l.push.bind(l));var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-ai-api/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-ai-api/dist/client/")}if(!e){var i=window.__nocobase_modern_client_prefix__||"v",o="/"+(i=String(i).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",u=a.indexOf(o);e=u>=0?a.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+i+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-ai-api/dist/client/"}f.p=e}(),!function(){f.r(v),f.d(v,{default:function(){return w}});var e=f(342),t=f(79),n=f.n(t),r="pm.plugin-ai-api.configuration",i=f(155),o=f.n(i);function a(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,i)}function u(e,t,n){return(u=s()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t="function"==typeof Map?new Map:void 0;return(p=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,e)})(e)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var d=o().lazy(function(){return f.e("302").then(f.bind(f,581))}),b=o().lazy(function(){return f.e("97").then(f.bind(f,760))}),g=o().lazy(function(){return f.e("562").then(f.bind(f,641))}),h=o().lazy(function(){return f.e("685").then(f.bind(f,244))}),y=o().lazy(function(){return f.e("757").then(f.bind(f,364))}),m=(0,e.lazy)(function(){return f.e("286").then(f.bind(f,421))},"AiApiRolePermissions").AiApiRolePermissions,w=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=c(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,s()?Reflect.construct(e,t||[],c(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&l(i,e),t=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){return this.app.pluginSettingsManager.add("ai-api",{icon:"ApiOutlined",title:this.t("AI API Gateway"),aclSnippet:r}),this.app.pluginSettingsManager.add("ai-api.config",{title:this.t("Configuration"),Component:d,aclSnippet:r,sort:1}),this.app.pluginSettingsManager.add("ai-api.model-pricing",{title:this.t("Model pricing"),Component:b,aclSnippet:r,sort:2}),this.app.pluginSettingsManager.add("ai-api.model-metadata",{title:this.t("Model metadata"),Component:g,aclSnippet:r,sort:3}),this.app.pluginSettingsManager.add("ai-api.usage-groups",{title:this.t("Usage groups"),Component:h,aclSnippet:r,sort:5}),this.app.pluginSettingsManager.add("ai-api.usage",{title:this.t("Usage"),Component:y,aclSnippet:r,sort:6}),(null==(e=this.app.pm.get(n()))?void 0:e.settingsUI)&&e.settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"aiApi",label:t("AI API",{ns:["plugin-ai-api","client"]}),sort:25,children:o().createElement(n,null,o().createElement(m,{role:r}))}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function u(e){a(o,r,i,u,c,"next",e)}function c(e){a(o,r,i,u,c,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,t),i}(p(e.Plugin))}(),v}()});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunkplugin_ai_api_client_v2=self.webpackChunkplugin_ai_api_client_v2||[]).push([["97"],{760:function(e,t,r){r.r(t),r.d(t,{default:function(){return g}});var n=r(155),i=r.n(n),o=r(59),l=r(185),a=r.n(l),c=r(694),u=r(650),s=r(630);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r,n,i,o,l){try{var a=e[o](l),c=a.value}catch(e){r(e);return}a.done?t(c):Promise.resolve(c).then(n,i)}function f(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function l(e){d(o,n,i,l,a,"next",e)}function a(e){d(o,n,i,l,a,"throw",e)}l(void 0)})}}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw n}}return o}}(e,t)||v(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}}function h(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function g(){var e=(0,c.useFlowContext)(),t=(0,u.k)(),r=b(o.Form.useForm(),1)[0],l=o.Form.useWatch("llmService",r),d=b((0,n.useState)([]),2),g=d[0],S=d[1],w=b((0,n.useState)([]),2),P=w[0],E=w[1],I=b((0,n.useState)([]),2),k=I[0],F=I[1],O=b((0,n.useState)(!1),2),M=O[0],x=O[1],T=b((0,n.useState)(!1),2),j=T[0],C=T[1],q=b((0,n.useState)(!1),2),A=q[0],D=q[1],_=b((0,n.useState)(),2),L=_[0],N=_[1],U=b((0,n.useState)(!1),2),B=U[0],R=U[1],V=(0,n.useCallback)(function(){return f(function(){var t,r,n,i;return h(this,function(l){switch(l.label){case 0:C(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,Promise.all([e.api.request({url:"aiApiModelPrices:list",method:"get",params:{pageSize:200,sort:"-effectiveFrom"}}),e.api.request({url:"ai:listLLMServices",method:"get"})])];case 2:return r=(t=b.apply(void 0,[l.sent(),2]))[0],n=t[1],S((0,s.m)(r,[])),E((0,s.m)(n,[])),[3,5];case 3:return i=l.sent(),o.message.error((0,s.g)(i)),[3,5];case 4:return C(!1),[7];case 5:return[2]}})})()},[e.api]);(0,n.useEffect)(function(){V()},[V]);var z=function(e){N(e),r.setFieldsValue(y(p({},e),{effectiveFrom:a()(e.effectiveFrom),effectiveTo:e.effectiveTo?a()(e.effectiveTo):void 0})),R(!0),G(e.llmService,e.model)},G=function(r,n){return f(function(){var i,l,a;return h(this,function(c){switch(c.label){case 0:x(!0),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,e.api.request({url:"ai:listModels",method:"get",params:{llmService:r}})];case 2:return i=c.sent(),l=(0,s.m)(i,[]),F(n&&!l.some(function(e){return e.id===n})?[{id:n}].concat(function(e){if(Array.isArray(e))return m(e)}(l)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||v(l)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):l),[3,5];case 3:return a=c.sent(),F(n?[{id:n}]:[]),o.message.error("".concat(t("Failed to load models"),": ").concat((0,s.g)(a))),[3,5];case 4:return x(!1),[7];case 5:return[2]}})})()},J=[{title:t("LLM service"),dataIndex:"llmService",key:"llmService",width:180},{title:t("Model"),dataIndex:"model",key:"model",width:180},{title:t("Input price / 1M"),dataIndex:"inputPricePerMillionTokens",key:"inputPrice",width:150},{title:t("Cache input price / 1M"),dataIndex:"cacheInputPricePerMillionTokens",key:"cacheInputPrice",width:170},{title:t("Output price / 1M"),dataIndex:"outputPricePerMillionTokens",key:"outputPrice",width:150},{title:t("Fixed request cost"),dataIndex:"fixedCostPerRequest",key:"fixedCost",width:150},{title:t("Currency"),dataIndex:"currency",key:"currency",width:90},{title:t("Status"),dataIndex:"enabled",key:"enabled",width:100,render:function(e){return i().createElement(o.Tag,{color:e?"green":"default"},e?t("Enabled"):t("Disabled"))}},{title:t("Actions"),key:"actions",fixed:"right",width:150,render:function(r,n){return i().createElement(o.Space,null,i().createElement(o.Button,{type:"link",onClick:function(){return z(n)}},t("Edit")),i().createElement(o.Popconfirm,{title:t("Delete this price?"),onConfirm:function(){var r;return r=n.id,f(function(){var n;return h(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiModelPrices:destroy/".concat(r),method:"post"})];case 1:return i.sent(),o.message.success(t("Deleted successfully")),[4,V()];case 2:return i.sent(),[3,4];case 3:return n=i.sent(),o.message.error((0,s.g)(n)),[3,4];case 4:return[2]}})})()}},i().createElement(o.Button,{type:"link",danger:!0},t("Delete"))))}}];return i().createElement(o.Card,{title:t("Model pricing"),extra:i().createElement(o.Button,{type:"primary",onClick:function(){N(void 0),F([]),r.setFieldsValue({currency:"USD",inputPricePerMillionTokens:"0",cacheInputPricePerMillionTokens:"0",outputPricePerMillionTokens:"0",fixedCostPerRequest:"0",effectiveFrom:a()(),enabled:!0}),R(!0)}},t("Add price"))},i().createElement(o.Table,{rowKey:"id",columns:J,dataSource:g,loading:j,scroll:{x:1200}}),i().createElement(o.Modal,{title:L?t("Edit price"):t("Add price"),open:B,onCancel:function(){return R(!1)},onOk:function(){return f(function(){var n,i,l,a,c,u,m;return h(this,function(d){switch(d.label){case 0:return[4,r.validateFields()];case 1:a=d.sent(),c=P.find(function(e){return e.name===a.llmService}),u=y(p({},a),{provider:null!=(n=null==c?void 0:c.provider)?n:a.provider,effectiveFrom:a.effectiveFrom.toISOString(),effectiveTo:null!=(i=null==(l=a.effectiveTo)?void 0:l.toISOString())?i:null}),D(!0),d.label=2;case 2:return d.trys.push([2,5,6,7]),[4,e.api.request({url:L?"aiApiModelPrices:update/".concat(L.id):"aiApiModelPrices:create",method:"post",data:u})];case 3:return d.sent(),o.message.success(t("Saved successfully")),R(!1),[4,V()];case 4:return d.sent(),[3,7];case 5:return m=d.sent(),o.message.error((0,s.g)(m)),[3,7];case 6:return D(!1),[7];case 7:return[2]}})})()},confirmLoading:A,destroyOnClose:!0},i().createElement(o.Form,{form:r,layout:"vertical",preserve:!1},i().createElement(o.Form.Item,{name:"llmService",label:t("LLM service"),rules:[{required:!0}]},i().createElement(o.Select,{showSearch:!0,optionFilterProp:"label",onChange:function(e){r.setFieldValue("model",void 0),F([]),G(e)},options:P.map(function(e){return{label:e.title||e.name,value:e.name}})})),i().createElement(o.Form.Item,{name:"provider",hidden:!0},i().createElement(o.Input,null)),i().createElement(o.Form.Item,{name:"model",label:t("Model"),rules:[{required:!0}]},i().createElement(o.Select,{showSearch:!0,optionFilterProp:"label",loading:M,disabled:!l,placeholder:t("Select a model"),options:k.map(function(e){return{label:e.id,value:e.id}})})),i().createElement(o.Form.Item,{name:"currency",label:t("Currency"),rules:[{required:!0}]},i().createElement(o.Input,null)),i().createElement(o.Form.Item,{name:"inputPricePerMillionTokens",label:t("Input price / 1M"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"cacheInputPricePerMillionTokens",label:t("Cache input price / 1M"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"outputPricePerMillionTokens",label:t("Output price / 1M"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"fixedCostPerRequest",label:t("Fixed request cost"),rules:[{required:!0}]},i().createElement(o.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"effectiveFrom",label:t("Effective from"),rules:[{required:!0}]},i().createElement(o.DatePicker,{showTime:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"effectiveTo",label:t("Effective to")},i().createElement(o.DatePicker,{showTime:!0,style:{width:"100%"}})),i().createElement(o.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},i().createElement(o.Switch,null)),i().createElement(o.Form.Item,{name:"notes",label:t("Notes")},i().createElement(o.Input.TextArea,{rows:3})))))}},650:function(e,t,r){r.d(t,{k:function(){return l}});var n=r(155),i=r(694),o=JSON.parse('{"UU":"plugin-ai-api"}');function l(){var e=(0,i.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[o.UU,"client"]})},[e])}},630:function(e,t,r){function n(e,t){var r,n;return e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?null!=(r=null==(n=e.data)?void 0:n.data)?r:t:t}function i(e){var t;return(null!=(t=Error)&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t)?e.message:String(e)}r.d(t,{g:function(){return i},m:function(){return n}})}}]);
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-ai-api/client-v2",["@nocobase/client-v2","dayjs","react","antd","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-ai-api/client-v2"]=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/flow-engine")):e["plugin-ai-api/client-v2"]=t(e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o){return function(){"use strict";var i,a,u,c={485:function(t){t.exports=e},694:function(e){e.exports=o},59:function(e){e.exports=r},185:function(e){e.exports=t},155:function(e){e.exports=n}},l={};function p(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return c[e](n,n.exports,p),n.exports}p.m=c,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,n){return p.f[n](e,t),t},[]))},p.u=function(e){return""+e+"."+({302:"3971233415999b2c",562:"45d5c504433be38b",685:"1030370b309b7d4b",757:"f2bc9cfba07004b0",952:"f0249eddc153bde1",97:"
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-ai-api/client-v2",["@nocobase/client-v2","dayjs","react","antd","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-ai-api/client-v2"]=t(require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/flow-engine")):e["plugin-ai-api/client-v2"]=t(e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o){return function(){"use strict";var i,a,u,c={485:function(t){t.exports=e},694:function(e){e.exports=o},59:function(e){e.exports=r},185:function(e){e.exports=t},155:function(e){e.exports=n}},l={};function p(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return c[e](n,n.exports,p),n.exports}p.m=c,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,n){return p.f[n](e,t),t},[]))},p.u=function(e){return""+e+"."+({302:"3971233415999b2c",562:"45d5c504433be38b",685:"1030370b309b7d4b",757:"f2bc9cfba07004b0",952:"f0249eddc153bde1",97:"96da323832251796"})[e]+".js"},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},p.l=function(e,t,n,r){if(s[e])return void s[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="plugin-ai-api/client-v2:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,p.nc&&o.setAttribute("nonce",p.nc),o.setAttribute("data-rspack","plugin-ai-api/client-v2:"+n),o.src=e),s[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(f=p.g.location+"");var s,f,d=p.g.document;if(!f&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(f=d.currentScript.src),!f)){var b=d.getElementsByTagName("script");if(b.length)for(var g=b.length-1;g>-1&&(!f||!/^http(s?):/.test(f));)f=b[g--].src}if(!f)throw Error("Automatic publicPath is not supported in this browser");p.p=f.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},p.f.j=function(e,t){var n=p.o(i,e)?i[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=p.p+p.u(e),a=Error();p.l(o,function(t){if(p.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],a=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==i[e]})){for(n in a)p.o(a,n)&&(p.m[n]=a[n]);u&&u(p)}for(e&&e(t);c<o.length;c++)r=o[c],p.o(i,r)&&i[r]&&i[r][0](),i[r]=0},(u=self.webpackChunkplugin_ai_api_client_v2=self.webpackChunkplugin_ai_api_client_v2||[]).forEach(a.bind(null,0)),u.push=a.bind(null,u.push.bind(u));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-ai-api/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-ai-api/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",u=a.indexOf(i);e=u>=0?a.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-ai-api/dist/client-v2/"}p.p=e}(),!function(){p.r(h),p.d(h,{default:function(){return c}}),p(155);var e=p(485),t="pm.plugin-ai-api.configuration";function n(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function r(e,t,n){return(r=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t="function"==typeof Map?new Map:void 0;return(a=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var c=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function a(){var e,t;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return e=a,t=arguments,e=o(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&i(a,e),r=[{key:"load",value:function(){var e;return(e=function(){var e,n,r;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){return this.pluginSettingsManager.addMenuItem({key:"ai-api",title:this.t("AI API Gateway"),icon:"ApiOutlined",aclSnippet:t}),this.pluginSettingsManager.addPageTabItem({menuKey:"ai-api",key:"index",title:this.t("Configuration"),aclSnippet:t,sort:1,componentLoader:function(){return p.e("302").then(p.bind(p,581))}}),this.pluginSettingsManager.addPageTabItem({menuKey:"ai-api",key:"model-pricing",title:this.t("Model pricing"),aclSnippet:t,sort:2,componentLoader:function(){return p.e("97").then(p.bind(p,760))}}),this.pluginSettingsManager.addPageTabItem({menuKey:"ai-api",key:"model-metadata",title:this.t("Model metadata"),aclSnippet:t,sort:3,componentLoader:function(){return p.e("562").then(p.bind(p,641))}}),this.pluginSettingsManager.addPageTabItem({menuKey:"ai-api",key:"usage-groups",title:this.t("Usage groups"),aclSnippet:t,sort:5,componentLoader:function(){return p.e("685").then(p.bind(p,244))}}),this.pluginSettingsManager.addPageTabItem({menuKey:"ai-api",key:"usage",title:this.t("Usage"),aclSnippet:t,sort:6,componentLoader:function(){return p.e("757").then(p.bind(p,364))}}),null==(r=this.app.pm.get("@nocobase/plugin-acl"))||null==(n=r.settingsUI)||null==(e=n.addPermissionsTab)||e.call(n,{key:"aiApi",label:this.t("AI API"),sort:25,componentLoader:function(){return p.e("952").then(p.bind(p,699))}}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var a=e.apply(t,r);function u(e){n(a,o,i,u,c,"next",e)}function c(e){n(a,o,i,u,c,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(a.prototype,r),a}(a(e.Plugin))}(),h}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.
|
|
12
|
-
"@nocobase/plugin-acl": "2.1.
|
|
11
|
+
"@nocobase/client": "2.1.45",
|
|
12
|
+
"@nocobase/plugin-acl": "2.1.45",
|
|
13
13
|
"react": "18.2.0",
|
|
14
|
-
"@nocobase/flow-engine": "2.1.
|
|
15
|
-
"@nocobase/client-v2": "2.1.
|
|
16
|
-
"@nocobase/actions": "2.1.
|
|
14
|
+
"@nocobase/flow-engine": "2.1.45",
|
|
15
|
+
"@nocobase/client-v2": "2.1.45",
|
|
16
|
+
"@nocobase/actions": "2.1.45",
|
|
17
17
|
"dayjs": "1.11.13",
|
|
18
|
-
"@nocobase/database": "2.1.
|
|
18
|
+
"@nocobase/database": "2.1.45",
|
|
19
19
|
"sequelize": "6.35.2",
|
|
20
|
-
"@nocobase/server": "2.1.
|
|
20
|
+
"@nocobase/server": "2.1.45",
|
|
21
21
|
"antd": "5.24.2",
|
|
22
|
-
"@nocobase/resourcer": "2.1.
|
|
22
|
+
"@nocobase/resourcer": "2.1.45"
|
|
23
23
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -1,138 +1,139 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AI API Gateway": "AI API Gateway",
|
|
3
|
-
"Configuration": "Configuration",
|
|
4
|
-
"Default AI Employee": "Default AI Employee",
|
|
5
|
-
"Enabled LLM Services": "Enabled LLM Services",
|
|
6
|
-
"Rate Limit": "Rate Limit",
|
|
7
|
-
"Save Configuration": "Save Configuration",
|
|
8
|
-
"Configuration saved": "Configuration saved",
|
|
9
|
-
"Failed to save configuration": "Failed to save configuration",
|
|
10
|
-
"API mode": "API mode",
|
|
11
|
-
"Direct LLM": "Direct LLM",
|
|
12
|
-
"AI Employee agent": "AI Employee agent",
|
|
13
|
-
"Default LLM service": "Default LLM service",
|
|
14
|
-
"Enable user quotas": "Enable user quotas",
|
|
15
|
-
"Default reserved output tokens": "Default reserved output tokens",
|
|
16
|
-
"Refresh": "Refresh",
|
|
17
|
-
"Model pricing": "Model pricing",
|
|
18
|
-
"User quotas": "User quotas",
|
|
19
|
-
"Usage": "Usage",
|
|
20
|
-
"LLM service": "LLM service",
|
|
21
|
-
"Model": "Model",
|
|
22
|
-
"Input price / 1M": "Input price / 1M",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"Delete
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"Effective
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"Resolved
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"Cost
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"Select
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"Allow
|
|
107
|
-
"
|
|
108
|
-
"Select
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"Member
|
|
123
|
-
"
|
|
124
|
-
"Remove": "Remove",
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"User
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"All
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
|
|
1
|
+
{
|
|
2
|
+
"AI API Gateway": "AI API Gateway",
|
|
3
|
+
"Configuration": "Configuration",
|
|
4
|
+
"Default AI Employee": "Default AI Employee",
|
|
5
|
+
"Enabled LLM Services": "Enabled LLM Services",
|
|
6
|
+
"Rate Limit": "Rate Limit",
|
|
7
|
+
"Save Configuration": "Save Configuration",
|
|
8
|
+
"Configuration saved": "Configuration saved",
|
|
9
|
+
"Failed to save configuration": "Failed to save configuration",
|
|
10
|
+
"API mode": "API mode",
|
|
11
|
+
"Direct LLM": "Direct LLM",
|
|
12
|
+
"AI Employee agent": "AI Employee agent",
|
|
13
|
+
"Default LLM service": "Default LLM service",
|
|
14
|
+
"Enable user quotas": "Enable user quotas",
|
|
15
|
+
"Default reserved output tokens": "Default reserved output tokens",
|
|
16
|
+
"Refresh": "Refresh",
|
|
17
|
+
"Model pricing": "Model pricing",
|
|
18
|
+
"User quotas": "User quotas",
|
|
19
|
+
"Usage": "Usage",
|
|
20
|
+
"LLM service": "LLM service",
|
|
21
|
+
"Model": "Model",
|
|
22
|
+
"Input price / 1M": "Input price / 1M",
|
|
23
|
+
"Cache input price / 1M": "Cache input price / 1M",
|
|
24
|
+
"Output price / 1M": "Output price / 1M",
|
|
25
|
+
"Fixed request cost": "Fixed request cost",
|
|
26
|
+
"Currency": "Currency",
|
|
27
|
+
"Status": "Status",
|
|
28
|
+
"Enabled": "Enabled",
|
|
29
|
+
"Disabled": "Disabled",
|
|
30
|
+
"Actions": "Actions",
|
|
31
|
+
"Edit": "Edit",
|
|
32
|
+
"Delete": "Delete",
|
|
33
|
+
"Delete this price?": "Delete this price?",
|
|
34
|
+
"Add price": "Add price",
|
|
35
|
+
"Edit price": "Edit price",
|
|
36
|
+
"Effective from": "Effective from",
|
|
37
|
+
"Effective to": "Effective to",
|
|
38
|
+
"Notes": "Notes",
|
|
39
|
+
"Saved successfully": "Saved successfully",
|
|
40
|
+
"Deleted successfully": "Deleted successfully",
|
|
41
|
+
"User": "User",
|
|
42
|
+
"Period": "Period",
|
|
43
|
+
"Request limit": "Request limit",
|
|
44
|
+
"Token limit": "Token limit",
|
|
45
|
+
"Cost limit": "Cost limit",
|
|
46
|
+
"Timezone": "Timezone",
|
|
47
|
+
"Unlimited": "Unlimited",
|
|
48
|
+
"Add quota": "Add quota",
|
|
49
|
+
"Edit quota": "Edit quota",
|
|
50
|
+
"Delete this quota?": "Delete this quota?",
|
|
51
|
+
"Daily": "Daily",
|
|
52
|
+
"Monthly": "Monthly",
|
|
53
|
+
"Reject unpriced models": "Reject unpriced models",
|
|
54
|
+
"Missing usage behavior": "Missing usage behavior",
|
|
55
|
+
"Use reserved estimate": "Use reserved estimate",
|
|
56
|
+
"Allow without token charge": "Allow without token charge",
|
|
57
|
+
"Context overflow behavior": "Context overflow behavior",
|
|
58
|
+
"Reject request": "Reject request",
|
|
59
|
+
"Truncate oldest conversation turns": "Truncate oldest conversation turns",
|
|
60
|
+
"Started at": "Started at",
|
|
61
|
+
"Requested model": "Requested model",
|
|
62
|
+
"Resolved service": "Resolved service",
|
|
63
|
+
"Resolved model": "Resolved model",
|
|
64
|
+
"Input tokens": "Input tokens",
|
|
65
|
+
"Output tokens": "Output tokens",
|
|
66
|
+
"Total tokens": "Total tokens",
|
|
67
|
+
"Prompt cache tokens": "Prompt cache tokens",
|
|
68
|
+
"Cost": "Cost",
|
|
69
|
+
"Cost status": "Cost status",
|
|
70
|
+
"Request ID": "Request ID",
|
|
71
|
+
"Failed to load models": "Failed to load models",
|
|
72
|
+
"Select a model": "Select a model",
|
|
73
|
+
"Select an AI Employee": "Select an AI Employee",
|
|
74
|
+
"Usage guide": "Usage guide",
|
|
75
|
+
"OpenAI-compatible endpoint": "OpenAI-compatible endpoint",
|
|
76
|
+
"Base URL": "Base URL",
|
|
77
|
+
"Use a NocoBase API key as the Bearer token.": "Use a NocoBase API key as the Bearer token.",
|
|
78
|
+
"List available models": "List available models",
|
|
79
|
+
"Send a chat completion": "Send a chat completion",
|
|
80
|
+
"Usage filters": "Usage filters",
|
|
81
|
+
"Time range": "Time range",
|
|
82
|
+
"User ID": "User ID",
|
|
83
|
+
"Succeeded": "Succeeded",
|
|
84
|
+
"Failed": "Failed",
|
|
85
|
+
"Started": "Started",
|
|
86
|
+
"Apply filters": "Apply filters",
|
|
87
|
+
"Reset": "Reset",
|
|
88
|
+
"Requests": "Requests",
|
|
89
|
+
"Total cost": "Total cost",
|
|
90
|
+
"Usage records": "Usage records",
|
|
91
|
+
"Model metadata": "Model metadata",
|
|
92
|
+
"Add override": "Add override",
|
|
93
|
+
"Edit override": "Edit override",
|
|
94
|
+
"Delete this override?": "Delete this override?",
|
|
95
|
+
"Context window": "Context window",
|
|
96
|
+
"Max completion tokens": "Max completion tokens",
|
|
97
|
+
"Owned by": "Owned by",
|
|
98
|
+
"Display name": "Display name",
|
|
99
|
+
"Description": "Description",
|
|
100
|
+
"Leave empty to not override": "Leave empty to not override",
|
|
101
|
+
"Total input + output token capacity reported to clients.": "Total input + output token capacity reported to clients.",
|
|
102
|
+
"Maximum output tokens reported to clients.": "Maximum output tokens reported to clients.",
|
|
103
|
+
"Initial system prompt": "Initial system prompt",
|
|
104
|
+
"Prepended as the first system message, before any system prompt sent by the client. If the client sends no system prompt, this becomes the system prompt sent to the provider.": "Prepended as the first system message, before any system prompt sent by the client. If the client sends no system prompt, this becomes the system prompt sent to the provider.",
|
|
105
|
+
"AI API": "AI API",
|
|
106
|
+
"Allow this role to use the AI API": "Allow this role to use the AI API",
|
|
107
|
+
"Allow all AI Employees": "Allow all AI Employees",
|
|
108
|
+
"Select which AI Employees this role may use:": "Select which AI Employees this role may use:",
|
|
109
|
+
"Select allowed AI Employees": "Select allowed AI Employees",
|
|
110
|
+
"Max request body size (MB)": "Max request body size (MB)",
|
|
111
|
+
"Raise this to accept inline base64 images. Base64 adds about 33% to the original file size.": "Raise this to accept inline base64 images. Base64 adds about 33% to the original file size.",
|
|
112
|
+
"Usage groups": "Usage groups",
|
|
113
|
+
"Add group": "Add group",
|
|
114
|
+
"Edit group": "Edit group",
|
|
115
|
+
"Delete this group?": "Delete this group?",
|
|
116
|
+
"Mode": "Mode",
|
|
117
|
+
"Share": "Share",
|
|
118
|
+
"Per user": "Per user",
|
|
119
|
+
"Rate limit per minute": "Rate limit per minute",
|
|
120
|
+
"Members": "Members",
|
|
121
|
+
"Add member": "Add member",
|
|
122
|
+
"Member added": "Member added",
|
|
123
|
+
"Member removed": "Member removed",
|
|
124
|
+
"Remove member?": "Remove member?",
|
|
125
|
+
"Remove": "Remove",
|
|
126
|
+
"Search group by user": "Search group by user",
|
|
127
|
+
"User belongs to": "User belongs to",
|
|
128
|
+
"User not found": "User not found",
|
|
129
|
+
"Default": "Default",
|
|
130
|
+
"Allowed LLM services": "Allowed LLM services",
|
|
131
|
+
"Allow all models": "Allow all models",
|
|
132
|
+
"Allowed models": "Allowed models",
|
|
133
|
+
"Model access": "Model access",
|
|
134
|
+
"All models": "All models",
|
|
135
|
+
"All services": "All services",
|
|
136
|
+
"No models": "No models",
|
|
137
|
+
"Leave empty to allow every service enabled in the general configuration.": "Leave empty to allow every service enabled in the general configuration.",
|
|
138
|
+
"Users who do not belong to any other group automatically use this default group — no need to add members.": "Users who do not belong to any other group automatically use this default group — no need to add members."
|
|
139
|
+
}
|