plugin-ai-api 1.1.1 → 1.1.2
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/README.md +51 -12
- package/dist/client/185.c47663fefaeb0e5b.js +10 -0
- package/dist/client/562.9012cfd1fa04303d.js +10 -0
- package/dist/client/685.b5b1e0a5b825d253.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/185.b552dc91ec2371ba.js +10 -0
- package/dist/client-v2/562.db2984167250b1be.js +10 -0
- package/dist/client-v2/685.cf16e5b829e06f85.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +8 -8
- package/dist/locale/en-US.json +175 -139
- package/dist/locale/vi-VN.json +40 -2
- package/dist/locale/zh-CN.json +40 -2
- package/dist/server/collections/ai-api-model-metadata.js +26 -0
- package/dist/server/collections/ai-api-response-records.js +101 -0
- package/dist/server/collections/ai-api-virtual-models.js +68 -0
- package/dist/server/middleware/response-record-resource.js +66 -0
- package/dist/server/middleware/role-permission.js +43 -18
- package/dist/server/migrations/20260901000000-remove-default-group-members.js +60 -0
- package/dist/server/migrations/20260902000000-seed-default-role-permissions.js +55 -0
- package/dist/server/migrations/20260903000000-seed-sample-response-records.js +170 -0
- package/dist/server/plugin.js +66 -16
- package/dist/server/routes/chat-completions.js +38 -6
- package/dist/server/routes/completions.js +16 -4
- package/dist/server/routes/embeddings.js +25 -6
- package/dist/server/routes/models.js +29 -0
- package/dist/server/routes/responses.js +530 -0
- package/dist/server/routes/router.js +65 -10
- package/dist/server/usage.js +25 -4
- package/dist/server/utils/direct-llm-context.js +1 -1
- package/dist/server/utils/resolve-service.js +24 -0
- package/dist/server/utils/response-store.js +138 -0
- package/dist/server/utils/responses-format.js +686 -0
- package/dist/server/utils/responses-stream.js +330 -0
- package/dist/server/utils/virtual-models.js +238 -0
- package/dist/server/validation.js +44 -2
- package/dist/swagger.js +137 -0
- package/package.json +34 -32
- package/src/__tests__/locale.test.ts +43 -0
- package/src/client/__tests__/settings-registration.test.tsx +1 -0
- package/src/client/plugin.tsx +9 -1
- package/src/client-v2/__tests__/settings-registration.test.tsx +1 -0
- package/src/client-v2/pages/ModelMetadataPage.tsx +44 -0
- package/src/client-v2/pages/ModelRoutingPage.tsx +238 -0
- package/src/client-v2/pages/UsageGroupsPage.tsx +75 -38
- package/src/client-v2/plugin.tsx +8 -0
- package/src/locale/en-US.json +175 -139
- package/src/locale/vi-VN.json +40 -2
- package/src/locale/zh-CN.json +40 -2
- package/src/server/__tests__/embeddings.test.ts +184 -0
- package/src/server/__tests__/models.test.ts +21 -1
- package/src/server/__tests__/response-record-resource.test.ts +50 -0
- package/src/server/__tests__/response-store-integration.test.ts +341 -0
- package/src/server/__tests__/response-store.test.ts +195 -0
- package/src/server/__tests__/responses-contract.test.ts +469 -0
- package/src/server/__tests__/responses-format.test.ts +299 -0
- package/src/server/__tests__/responses-router.test.ts +182 -0
- package/src/server/__tests__/responses-streaming.test.ts +368 -0
- package/src/server/__tests__/responses.test.ts +462 -0
- package/src/server/__tests__/role-permission.test.ts +139 -0
- package/src/server/__tests__/seed-role-permission.test.ts +88 -0
- package/src/server/__tests__/types/responses-sdk.types.test-d.ts +23 -0
- package/src/server/__tests__/usage-groups.test.ts +96 -0
- package/src/server/__tests__/usage-route.test.ts +1 -0
- package/src/server/__tests__/usage.test.ts +14 -0
- package/src/server/__tests__/validation.test.ts +66 -7
- package/src/server/__tests__/virtual-model-routing.test.ts +589 -0
- package/src/server/collections/ai-api-model-metadata.ts +26 -0
- package/src/server/collections/ai-api-response-records.ts +77 -0
- package/src/server/collections/ai-api-virtual-models.ts +58 -0
- package/src/server/middleware/response-record-resource.ts +44 -0
- package/src/server/middleware/role-permission.ts +69 -35
- package/src/server/migrations/20260901000000-remove-default-group-members.ts +56 -0
- package/src/server/migrations/20260902000000-seed-default-role-permissions.ts +46 -0
- package/src/server/migrations/20260903000000-seed-sample-response-records.ts +162 -0
- package/src/server/plugin.ts +84 -20
- package/src/server/resource/ai-api-config.ts +2 -1
- package/src/server/routes/agent-completions.ts +3 -0
- package/src/server/routes/chat-completions.ts +34 -10
- package/src/server/routes/completions.ts +16 -4
- package/src/server/routes/embeddings.ts +32 -10
- package/src/server/routes/models.ts +34 -0
- package/src/server/routes/responses.ts +640 -0
- package/src/server/routes/router.ts +81 -12
- package/src/server/services/__tests__/file-processor.test.ts +1 -0
- package/src/server/usage.ts +29 -2
- package/src/server/utils/app-observability.ts +1 -1
- package/src/server/utils/direct-llm-context.ts +2 -1
- package/src/server/utils/openai-format.ts +1 -0
- package/src/server/utils/resolve-service.ts +39 -1
- package/src/server/utils/response-store.ts +148 -0
- package/src/server/utils/responses-format.ts +974 -0
- package/src/server/utils/responses-stream.ts +384 -0
- package/src/server/utils/virtual-models.ts +320 -0
- package/src/server/validation.ts +49 -0
- package/src/swagger.ts +139 -0
- package/dist/client/562.44b16aad4718b4c7.js +0 -10
- package/dist/client/685.ae483e17b6b49c98.js +0 -10
- package/dist/client-v2/562.45d5c504433be38b.js +0 -10
- package/dist/client-v2/685.1030370b309b7d4b.js +0 -10
- package/dist/server/collections/ai-api-user-permissions.js +0 -67
- package/dist/server/collections/ai-api-user-quota-buckets.js +0 -54
- package/dist/server/collections/ai-api-user-quota-policies.js +0 -63
- package/dist/server/resource/ai-api-usage-groups.js +0 -168
- package/src/server/collections/ai-api-user-permissions.ts +0 -46
- package/src/server/collections/ai-api-user-quota-buckets.ts +0 -24
- package/src/server/collections/ai-api-user-quota-policies.ts +0 -33
- package/src/server/resource/ai-api-usage-groups.ts +0 -171
package/README.md
CHANGED
|
@@ -1,15 +1,54 @@
|
|
|
1
1
|
# plugin-ai-api
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
|
|
5
|
+
Provides an OpenAI-compatible AI gateway for NocoBase. Requests use NocoBase bearer authentication and are routed through configured LLM services, model permissions, usage groups, quotas, and observability.
|
|
6
|
+
|
|
7
|
+
## OpenAI-compatible endpoints
|
|
8
|
+
|
|
9
|
+
The base URL is `<nocobase-origin>/api/ai-llm/v1`.
|
|
10
|
+
|
|
11
|
+
- `GET /models`
|
|
12
|
+
- `POST /chat/completions`
|
|
13
|
+
- `POST /completions`
|
|
14
|
+
- `POST /embeddings`
|
|
15
|
+
- `POST /responses`
|
|
16
|
+
- `GET /responses/{response_id}`
|
|
17
|
+
- `DELETE /responses/{response_id}`
|
|
18
|
+
|
|
19
|
+
## Responses API
|
|
20
|
+
|
|
21
|
+
Create a response:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
curl -X POST "http://localhost:13000/api/ai-llm/v1/responses" \
|
|
25
|
+
-H "Authorization: Bearer $NOCOBASE_TOKEN" \
|
|
26
|
+
-H "Content-Type: application/json" \
|
|
27
|
+
-d '{
|
|
28
|
+
"model": "openai/gpt-4o",
|
|
29
|
+
"input": "Explain NocoBase in one sentence"
|
|
30
|
+
}'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Streaming follows the OpenAI Responses SSE event schema and ends with `data: [DONE]`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"model": "openai/gpt-4o",
|
|
38
|
+
"input": "Write a short greeting",
|
|
39
|
+
"stream": true
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Conversation state is opt-in through stored response records. `store` defaults to `true`; pass the returned response ID as `previous_response_id` on the next request. Stored responses are scoped to the authenticated owner and expire after 30 days. Use `store: false` when retrieval and chaining are not needed.
|
|
44
|
+
|
|
45
|
+
Supported request features include text/image/file input, function tools, function-call output, reasoning-item round trips, structured text format, prompt-cache parameters, and `truncation`. OpenAI-hosted built-in tools, `file_id`, background mode, conversations, reusable prompts, include expansions, and stream retrieval are rejected explicitly because the gateway does not currently implement those services.
|
|
46
|
+
|
|
47
|
+
The legacy `/completions` and `/chat/completions` endpoints remain independent; `previous_response_id` is only available on `/responses`.
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
1. Enable the plugin in Plugin Manager.
|
|
52
|
+
2. Configure LLM services and enable them for the AI API gateway.
|
|
53
|
+
3. Grant roles access in Settings -> Users & Permissions -> AI API.
|
|
54
|
+
4. Configure usage groups, model access, rate limits, and quotas as required.
|
|
@@ -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([["185"],{664:function(e,t,r){r.r(t),r.d(t,{default:function(){return v}});var n=r(155),l=r.n(n),a=r(59),o=r(694),i=r(650),u=r(630);function s(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 c(e,t,r,n,l,a,o){try{var i=e[a](o),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,l)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,l){var a=e.apply(t,r);function o(e){c(a,n,l,o,i,"next",e)}function i(e){c(a,n,l,o,i,"throw",e)}o(void 0)})}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(r=l.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw n}}return a}}(e,t)||p(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 m(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){if(e){if("string"==typeof e)return s(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 s(e,t)}}function b(e,t){var r,n,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:u(0)}),i(o,"throw",{value:u(1)}),i(o,"return",{value:u(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function u(i){return function(u){var s=[i,u];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(l=2&s[0]?n.return:s[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,s[1])).done)return l;switch(n=0,l&&(s=[2&s[0],l.value]),s[0]){case 0:case 1:l=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!l||s[1]>l[0]&&s[1]<l[3])){a.label=s[1];break}if(6===s[0]&&a.label<l[1]){a.label=l[1],l=s;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(s);break}l[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=l=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var h=a.Typography.Text,y="auto";function v(){var e=(0,o.useFlowContext)(),t=(0,i.k)(),r=f(a.Form.useForm(),1)[0],s=f((0,n.useState)(!0),2),c=s[0],p=s[1],v=f((0,n.useState)(!1),2),g=v[0],S=v[1],M=f((0,n.useState)([]),2),w=M[0],k=M[1],E=f((0,n.useState)(),2),O=E[0],A=E[1],F=(0,n.useCallback)(function(){return d(function(){var n,l,o,i,s,c,d,h,v,g,S,M,w,E,O,F,I,x,j,q,P,C,T,U,V,_,R,W;return b(this,function(b){switch(b.label){case 0:p(!0),b.label=1;case 1:return b.trys.push([1,3,4,5]),[4,Promise.all([e.api.request({url:"aiApiVirtualModels:list",method:"get",params:{filter:{name:y},pageSize:1}}),e.api.request({url:"ai:listAllEnabledModels",method:"get"})])];case 2:l=(n=f.apply(void 0,[b.sent(),2]))[0],o=n[1],i=(0,u.m)(o,[]),s=[],c=!0,d=!1,h=void 0;try{for(v=i[Symbol.iterator]();!(c=(g=v.next()).done);c=!0){M=(S=g.value).llmServiceTitle||S.llmService,w=!0,E=!1,O=void 0;try{for(F=(S.enabledModels||[])[Symbol.iterator]();!(w=(I=F.next()).done);w=!0)(null==(x=I.value)?void 0:x.value)&&s.push({value:"".concat(S.llmService,"/").concat(x.value),label:"".concat(M," / ").concat(x.label||x.value)})}catch(e){E=!0,O=e}finally{try{w||null==F.return||F.return()}finally{if(E)throw O}}}}catch(e){d=!0,h=e}finally{try{c||null==v.return||v.return()}finally{if(d)throw h}}if(j=(0,u.m)(l,[])[0]){q=new Set(s.map(function(e){return e.value})),P=[j.fallbackModel].concat(m(j.visionModels||[]),m(j.toolModels||[]),m(j.reasoningModels||[]),m(j.cheapModels||[]),m(j.generalModels||[])).filter(function(e){return"string"==typeof e&&e.length>0}),C=!0,T=!1,U=void 0;try{for(V=P[Symbol.iterator]();!(C=(_=V.next()).done);C=!0)R=_.value,q.has(R)||(q.add(R),s.push({value:R,label:"".concat(R," (").concat(t("unavailable"),")")}))}catch(e){T=!0,U=e}finally{try{C||null==V.return||V.return()}finally{if(T)throw U}}}return k(s),j?(A(j.id),r.setFieldsValue({name:j.name,mode:j.mode||"chat",fallbackModel:j.fallbackModel,visionModels:j.visionModels||[],toolModels:j.toolModels||[],reasoningModels:j.reasoningModels||[],cheapModels:j.cheapModels||[],generalModels:j.generalModels||[],enabled:!1!==j.enabled})):r.setFieldsValue({name:y,mode:"chat",fallbackModel:void 0,enabled:!0,visionModels:[],toolModels:[],reasoningModels:[],cheapModels:[],generalModels:[]}),[3,5];case 3:return W=b.sent(),a.message.error((0,u.g)(W)),[3,5];case 4:return p(!1),[7];case 5:return[2]}})})()},[e.api,r,t]);(0,n.useEffect)(function(){F()},[F]);var I={options:w,optionFilterProp:"label",showSearch:!0,loading:c},x=function(e,r,n){return l().createElement(a.Form.Item,{name:e,label:r,tooltip:n},l().createElement(a.Select,function(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}({mode:"multiple",placeholder:t("Select models — the order shown is the routing priority")},I)))};return l().createElement(a.Card,{loading:c,title:t("Model routing (virtual models)")},l().createElement(a.Form,{form:r,layout:"vertical"},l().createElement(a.Form.Item,{name:"name",label:t("Alias"),rules:[{required:!0}]},l().createElement(a.Input,{disabled:!0,style:{maxWidth:240}})),l().createElement(a.Form.Item,{name:"mode",hidden:!0},l().createElement(a.Input,null)),l().createElement(a.Form.Item,{name:"fallbackModel",label:t("Fallback model"),rules:[{required:!0,message:t("A fallback model is required")}],tooltip:t("Used when no capability bucket candidate is usable and the fallback is permitted for the caller.")},l().createElement(a.Select,{placeholder:t("Select a fallback model"),options:w,optionFilterProp:"label",showSearch:!0,style:{maxWidth:480}})),x("visionModels",t("Vision models (in order)"),t("Requests with an image or file block use the first permitted model here.")),x("toolModels",t("Tool-calling models (in order)"),t("Requests with tools/tool_choice use the first permitted model here.")),x("reasoningModels",t("Reasoning models (in order)"),t("Requests with an explicit reasoning or reasoning_effort parameter use the first permitted model here.")),x("cheapModels",t("Cheap models (in order)"),t("Optional. When set, cheap-eligible requests use the first permitted model here.")),x("generalModels",t("General models (in order)"),t("Default bucket when no capability rule matched. Leave empty to derive from all enabled models ordered by Model metadata sortOrder.")),l().createElement(a.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},l().createElement(a.Switch,null)),l().createElement(a.Space,null,l().createElement(a.Button,{type:"primary",onClick:function(){return d(function(){var n,l,o,i;return b(this,function(s){switch(s.label){case 0:return[4,r.validateFields()];case 1:n=s.sent(),S(!0),s.label=2;case 2:if(s.trys.push([2,7,8,9]),!O)return[3,4];return[4,e.api.request({url:"aiApiVirtualModels:update/".concat(O),method:"post",data:n})];case 3:return s.sent(),[3,6];case 4:return[4,e.api.request({url:"aiApiVirtualModels:create",method:"post",data:n})];case 5:l=s.sent(),(null==(o=(0,u.m)(l,void 0))?void 0:o.id)&&A(o.id),s.label=6;case 6:return a.message.success(t("Saved successfully")),[3,9];case 7:return i=s.sent(),a.message.error((0,u.g)(i)),[3,9];case 8:return S(!1),[7];case 9:return[2]}})})()},loading:g},t("Save")),l().createElement(h,{type:"secondary"},t("An empty bucket is derived automatically from Model metadata (capability flags + sortOrder).")))))}},650:function(e,t,r){r.d(t,{k:function(){return o}});var n=r(155),l=r(694),a=JSON.parse('{"UU":"plugin-ai-api"}');function o(){var e=(0,l.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[a.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 l(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 l},m:function(){return n}})}}]);
|
|
@@ -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([["562"],{641:function(e,t,r){r.r(t),r.d(t,{default:function(){return b}});var n=r(155),o=r.n(n),a=r(59),l=r(694),i=r(650),s=r(630);function u(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 c(e,t,r,n,o,a,l){try{var i=e[a](l),s=i.value}catch(e){r(e);return}i.done?t(s):Promise.resolve(s).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){c(a,n,o,l,i,"next",e)}function i(e){c(a,n,o,l,i,"throw",e)}l(void 0)})}}function d(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 p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||f(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 f(e,t){if(e){if("string"==typeof e)return u(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 u(e,t)}}function y(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var u=[i,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function b(){var e=(0,l.useFlowContext)(),t=(0,i.k)(),r=p(a.Form.useForm(),1)[0],c=a.Form.useWatch("llmService",r),b=p((0,n.useState)([]),2),v=b[0],h=b[1],g=p((0,n.useState)([]),2),w=g[0],S=g[1],E=p((0,n.useState)([]),2),k=E[0],I=E[1],O=p((0,n.useState)(!1),2),x=O[0],F=O[1],P=p((0,n.useState)(!1),2),C=P[0],j=P[1],M=p((0,n.useState)(!1),2),A=M[0],T=M[1],L=p((0,n.useState)(),2),N=L[0],D=L[1],q=p((0,n.useState)(!1),2),B=q[0],U=q[1],V=(0,n.useCallback)(function(){return m(function(){var t,r,n,o;return y(this,function(l){switch(l.label){case 0:j(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,Promise.all([e.api.request({url:"aiApiModelMetadata:list",method:"get",params:{pageSize:200,sort:"llmService"}}),e.api.request({url:"ai:listLLMServices",method:"get"})])];case 2:return r=(t=p.apply(void 0,[l.sent(),2]))[0],n=t[1],h((0,s.m)(r,[])),S((0,s.m)(n,[])),[3,5];case 3:return o=l.sent(),a.message.error((0,s.g)(o)),[3,5];case 4:return j(!1),[7];case 5:return[2]}})})()},[e.api]);(0,n.useEffect)(function(){V()},[V]);var W=(0,n.useCallback)(function(r,n){return m(function(){var o,l,i;return y(this,function(c){switch(c.label){case 0:F(!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 o=c.sent(),l=(0,s.m)(o,[]),I(n&&!l.some(function(e){return e.id===n})?[{id:n}].concat(function(e){if(Array.isArray(e))return u(e)}(l)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||f(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 i=c.sent(),I(n?[{id:n}]:[]),a.message.error("".concat(t("Failed to load models"),": ").concat((0,s.g)(i))),[3,5];case 4:return F(!1),[7];case 5:return[2]}})})()},[e.api,t]),_=function(e){D(e),r.setFieldsValue(d({},e)),U(!0),W(e.llmService,e.model)},R=[{title:t("LLM service"),dataIndex:"llmService",key:"llmService",width:160},{title:t("Model"),dataIndex:"model",key:"model",width:180},{title:t("Context window"),dataIndex:"contextWindow",key:"contextWindow",width:140},{title:t("Max completion tokens"),dataIndex:"maxCompletionTokens",key:"maxCompletionTokens",width:170},{title:t("Owned by"),dataIndex:"ownedByOverride",key:"ownedByOverride",width:140},{title:t("Display name"),dataIndex:"displayName",key:"displayName",width:160},{title:t("Initial system prompt"),dataIndex:"systemPrompt",key:"systemPrompt",width:220,ellipsis:!0,render:function(e){return e||"-"}},{title:t("Status"),dataIndex:"enabled",key:"enabled",width:100,render:function(e){return o().createElement(a.Tag,{color:e?"green":"default"},e?t("Enabled"):t("Disabled"))}},{title:t("Actions"),key:"actions",fixed:"right",width:150,render:function(r,n){return o().createElement(a.Space,null,o().createElement(a.Button,{type:"link",onClick:function(){return _(n)}},t("Edit")),o().createElement(a.Popconfirm,{title:t("Delete this override?"),onConfirm:function(){var r;return r=n.id,m(function(){var n;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiModelMetadata:destroy/".concat(r),method:"post"})];case 1:return o.sent(),a.message.success(t("Deleted successfully")),[4,V()];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),a.message.error((0,s.g)(n)),[3,4];case 4:return[2]}})})()}},o().createElement(a.Button,{type:"link",danger:!0},t("Delete"))))}}];return o().createElement(a.Card,{title:t("Model metadata"),extra:o().createElement(a.Button,{type:"primary",onClick:function(){D(void 0),I([]),r.resetFields(),r.setFieldsValue({enabled:!0}),U(!0)}},t("Add override"))},o().createElement(a.Table,{rowKey:"id",columns:R,dataSource:v,loading:C,scroll:{x:1450}}),o().createElement(a.Modal,{title:N?t("Edit override"):t("Add override"),open:B,onCancel:function(){return U(!1)},onOk:function(){return m(function(){var n,o,l,i,u,c,m,p,f,b;return y(this,function(y){switch(y.label){case 0:return[4,r.validateFields()];case 1:var v,h;v=d({},p=y.sent()),h=h={contextWindow:null!=(n=p.contextWindow)?n:null,maxCompletionTokens:null!=(o=p.maxCompletionTokens)?o:null,ownedByOverride:(null==(i=p.ownedByOverride)?void 0:i.trim())||null,displayName:(null==(u=p.displayName)?void 0:u.trim())||null,description:(null==(c=p.description)?void 0:c.trim())||null,systemPrompt:(null==(m=p.systemPrompt)?void 0:m.trim())||null,supportsVision:!!p.supportsVision,supportsToolCalling:!1!==p.supportsToolCalling,reasoningTier:p.reasoningTier||"general",sortOrder:null!=(l=p.sortOrder)?l:0},Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(h)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(h)).forEach(function(e){Object.defineProperty(v,e,Object.getOwnPropertyDescriptor(h,e))}),f=v,T(!0),y.label=2;case 2:return y.trys.push([2,5,6,7]),[4,e.api.request({url:N?"aiApiModelMetadata:update/".concat(N.id):"aiApiModelMetadata:create",method:"post",data:f})];case 3:return y.sent(),a.message.success(t("Saved successfully")),U(!1),[4,V()];case 4:return y.sent(),[3,7];case 5:return b=y.sent(),a.message.error((0,s.g)(b)),[3,7];case 6:return T(!1),[7];case 7:return[2]}})})()},confirmLoading:A,destroyOnClose:!0},o().createElement(a.Form,{form:r,layout:"vertical",preserve:!1},o().createElement(a.Form.Item,{name:"llmService",label:t("LLM service"),rules:[{required:!0}]},o().createElement(a.Select,{showSearch:!0,optionFilterProp:"label",onChange:function(e){r.setFieldValue("model",void 0),I([]),W(e)},options:w.map(function(e){return{label:e.title||e.name,value:e.name}})})),o().createElement(a.Form.Item,{name:"model",label:t("Model"),rules:[{required:!0}]},o().createElement(a.Select,{showSearch:!0,optionFilterProp:"label",loading:x,disabled:!c,placeholder:t("Select a model"),options:k.map(function(e){return{label:e.id,value:e.id}})})),o().createElement(a.Form.Item,{name:"contextWindow",label:t("Context window"),tooltip:t("Total input + output token capacity reported to clients.")},o().createElement(a.InputNumber,{min:1,precision:0,style:{width:"100%"},placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"maxCompletionTokens",label:t("Max completion tokens"),tooltip:t("Maximum output tokens reported to clients.")},o().createElement(a.InputNumber,{min:1,precision:0,style:{width:"100%"},placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"ownedByOverride",label:t("Owned by")},o().createElement(a.Input,{placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"displayName",label:t("Display name")},o().createElement(a.Input,{placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"description",label:t("Description")},o().createElement(a.Input.TextArea,{rows:3})),o().createElement(a.Form.Item,{name:"systemPrompt",label:t("Initial system prompt"),tooltip:t("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.")},o().createElement(a.Input.TextArea,{rows:4,placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"supportsVision",label:t("Supports vision"),valuePropName:"checked",tooltip:t("Used by virtual-model routing for image/file requests.")},o().createElement(a.Switch,null)),o().createElement(a.Form.Item,{name:"supportsToolCalling",label:t("Supports tool calling"),valuePropName:"checked",tooltip:t("Used by virtual-model routing for requests with tools/tool_choice.")},o().createElement(a.Switch,{defaultChecked:!0})),o().createElement(a.Form.Item,{name:"reasoningTier",label:t("Reasoning tier"),tooltip:t("cheap | general | reasoning. Used by virtual-model routing buckets.")},o().createElement(a.Select,{options:[{value:"cheap",label:t("Cheap")},{value:"general",label:t("General")},{value:"reasoning",label:t("Reasoning")}]})),o().createElement(a.Form.Item,{name:"sortOrder",label:t("Routing priority"),tooltip:t("Ascending — lower is preferred when a bucket is derived from metadata.")},o().createElement(a.InputNumber,{precision:0,style:{width:"100%"},placeholder:"0"})),o().createElement(a.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},o().createElement(a.Switch,null)))))}},650:function(e,t,r){r.d(t,{k:function(){return l}});var n=r(155),o=r(694),a=JSON.parse('{"UU":"plugin-ai-api"}');function l(){var e=(0,o.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[a.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 o(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 o},m:function(){return n}})}}]);
|
|
@@ -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([["685"],{244:function(e,t,r){r.r(t),r.d(t,{default:function(){return b}});var n=r(155),a=r.n(n),l=r(59),u=r(694),o=r(650),i=r(630);function s(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 c(e,t,r,n,a,l,u){try{var o=e[l](u),i=o.value}catch(e){r(e);return}o.done?t(i):Promise.resolve(i).then(n,a)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var l=e.apply(t,r);function u(e){c(l,n,a,u,o,"next",e)}function o(e){c(l,n,a,u,o,"throw",e)}u(void 0)})}}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l=[],u=!0,o=!1;try{for(a=a.call(e);!(u=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);u=!0);}catch(e){o=!0,n=e}finally{try{u||null==a.return||a.return()}finally{if(o)throw n}}return l}}(e,t)||p(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 p(e,t){if(e){if("string"==typeof e)return s(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 s(e,t)}}function f(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),o=Object.defineProperty;return o(u,"next",{value:i(0)}),o(u,"throw",{value:i(1)}),o(u,"return",{value:i(2)}),"function"==typeof Symbol&&o(u,Symbol.iterator,{value:function(){return this}}),u;function i(o){return function(i){var s=[o,i];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,n=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){l.label=s[1];break}if(6===s[0]&&l.label<a[1]){l.label=a[1],a=s;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(s);break}a[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}function b(){var e=(0,u.useFlowContext)(),t=(0,o.k)(),r=d(l.Form.useForm(),1)[0],c=d(l.Form.useForm(),1)[0],b=l.Form.useWatch("allowedLlmServices",r),h=l.Form.useWatch("allowAllModels",r),g=d((0,n.useState)([]),2),v=g[0],y=g[1],w=d((0,n.useState)([]),2),S=w[0],E=w[1],I=d((0,n.useState)(!1),2),M=I[0],k=I[1],A=d((0,n.useState)(!1),2),F=A[0],q=A[1],C=d((0,n.useState)(),2),U=C[0],T=C[1],x=d((0,n.useState)(!1),2),P=x[0],j=x[1],D=d((0,n.useState)([]),2),z=D[0],L=D[1],B=d((0,n.useState)(!1),2),G=B[0],N=B[1],$=d((0,n.useState)([]),2),O=$[0],R=$[1],_=d((0,n.useState)(""),2),W=_[0],K=_[1],V=d((0,n.useState)(null),2),J=V[0],H=V[1],Q=(0,n.useCallback)(function(){return m(function(){var r,n,a,u;return f(this,function(o){switch(o.label){case 0:k(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,e.api.request({url:"aiApiUsageGroups:list",method:"get",params:{pageSize:200,sort:"-updatedAt"}})];case 2:return r=o.sent(),y((0,i.m)(r,[])),[3,5];case 3:return n=o.sent(),l.message.error((0,i.g)(n)),[3,5];case 4:return k(!1),[7];case 5:return o.trys.push([5,7,,8]),[4,e.api.request({url:"ai:listAllEnabledModels",method:"get"})];case 6:return a=o.sent(),E((0,i.m)(a,[])),[3,8];case 7:return u=o.sent(),E([]),l.message.error("".concat(t("Failed to load models"),": ").concat((0,i.g)(u))),[3,8];case 8:return[2]}})})()},[e.api,t]),X=(0,n.useCallback)(function(t){return m(function(){var r,n;return f(this,function(a){switch(a.label){case 0:N(!0),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,e.api.request({url:"aiApiGroupMembers:list",method:"get",params:{filter:{groupId:t},pageSize:1e3,appends:["user"]}})];case 2:return r=a.sent(),L((0,i.m)(r,[])),[3,5];case 3:return n=a.sent(),l.message.error((0,i.g)(n)),[3,5];case 4:return N(!1),[7];case 5:return[2]}})})()},[e.api]),Y=(0,n.useCallback)(function(t){return m(function(){var r,n,a,u,o;return f(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiGroupMembers:list",method:"get",params:{fields:["userId"],paginate:!1,pageSize:1e4}})];case 1:return r=c.sent(),n=new Set((0,i.m)(r,[]).map(function(e){return String(e.userId)})),a=[],t&&a.push({$or:[{username:{$includes:t}},{email:{$includes:t}},{nickname:{$includes:t}}]}),n.size>0&&a.push({id:{$notIn:function(e){if(Array.isArray(e))return s(e)}(n)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||p(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}}),[4,e.api.request({url:"users:list",method:"get",params:{filter:a.length?{$and:a}:{},fields:["id","username","nickname","email"],pageSize:100}})];case 2:return u=c.sent(),R((0,i.m)(u,[])),[3,4];case 3:return o=c.sent(),l.message.error((0,i.g)(o)),[3,4];case 4:return[2]}})})()},[e.api]);(0,n.useEffect)(function(){Q()},[Q]);var Z=function(e){var t;return(null==e?void 0:e.nickname)||(null==e?void 0:e.username)||(null==e?void 0:e.email)||String(null!=(t=null==e?void 0:e.id)?t:"")},ee=(0,n.useMemo)(function(){return S.map(function(e){return{label:e.llmServiceTitle||e.llmService,value:e.llmService}})},[S]),et=(0,n.useMemo)(function(){var e=new Set(b||[]);return S.filter(function(t){return e.has(t.llmService)}).flatMap(function(e){return(e.enabledModels||[]).map(function(t){return{label:"".concat(e.llmServiceTitle||e.llmService," / ").concat(t.label||t.value),value:"".concat(e.llmService,"/").concat(t.value)}})})},[S,b]),er=function(e){var t;return(null==(t=ee.find(function(t){return t.value===e}))?void 0:t.label)||e},en=[{title:t("Name"),dataIndex:"name",key:"name",width:180},{title:t("Default"),dataIndex:"isDefault",key:"isDefault",width:100,render:function(e){return e?a().createElement(l.Tag,{color:"blue"},t("Default")):null}},{title:t("Mode"),dataIndex:"quotaMode",key:"quotaMode",width:120},{title:t("Rate limit/min"),dataIndex:"rateLimitPerMinute",key:"rateLimitPerMinute",width:140},{title:t("Model access"),key:"modelAccess",width:240,render:function(e,r){var n=r.allowedLlmServices||[],u=r.allowedModels||[],o=0===n.length,i=!1!==r.allowAllModels;return o&&i?a().createElement(l.Tag,{color:"blue"},t("All models")):a().createElement(l.Space,{size:[0,4],wrap:!0},a().createElement(l.Tag,null,o?t("All services"):n.map(function(e){return er(e)}).join(", ")),a().createElement(l.Tag,{color:i?"blue":void 0},i?t("All models"):u.length?u.join(", "):t("No models")))}},{title:t("Status"),dataIndex:"enabled",key:"enabled",width:100,render:function(e){return a().createElement(l.Tag,{color:e?"green":"default"},e?t("Enabled"):t("Disabled"))}},{title:t("Actions"),key:"actions",width:150,fixed:"right",render:function(n,u){return a().createElement(l.Space,{size:0},a().createElement(l.Button,{type:"link",onClick:function(){return m(function(){return f(this,function(e){switch(e.label){case 0:if(T(u),r.setFieldsValue(u),j(!0),u.isDefault)return[3,3];return[4,X(u.id)];case 1:return e.sent(),[4,Y()];case 2:e.sent(),e.label=3;case 3:return[2]}})})()}},t("Edit")),!u.isDefault&&a().createElement(l.Popconfirm,{title:t("Delete this group?"),onConfirm:function(){return m(function(){var r;return f(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiUsageGroups:destroy/".concat(u.id),method:"post"})];case 1:return n.sent(),l.message.success(t("Deleted successfully")),[4,Q()];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),l.message.error((0,i.g)(r)),[3,4];case 4:return[2]}})})()}},a().createElement(l.Button,{type:"link",danger:!0},t("Delete"))))}}],ea=[{title:t("User"),key:"user",render:function(e,t){return Z(t.user)||String(t.userId)}},{title:t("Actions"),key:"actions",width:120,render:function(r,n){return a().createElement(l.Popconfirm,{title:t("Remove member?"),onConfirm:function(){return m(function(){var r;return f(this,function(a){switch(a.label){case 0:return a.trys.push([0,5,,6]),[4,e.api.request({url:"aiApiGroupMembers:destroy/".concat(n.id),method:"post"})];case 1:if(a.sent(),l.message.success(t("Member removed")),!U)return[3,4];return[4,X(U.id)];case 2:return a.sent(),[4,Y()];case 3:a.sent(),a.label=4;case 4:return[3,6];case 5:return r=a.sent(),l.message.error((0,i.g)(r)),[3,6];case 6:return[2]}})})()}},a().createElement(l.Button,{type:"link",danger:!0},t("Remove")))}}];return a().createElement(l.Card,{title:t("Usage groups"),extra:a().createElement(l.Button,{type:"primary",onClick:function(){T(void 0),L([]),r.setFieldsValue({name:"",quotaMode:"per_user",rateLimitPerMinute:60,enabled:!0,periodType:"monthly",timezone:"UTC",currency:"USD",rejectUnpricedModel:!0,missingUsageBehavior:"use_reserved",contextOverflowBehavior:"reject",allowedLlmServices:[],allowAllModels:!0,allowedModels:[]}),j(!0)}},t("Add group"))},a().createElement(l.Row,{gutter:[16,16],style:{marginBottom:16}},a().createElement(l.Col,{span:12},a().createElement(l.Input.Search,{placeholder:t("Search group by user"),value:W,onChange:function(e){return K(e.target.value)},onSearch:function(){return m(function(){var r,n,a,u,o,s,c,m;return f(this,function(d){switch(d.label){case 0:if(!W.trim())return[2];d.label=1;case 1:return d.trys.push([1,5,,6]),[4,e.api.request({url:"users:list",method:"get",params:{filter:{$or:[{username:{$includes:W}},{email:{$includes:W}},{nickname:{$includes:W}}]},fields:["id","username","nickname","email"],pageSize:1}})];case 2:if(a=d.sent(),0===(u=(0,i.m)(a,[])).length)return l.message.warning(t("User not found")),H(null),[2];return[4,e.api.request({url:"aiApiGroupMembers:list",method:"get",params:{filter:{userId:u[0].id},appends:["group"],pageSize:1}})];case 3:if(o=d.sent(),null==(n=(s=(0,i.m)(o,[]))[0])?void 0:n.group)return H(s[0].group),[2];return[4,e.api.request({url:"aiApiUsageGroups:list",method:"get",params:{filter:{isDefault:!0},pageSize:1}})];case 4:return c=d.sent(),H(null!=(r=(0,i.m)(c,[])[0])?r:null),[3,6];case 5:return m=d.sent(),l.message.error((0,i.g)(m)),[3,6];case 6:return[2]}})})()},enterButton:!0})),a().createElement(l.Col,{span:12},J&&a().createElement(l.Tag,{color:"blue"},t("User belongs to"),": ",J.name))),a().createElement(l.Table,{rowKey:"id",columns:en,dataSource:v,loading:M,scroll:{x:700}}),a().createElement(l.Modal,{title:U?t("Edit group"):t("Add group"),open:P,onCancel:function(){return j(!1)},onOk:function(){return m(function(){var n,a;return f(this,function(u){switch(u.label){case 0:return[4,r.validateFields()];case 1:n=u.sent(),q(!0),u.label=2;case 2:return u.trys.push([2,5,6,7]),[4,e.api.request({url:U?"aiApiUsageGroups:update/".concat(U.id):"aiApiUsageGroups:create",method:"post",data:n})];case 3:return u.sent(),l.message.success(t("Saved successfully")),j(!1),[4,Q()];case 4:return u.sent(),[3,7];case 5:return a=u.sent(),l.message.error((0,i.g)(a)),[3,7];case 6:return q(!1),[7];case 7:return[2]}})})()},confirmLoading:F,destroyOnClose:!0,width:720},a().createElement(l.Form,{form:r,layout:"vertical",preserve:!1},a().createElement(l.Form.Item,{name:"name",label:t("Name"),rules:[{required:!0}]},a().createElement(l.Input,{disabled:null==U?void 0:U.isDefault})),a().createElement(l.Form.Item,{name:"quotaMode",label:t("Mode"),rules:[{required:!0}]},a().createElement(l.Select,{disabled:!!U,options:[{label:t("Share"),value:"share"},{label:t("Per user"),value:"per_user"}]})),a().createElement(l.Form.Item,{name:"rateLimitPerMinute",label:t("Rate limit per minute"),rules:[{required:!0}]},a().createElement(l.InputNumber,{min:1,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"periodType",label:t("Period"),rules:[{required:!0}]},a().createElement(l.Select,{options:[{label:t("Daily"),value:"daily"},{label:t("Monthly"),value:"monthly"}]})),a().createElement(l.Form.Item,{name:"timezone",label:t("Timezone"),rules:[{required:!0}]},a().createElement(l.Input,{placeholder:"UTC"})),a().createElement(l.Form.Item,{name:"requestLimit",label:t("Request limit")},a().createElement(l.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"totalTokenLimit",label:t("Token limit")},a().createElement(l.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"costLimit",label:t("Cost limit")},a().createElement(l.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"currency",label:t("Currency"),rules:[{required:!0}]},a().createElement(l.Input,null)),a().createElement(l.Form.Item,{name:"rejectUnpricedModel",label:t("Reject unpriced models"),valuePropName:"checked"},a().createElement(l.Switch,null)),a().createElement(l.Form.Item,{name:"missingUsageBehavior",label:t("Missing usage behavior"),rules:[{required:!0}]},a().createElement(l.Select,{options:[{label:t("Use reserved estimate"),value:"use_reserved"},{label:t("Allow without token charge"),value:"allow"}]})),a().createElement(l.Form.Item,{name:"contextOverflowBehavior",label:t("Context overflow behavior"),rules:[{required:!0}]},a().createElement(l.Select,{options:[{label:t("Reject request"),value:"reject"},{label:t("Truncate oldest conversation turns"),value:"truncate"}]})),a().createElement(l.Form.Item,{name:"allowedLlmServices",label:t("Allowed LLM services"),extra:t("Leave empty to allow every service enabled in the general configuration.")},a().createElement(l.Select,{mode:"multiple",allowClear:!0,showSearch:!0,optionFilterProp:"label",options:ee})),a().createElement(l.Form.Item,{name:"allowAllModels",label:t("Allow all models"),valuePropName:"checked"},a().createElement(l.Switch,null)),!1===h&&a().createElement(l.Form.Item,{name:"allowedModels",label:t("Allowed models")},a().createElement(l.Select,{mode:"multiple",allowClear:!0,showSearch:!0,optionFilterProp:"label",options:et})),a().createElement(l.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},a().createElement(l.Switch,null))),U&&a().createElement(l.Card,{title:U.isDefault?t("Membership"):t("Members"),size:"small",style:{marginTop:24}},U.isDefault?a().createElement(l.Alert,{type:"info",showIcon:!0,message:t("Users who do not belong to any other group automatically use this default group — no need to add members.")}):a().createElement(a().Fragment,null,a().createElement(l.Form,{form:c,layout:"inline"},a().createElement(l.Form.Item,{name:"userId",label:t("User"),rules:[{required:!0}],style:{minWidth:240}},a().createElement(l.Select,{showSearch:!0,optionFilterProp:"label",options:O.map(function(e){return{label:Z(e),value:e.id}}),onFocus:function(){return Y()}})),a().createElement(l.Form.Item,null,a().createElement(l.Button,{type:"primary",onClick:function(){return m(function(){var r,n;return f(this,function(a){switch(a.label){case 0:if(!U)return[2];return[4,c.validateFields()];case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,6,,7]),[4,e.api.request({url:"aiApiGroupMembers:create",method:"post",data:{groupId:U.id,userId:r.userId}})];case 3:return a.sent(),l.message.success(t("Member added")),c.resetFields(),[4,X(U.id)];case 4:return a.sent(),[4,Y()];case 5:return a.sent(),[3,7];case 6:return n=a.sent(),l.message.error((0,i.g)(n)),[3,7];case 7:return[2]}})})()}},t("Add member")))),a().createElement(l.Table,{rowKey:"id",columns:ea,dataSource:z,loading:G,pagination:!1,size:"small"})))))}},650:function(e,t,r){r.d(t,{k:function(){return u}});var n=r(155),a=r(694),l=JSON.parse('{"UU":"plugin-ai-api"}');function u(){var e=(0,a.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[l.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 a(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 a},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:"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}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/plugin-acl"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-ai-api",["@nocobase/plugin-acl","@nocobase/client-v2","dayjs","react","antd","@nocobase/client","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-ai-api"]=t(require("@nocobase/plugin-acl"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@nocobase/client"),require("@nocobase/flow-engine")):e["plugin-ai-api"]=t(e["@nocobase/plugin-acl"],e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@nocobase/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=o},485:function(e){e.exports=t},694:function(e){e.exports=a},823:function(t){t.exports=e},59:function(e){e.exports=i},185:function(e){e.exports=n},155:function(e){e.exports=r}},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+"."+({185:"c47663fefaeb0e5b",286:"a1ee0420172cd5de",302:"fbc46ebf5bf300d7",562:"9012cfd1fa04303d",685:"b5b1e0a5b825d253",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 _}});var e=f(342),t=f(823),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("185").then(f.bind(f,664))}),y=o().lazy(function(){return f.e("685").then(f.bind(f,244))}),m=o().lazy(function(){return f.e("757").then(f.bind(f,364))}),w=(0,e.lazy)(function(){return f.e("286").then(f.bind(f,421))},"AiApiRolePermissions").AiApiRolePermissions,_=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.model-routing",{title:this.t("Model routing"),Component:h,aclSnippet:r,sort:4}),this.app.pluginSettingsManager.add("ai-api.usage-groups",{title:this.t("Usage groups"),Component:y,aclSnippet:r,sort:5}),this.app.pluginSettingsManager.add("ai-api.usage",{title:this.t("Usage"),Component:m,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(w,{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([["185"],{664:function(e,t,r){r.r(t),r.d(t,{default:function(){return v}});var n=r(155),l=r.n(n),a=r(59),o=r(694),i=r(650),u=r(630);function s(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 c(e,t,r,n,l,a,o){try{var i=e[a](o),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,l)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,l){var a=e.apply(t,r);function o(e){c(a,n,l,o,i,"next",e)}function i(e){c(a,n,l,o,i,"throw",e)}o(void 0)})}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(r=l.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw n}}return a}}(e,t)||p(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 m(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){if(e){if("string"==typeof e)return s(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 s(e,t)}}function b(e,t){var r,n,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:u(0)}),i(o,"throw",{value:u(1)}),i(o,"return",{value:u(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function u(i){return function(u){var s=[i,u];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(l=2&s[0]?n.return:s[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,s[1])).done)return l;switch(n=0,l&&(s=[2&s[0],l.value]),s[0]){case 0:case 1:l=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(l=(l=a.trys).length>0&&l[l.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!l||s[1]>l[0]&&s[1]<l[3])){a.label=s[1];break}if(6===s[0]&&a.label<l[1]){a.label=l[1],l=s;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(s);break}l[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=l=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var h=a.Typography.Text,y="auto";function v(){var e=(0,o.useFlowContext)(),t=(0,i.k)(),r=f(a.Form.useForm(),1)[0],s=f((0,n.useState)(!0),2),c=s[0],p=s[1],v=f((0,n.useState)(!1),2),g=v[0],S=v[1],M=f((0,n.useState)([]),2),w=M[0],k=M[1],E=f((0,n.useState)(),2),O=E[0],A=E[1],F=(0,n.useCallback)(function(){return d(function(){var n,l,o,i,s,c,d,h,v,g,S,M,w,E,O,F,I,x,j,q,P,_,C,T,U,V,R,W;return b(this,function(b){switch(b.label){case 0:p(!0),b.label=1;case 1:return b.trys.push([1,3,4,5]),[4,Promise.all([e.api.request({url:"aiApiVirtualModels:list",method:"get",params:{filter:{name:y},pageSize:1}}),e.api.request({url:"ai:listAllEnabledModels",method:"get"})])];case 2:l=(n=f.apply(void 0,[b.sent(),2]))[0],o=n[1],i=(0,u.m)(o,[]),s=[],c=!0,d=!1,h=void 0;try{for(v=i[Symbol.iterator]();!(c=(g=v.next()).done);c=!0){M=(S=g.value).llmServiceTitle||S.llmService,w=!0,E=!1,O=void 0;try{for(F=(S.enabledModels||[])[Symbol.iterator]();!(w=(I=F.next()).done);w=!0)(null==(x=I.value)?void 0:x.value)&&s.push({value:"".concat(S.llmService,"/").concat(x.value),label:"".concat(M," / ").concat(x.label||x.value)})}catch(e){E=!0,O=e}finally{try{w||null==F.return||F.return()}finally{if(E)throw O}}}}catch(e){d=!0,h=e}finally{try{c||null==v.return||v.return()}finally{if(d)throw h}}if(j=(0,u.m)(l,[])[0]){q=new Set(s.map(function(e){return e.value})),P=[j.fallbackModel].concat(m(j.visionModels||[]),m(j.toolModels||[]),m(j.reasoningModels||[]),m(j.cheapModels||[]),m(j.generalModels||[])).filter(function(e){return"string"==typeof e&&e.length>0}),_=!0,C=!1,T=void 0;try{for(U=P[Symbol.iterator]();!(_=(V=U.next()).done);_=!0)R=V.value,q.has(R)||(q.add(R),s.push({value:R,label:"".concat(R," (").concat(t("unavailable"),")")}))}catch(e){C=!0,T=e}finally{try{_||null==U.return||U.return()}finally{if(C)throw T}}}return k(s),j?(A(j.id),r.setFieldsValue({name:j.name,mode:j.mode||"chat",fallbackModel:j.fallbackModel,visionModels:j.visionModels||[],toolModels:j.toolModels||[],reasoningModels:j.reasoningModels||[],cheapModels:j.cheapModels||[],generalModels:j.generalModels||[],enabled:!1!==j.enabled})):r.setFieldsValue({name:y,mode:"chat",fallbackModel:void 0,enabled:!0,visionModels:[],toolModels:[],reasoningModels:[],cheapModels:[],generalModels:[]}),[3,5];case 3:return W=b.sent(),a.message.error((0,u.g)(W)),[3,5];case 4:return p(!1),[7];case 5:return[2]}})})()},[e.api,r,t]);(0,n.useEffect)(function(){F()},[F]);var I={options:w,optionFilterProp:"label",showSearch:!0,loading:c},x=function(e,r,n){return l().createElement(a.Form.Item,{name:e,label:r,tooltip:n},l().createElement(a.Select,function(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}({mode:"multiple",placeholder:t("Select models — the order shown is the routing priority")},I)))};return l().createElement(a.Card,{loading:c,title:t("Model routing (virtual models)")},l().createElement(a.Form,{form:r,layout:"vertical"},l().createElement(a.Form.Item,{name:"name",label:t("Alias"),rules:[{required:!0}]},l().createElement(a.Input,{disabled:!0,style:{maxWidth:240}})),l().createElement(a.Form.Item,{name:"mode",hidden:!0},l().createElement(a.Input,null)),l().createElement(a.Form.Item,{name:"fallbackModel",label:t("Fallback model"),rules:[{required:!0,message:t("A fallback model is required")}],tooltip:t("Used when no capability bucket candidate is usable and the fallback is permitted for the caller.")},l().createElement(a.Select,{placeholder:t("Select a fallback model"),options:w,optionFilterProp:"label",showSearch:!0,style:{maxWidth:480}})),x("visionModels",t("Vision models (in order)"),t("Requests with an image or file block use the first permitted model here.")),x("toolModels",t("Tool-calling models (in order)"),t("Requests with tools/tool_choice use the first permitted model here.")),x("reasoningModels",t("Reasoning models (in order)"),t("Requests with an explicit reasoning or reasoning_effort parameter use the first permitted model here.")),x("cheapModels",t("Cheap models (in order)"),t("Optional. When set, cheap-eligible requests use the first permitted model here.")),x("generalModels",t("General models (in order)"),t("Default bucket when no capability rule matched. Leave empty to derive from all enabled models ordered by Model metadata sortOrder.")),l().createElement(a.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},l().createElement(a.Switch,null)),l().createElement(a.Space,null,l().createElement(a.Button,{type:"primary",onClick:function(){return d(function(){var n,l,o,i;return b(this,function(s){switch(s.label){case 0:return[4,r.validateFields()];case 1:n=s.sent(),S(!0),s.label=2;case 2:if(s.trys.push([2,7,8,9]),!O)return[3,4];return[4,e.api.request({url:"aiApiVirtualModels:update/".concat(O),method:"post",data:n})];case 3:return s.sent(),[3,6];case 4:return[4,e.api.request({url:"aiApiVirtualModels:create",method:"post",data:n})];case 5:l=s.sent(),(null==(o=(0,u.m)(l,void 0))?void 0:o.id)&&A(o.id),s.label=6;case 6:return a.message.success(t("Saved successfully")),[3,9];case 7:return i=s.sent(),a.message.error((0,u.g)(i)),[3,9];case 8:return S(!1),[7];case 9:return[2]}})})()},loading:g},t("Save")),l().createElement(h,{type:"secondary"},t("An empty bucket is derived automatically from Model metadata (capability flags + sortOrder).")))))}},650:function(e,t,r){r.d(t,{k:function(){return o}});var n=r(155),l=r(694),a=JSON.parse('{"UU":"plugin-ai-api"}');function o(){var e=(0,l.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[a.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 l(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 l},m:function(){return n}})}}]);
|
|
@@ -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([["562"],{641:function(e,t,r){r.r(t),r.d(t,{default:function(){return b}});var n=r(155),o=r.n(n),a=r(59),l=r(694),i=r(650),s=r(630);function u(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 c(e,t,r,n,o,a,l){try{var i=e[a](l),s=i.value}catch(e){r(e);return}i.done?t(s):Promise.resolve(s).then(n,o)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){c(a,n,o,l,i,"next",e)}function i(e){c(a,n,o,l,i,"throw",e)}l(void 0)})}}function d(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 p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(e,t)||f(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 f(e,t){if(e){if("string"==typeof e)return u(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 u(e,t)}}function y(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var u=[i,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function b(){var e=(0,l.useFlowContext)(),t=(0,i.k)(),r=p(a.Form.useForm(),1)[0],c=a.Form.useWatch("llmService",r),b=p((0,n.useState)([]),2),v=b[0],h=b[1],g=p((0,n.useState)([]),2),w=g[0],S=g[1],E=p((0,n.useState)([]),2),k=E[0],I=E[1],O=p((0,n.useState)(!1),2),x=O[0],F=O[1],P=p((0,n.useState)(!1),2),C=P[0],j=P[1],M=p((0,n.useState)(!1),2),A=M[0],T=M[1],L=p((0,n.useState)(),2),N=L[0],D=L[1],q=p((0,n.useState)(!1),2),_=q[0],B=q[1],U=(0,n.useCallback)(function(){return m(function(){var t,r,n,o;return y(this,function(l){switch(l.label){case 0:j(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,Promise.all([e.api.request({url:"aiApiModelMetadata:list",method:"get",params:{pageSize:200,sort:"llmService"}}),e.api.request({url:"ai:listLLMServices",method:"get"})])];case 2:return r=(t=p.apply(void 0,[l.sent(),2]))[0],n=t[1],h((0,s.m)(r,[])),S((0,s.m)(n,[])),[3,5];case 3:return o=l.sent(),a.message.error((0,s.g)(o)),[3,5];case 4:return j(!1),[7];case 5:return[2]}})})()},[e.api]);(0,n.useEffect)(function(){U()},[U]);var V=(0,n.useCallback)(function(r,n){return m(function(){var o,l,i;return y(this,function(c){switch(c.label){case 0:F(!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 o=c.sent(),l=(0,s.m)(o,[]),I(n&&!l.some(function(e){return e.id===n})?[{id:n}].concat(function(e){if(Array.isArray(e))return u(e)}(l)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||f(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 i=c.sent(),I(n?[{id:n}]:[]),a.message.error("".concat(t("Failed to load models"),": ").concat((0,s.g)(i))),[3,5];case 4:return F(!1),[7];case 5:return[2]}})})()},[e.api,t]),W=function(e){D(e),r.setFieldsValue(d({},e)),B(!0),V(e.llmService,e.model)},R=[{title:t("LLM service"),dataIndex:"llmService",key:"llmService",width:160},{title:t("Model"),dataIndex:"model",key:"model",width:180},{title:t("Context window"),dataIndex:"contextWindow",key:"contextWindow",width:140},{title:t("Max completion tokens"),dataIndex:"maxCompletionTokens",key:"maxCompletionTokens",width:170},{title:t("Owned by"),dataIndex:"ownedByOverride",key:"ownedByOverride",width:140},{title:t("Display name"),dataIndex:"displayName",key:"displayName",width:160},{title:t("Initial system prompt"),dataIndex:"systemPrompt",key:"systemPrompt",width:220,ellipsis:!0,render:function(e){return e||"-"}},{title:t("Status"),dataIndex:"enabled",key:"enabled",width:100,render:function(e){return o().createElement(a.Tag,{color:e?"green":"default"},e?t("Enabled"):t("Disabled"))}},{title:t("Actions"),key:"actions",fixed:"right",width:150,render:function(r,n){return o().createElement(a.Space,null,o().createElement(a.Button,{type:"link",onClick:function(){return W(n)}},t("Edit")),o().createElement(a.Popconfirm,{title:t("Delete this override?"),onConfirm:function(){var r;return r=n.id,m(function(){var n;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiModelMetadata:destroy/".concat(r),method:"post"})];case 1:return o.sent(),a.message.success(t("Deleted successfully")),[4,U()];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),a.message.error((0,s.g)(n)),[3,4];case 4:return[2]}})})()}},o().createElement(a.Button,{type:"link",danger:!0},t("Delete"))))}}];return o().createElement(a.Card,{title:t("Model metadata"),extra:o().createElement(a.Button,{type:"primary",onClick:function(){D(void 0),I([]),r.resetFields(),r.setFieldsValue({enabled:!0}),B(!0)}},t("Add override"))},o().createElement(a.Table,{rowKey:"id",columns:R,dataSource:v,loading:C,scroll:{x:1450}}),o().createElement(a.Modal,{title:N?t("Edit override"):t("Add override"),open:_,onCancel:function(){return B(!1)},onOk:function(){return m(function(){var n,o,l,i,u,c,m,p,f,b;return y(this,function(y){switch(y.label){case 0:return[4,r.validateFields()];case 1:var v,h;v=d({},p=y.sent()),h=h={contextWindow:null!=(n=p.contextWindow)?n:null,maxCompletionTokens:null!=(o=p.maxCompletionTokens)?o:null,ownedByOverride:(null==(i=p.ownedByOverride)?void 0:i.trim())||null,displayName:(null==(u=p.displayName)?void 0:u.trim())||null,description:(null==(c=p.description)?void 0:c.trim())||null,systemPrompt:(null==(m=p.systemPrompt)?void 0:m.trim())||null,supportsVision:!!p.supportsVision,supportsToolCalling:!1!==p.supportsToolCalling,reasoningTier:p.reasoningTier||"general",sortOrder:null!=(l=p.sortOrder)?l:0},Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(h)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(h)).forEach(function(e){Object.defineProperty(v,e,Object.getOwnPropertyDescriptor(h,e))}),f=v,T(!0),y.label=2;case 2:return y.trys.push([2,5,6,7]),[4,e.api.request({url:N?"aiApiModelMetadata:update/".concat(N.id):"aiApiModelMetadata:create",method:"post",data:f})];case 3:return y.sent(),a.message.success(t("Saved successfully")),B(!1),[4,U()];case 4:return y.sent(),[3,7];case 5:return b=y.sent(),a.message.error((0,s.g)(b)),[3,7];case 6:return T(!1),[7];case 7:return[2]}})})()},confirmLoading:A,destroyOnClose:!0},o().createElement(a.Form,{form:r,layout:"vertical",preserve:!1},o().createElement(a.Form.Item,{name:"llmService",label:t("LLM service"),rules:[{required:!0}]},o().createElement(a.Select,{showSearch:!0,optionFilterProp:"label",onChange:function(e){r.setFieldValue("model",void 0),I([]),V(e)},options:w.map(function(e){return{label:e.title||e.name,value:e.name}})})),o().createElement(a.Form.Item,{name:"model",label:t("Model"),rules:[{required:!0}]},o().createElement(a.Select,{showSearch:!0,optionFilterProp:"label",loading:x,disabled:!c,placeholder:t("Select a model"),options:k.map(function(e){return{label:e.id,value:e.id}})})),o().createElement(a.Form.Item,{name:"contextWindow",label:t("Context window"),tooltip:t("Total input + output token capacity reported to clients.")},o().createElement(a.InputNumber,{min:1,precision:0,style:{width:"100%"},placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"maxCompletionTokens",label:t("Max completion tokens"),tooltip:t("Maximum output tokens reported to clients.")},o().createElement(a.InputNumber,{min:1,precision:0,style:{width:"100%"},placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"ownedByOverride",label:t("Owned by")},o().createElement(a.Input,{placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"displayName",label:t("Display name")},o().createElement(a.Input,{placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"description",label:t("Description")},o().createElement(a.Input.TextArea,{rows:3})),o().createElement(a.Form.Item,{name:"systemPrompt",label:t("Initial system prompt"),tooltip:t("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.")},o().createElement(a.Input.TextArea,{rows:4,placeholder:t("Leave empty to not override")})),o().createElement(a.Form.Item,{name:"supportsVision",label:t("Supports vision"),valuePropName:"checked",tooltip:t("Used by virtual-model routing for image/file requests.")},o().createElement(a.Switch,null)),o().createElement(a.Form.Item,{name:"supportsToolCalling",label:t("Supports tool calling"),valuePropName:"checked",tooltip:t("Used by virtual-model routing for requests with tools/tool_choice.")},o().createElement(a.Switch,{defaultChecked:!0})),o().createElement(a.Form.Item,{name:"reasoningTier",label:t("Reasoning tier"),tooltip:t("cheap | general | reasoning. Used by virtual-model routing buckets.")},o().createElement(a.Select,{options:[{value:"cheap",label:t("Cheap")},{value:"general",label:t("General")},{value:"reasoning",label:t("Reasoning")}]})),o().createElement(a.Form.Item,{name:"sortOrder",label:t("Routing priority"),tooltip:t("Ascending — lower is preferred when a bucket is derived from metadata.")},o().createElement(a.InputNumber,{precision:0,style:{width:"100%"},placeholder:"0"})),o().createElement(a.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},o().createElement(a.Switch,null)))))}},650:function(e,t,r){r.d(t,{k:function(){return l}});var n=r(155),o=r(694),a=JSON.parse('{"UU":"plugin-ai-api"}');function l(){var e=(0,o.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[a.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 o(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 o},m:function(){return n}})}}]);
|
|
@@ -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([["685"],{244:function(e,t,r){r.r(t),r.d(t,{default:function(){return b}});var n=r(155),a=r.n(n),l=r(59),u=r(694),o=r(650),i=r(630);function s(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 c(e,t,r,n,a,l,u){try{var o=e[l](u),i=o.value}catch(e){r(e);return}o.done?t(i):Promise.resolve(i).then(n,a)}function m(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var l=e.apply(t,r);function u(e){c(l,n,a,u,o,"next",e)}function o(e){c(l,n,a,u,o,"throw",e)}u(void 0)})}}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l=[],u=!0,o=!1;try{for(a=a.call(e);!(u=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);u=!0);}catch(e){o=!0,n=e}finally{try{u||null==a.return||a.return()}finally{if(o)throw n}}return l}}(e,t)||p(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 p(e,t){if(e){if("string"==typeof e)return s(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 s(e,t)}}function f(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),o=Object.defineProperty;return o(u,"next",{value:i(0)}),o(u,"throw",{value:i(1)}),o(u,"return",{value:i(2)}),"function"==typeof Symbol&&o(u,Symbol.iterator,{value:function(){return this}}),u;function i(o){return function(i){var s=[o,i];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,n=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){l.label=s[1];break}if(6===s[0]&&l.label<a[1]){l.label=a[1],a=s;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(s);break}a[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}function b(){var e=(0,u.useFlowContext)(),t=(0,o.k)(),r=d(l.Form.useForm(),1)[0],c=d(l.Form.useForm(),1)[0],b=l.Form.useWatch("allowedLlmServices",r),h=l.Form.useWatch("allowAllModels",r),g=d((0,n.useState)([]),2),v=g[0],y=g[1],w=d((0,n.useState)([]),2),S=w[0],E=w[1],I=d((0,n.useState)(!1),2),M=I[0],k=I[1],A=d((0,n.useState)(!1),2),F=A[0],q=A[1],C=d((0,n.useState)(),2),U=C[0],T=C[1],x=d((0,n.useState)(!1),2),P=x[0],j=x[1],D=d((0,n.useState)([]),2),z=D[0],L=D[1],_=d((0,n.useState)(!1),2),B=_[0],G=_[1],N=d((0,n.useState)([]),2),$=N[0],O=N[1],R=d((0,n.useState)(""),2),W=R[0],K=R[1],V=d((0,n.useState)(null),2),J=V[0],H=V[1],Q=(0,n.useCallback)(function(){return m(function(){var r,n,a,u;return f(this,function(o){switch(o.label){case 0:k(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,e.api.request({url:"aiApiUsageGroups:list",method:"get",params:{pageSize:200,sort:"-updatedAt"}})];case 2:return r=o.sent(),y((0,i.m)(r,[])),[3,5];case 3:return n=o.sent(),l.message.error((0,i.g)(n)),[3,5];case 4:return k(!1),[7];case 5:return o.trys.push([5,7,,8]),[4,e.api.request({url:"ai:listAllEnabledModels",method:"get"})];case 6:return a=o.sent(),E((0,i.m)(a,[])),[3,8];case 7:return u=o.sent(),E([]),l.message.error("".concat(t("Failed to load models"),": ").concat((0,i.g)(u))),[3,8];case 8:return[2]}})})()},[e.api,t]),X=(0,n.useCallback)(function(t){return m(function(){var r,n;return f(this,function(a){switch(a.label){case 0:G(!0),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,e.api.request({url:"aiApiGroupMembers:list",method:"get",params:{filter:{groupId:t},pageSize:1e3,appends:["user"]}})];case 2:return r=a.sent(),L((0,i.m)(r,[])),[3,5];case 3:return n=a.sent(),l.message.error((0,i.g)(n)),[3,5];case 4:return G(!1),[7];case 5:return[2]}})})()},[e.api]),Y=(0,n.useCallback)(function(t){return m(function(){var r,n,a,u,o;return f(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiGroupMembers:list",method:"get",params:{fields:["userId"],paginate:!1,pageSize:1e4}})];case 1:return r=c.sent(),n=new Set((0,i.m)(r,[]).map(function(e){return String(e.userId)})),a=[],t&&a.push({$or:[{username:{$includes:t}},{email:{$includes:t}},{nickname:{$includes:t}}]}),n.size>0&&a.push({id:{$notIn:function(e){if(Array.isArray(e))return s(e)}(n)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||p(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}}),[4,e.api.request({url:"users:list",method:"get",params:{filter:a.length?{$and:a}:{},fields:["id","username","nickname","email"],pageSize:100}})];case 2:return u=c.sent(),O((0,i.m)(u,[])),[3,4];case 3:return o=c.sent(),l.message.error((0,i.g)(o)),[3,4];case 4:return[2]}})})()},[e.api]);(0,n.useEffect)(function(){Q()},[Q]);var Z=function(e){var t;return(null==e?void 0:e.nickname)||(null==e?void 0:e.username)||(null==e?void 0:e.email)||String(null!=(t=null==e?void 0:e.id)?t:"")},ee=(0,n.useMemo)(function(){return S.map(function(e){return{label:e.llmServiceTitle||e.llmService,value:e.llmService}})},[S]),et=(0,n.useMemo)(function(){var e=new Set(b||[]);return S.filter(function(t){return e.has(t.llmService)}).flatMap(function(e){return(e.enabledModels||[]).map(function(t){return{label:"".concat(e.llmServiceTitle||e.llmService," / ").concat(t.label||t.value),value:"".concat(e.llmService,"/").concat(t.value)}})})},[S,b]),er=function(e){var t;return(null==(t=ee.find(function(t){return t.value===e}))?void 0:t.label)||e},en=[{title:t("Name"),dataIndex:"name",key:"name",width:180},{title:t("Default"),dataIndex:"isDefault",key:"isDefault",width:100,render:function(e){return e?a().createElement(l.Tag,{color:"blue"},t("Default")):null}},{title:t("Mode"),dataIndex:"quotaMode",key:"quotaMode",width:120},{title:t("Rate limit/min"),dataIndex:"rateLimitPerMinute",key:"rateLimitPerMinute",width:140},{title:t("Model access"),key:"modelAccess",width:240,render:function(e,r){var n=r.allowedLlmServices||[],u=r.allowedModels||[],o=0===n.length,i=!1!==r.allowAllModels;return o&&i?a().createElement(l.Tag,{color:"blue"},t("All models")):a().createElement(l.Space,{size:[0,4],wrap:!0},a().createElement(l.Tag,null,o?t("All services"):n.map(function(e){return er(e)}).join(", ")),a().createElement(l.Tag,{color:i?"blue":void 0},i?t("All models"):u.length?u.join(", "):t("No models")))}},{title:t("Status"),dataIndex:"enabled",key:"enabled",width:100,render:function(e){return a().createElement(l.Tag,{color:e?"green":"default"},e?t("Enabled"):t("Disabled"))}},{title:t("Actions"),key:"actions",width:150,fixed:"right",render:function(n,u){return a().createElement(l.Space,{size:0},a().createElement(l.Button,{type:"link",onClick:function(){return m(function(){return f(this,function(e){switch(e.label){case 0:if(T(u),r.setFieldsValue(u),j(!0),u.isDefault)return[3,3];return[4,X(u.id)];case 1:return e.sent(),[4,Y()];case 2:e.sent(),e.label=3;case 3:return[2]}})})()}},t("Edit")),!u.isDefault&&a().createElement(l.Popconfirm,{title:t("Delete this group?"),onConfirm:function(){return m(function(){var r;return f(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,e.api.request({url:"aiApiUsageGroups:destroy/".concat(u.id),method:"post"})];case 1:return n.sent(),l.message.success(t("Deleted successfully")),[4,Q()];case 2:return n.sent(),[3,4];case 3:return r=n.sent(),l.message.error((0,i.g)(r)),[3,4];case 4:return[2]}})})()}},a().createElement(l.Button,{type:"link",danger:!0},t("Delete"))))}}],ea=[{title:t("User"),key:"user",render:function(e,t){return Z(t.user)||String(t.userId)}},{title:t("Actions"),key:"actions",width:120,render:function(r,n){return a().createElement(l.Popconfirm,{title:t("Remove member?"),onConfirm:function(){return m(function(){var r;return f(this,function(a){switch(a.label){case 0:return a.trys.push([0,5,,6]),[4,e.api.request({url:"aiApiGroupMembers:destroy/".concat(n.id),method:"post"})];case 1:if(a.sent(),l.message.success(t("Member removed")),!U)return[3,4];return[4,X(U.id)];case 2:return a.sent(),[4,Y()];case 3:a.sent(),a.label=4;case 4:return[3,6];case 5:return r=a.sent(),l.message.error((0,i.g)(r)),[3,6];case 6:return[2]}})})()}},a().createElement(l.Button,{type:"link",danger:!0},t("Remove")))}}];return a().createElement(l.Card,{title:t("Usage groups"),extra:a().createElement(l.Button,{type:"primary",onClick:function(){T(void 0),L([]),r.setFieldsValue({name:"",quotaMode:"per_user",rateLimitPerMinute:60,enabled:!0,periodType:"monthly",timezone:"UTC",currency:"USD",rejectUnpricedModel:!0,missingUsageBehavior:"use_reserved",contextOverflowBehavior:"reject",allowedLlmServices:[],allowAllModels:!0,allowedModels:[]}),j(!0)}},t("Add group"))},a().createElement(l.Row,{gutter:[16,16],style:{marginBottom:16}},a().createElement(l.Col,{span:12},a().createElement(l.Input.Search,{placeholder:t("Search group by user"),value:W,onChange:function(e){return K(e.target.value)},onSearch:function(){return m(function(){var r,n,a,u,o,s,c,m;return f(this,function(d){switch(d.label){case 0:if(!W.trim())return[2];d.label=1;case 1:return d.trys.push([1,5,,6]),[4,e.api.request({url:"users:list",method:"get",params:{filter:{$or:[{username:{$includes:W}},{email:{$includes:W}},{nickname:{$includes:W}}]},fields:["id","username","nickname","email"],pageSize:1}})];case 2:if(a=d.sent(),0===(u=(0,i.m)(a,[])).length)return l.message.warning(t("User not found")),H(null),[2];return[4,e.api.request({url:"aiApiGroupMembers:list",method:"get",params:{filter:{userId:u[0].id},appends:["group"],pageSize:1}})];case 3:if(o=d.sent(),null==(n=(s=(0,i.m)(o,[]))[0])?void 0:n.group)return H(s[0].group),[2];return[4,e.api.request({url:"aiApiUsageGroups:list",method:"get",params:{filter:{isDefault:!0},pageSize:1}})];case 4:return c=d.sent(),H(null!=(r=(0,i.m)(c,[])[0])?r:null),[3,6];case 5:return m=d.sent(),l.message.error((0,i.g)(m)),[3,6];case 6:return[2]}})})()},enterButton:!0})),a().createElement(l.Col,{span:12},J&&a().createElement(l.Tag,{color:"blue"},t("User belongs to"),": ",J.name))),a().createElement(l.Table,{rowKey:"id",columns:en,dataSource:v,loading:M,scroll:{x:700}}),a().createElement(l.Modal,{title:U?t("Edit group"):t("Add group"),open:P,onCancel:function(){return j(!1)},onOk:function(){return m(function(){var n,a;return f(this,function(u){switch(u.label){case 0:return[4,r.validateFields()];case 1:n=u.sent(),q(!0),u.label=2;case 2:return u.trys.push([2,5,6,7]),[4,e.api.request({url:U?"aiApiUsageGroups:update/".concat(U.id):"aiApiUsageGroups:create",method:"post",data:n})];case 3:return u.sent(),l.message.success(t("Saved successfully")),j(!1),[4,Q()];case 4:return u.sent(),[3,7];case 5:return a=u.sent(),l.message.error((0,i.g)(a)),[3,7];case 6:return q(!1),[7];case 7:return[2]}})})()},confirmLoading:F,destroyOnClose:!0,width:720},a().createElement(l.Form,{form:r,layout:"vertical",preserve:!1},a().createElement(l.Form.Item,{name:"name",label:t("Name"),rules:[{required:!0}]},a().createElement(l.Input,{disabled:null==U?void 0:U.isDefault})),a().createElement(l.Form.Item,{name:"quotaMode",label:t("Mode"),rules:[{required:!0}]},a().createElement(l.Select,{disabled:!!U,options:[{label:t("Share"),value:"share"},{label:t("Per user"),value:"per_user"}]})),a().createElement(l.Form.Item,{name:"rateLimitPerMinute",label:t("Rate limit per minute"),rules:[{required:!0}]},a().createElement(l.InputNumber,{min:1,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"periodType",label:t("Period"),rules:[{required:!0}]},a().createElement(l.Select,{options:[{label:t("Daily"),value:"daily"},{label:t("Monthly"),value:"monthly"}]})),a().createElement(l.Form.Item,{name:"timezone",label:t("Timezone"),rules:[{required:!0}]},a().createElement(l.Input,{placeholder:"UTC"})),a().createElement(l.Form.Item,{name:"requestLimit",label:t("Request limit")},a().createElement(l.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"totalTokenLimit",label:t("Token limit")},a().createElement(l.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"costLimit",label:t("Cost limit")},a().createElement(l.InputNumber,{min:0,stringMode:!0,style:{width:"100%"}})),a().createElement(l.Form.Item,{name:"currency",label:t("Currency"),rules:[{required:!0}]},a().createElement(l.Input,null)),a().createElement(l.Form.Item,{name:"rejectUnpricedModel",label:t("Reject unpriced models"),valuePropName:"checked"},a().createElement(l.Switch,null)),a().createElement(l.Form.Item,{name:"missingUsageBehavior",label:t("Missing usage behavior"),rules:[{required:!0}]},a().createElement(l.Select,{options:[{label:t("Use reserved estimate"),value:"use_reserved"},{label:t("Allow without token charge"),value:"allow"}]})),a().createElement(l.Form.Item,{name:"contextOverflowBehavior",label:t("Context overflow behavior"),rules:[{required:!0}]},a().createElement(l.Select,{options:[{label:t("Reject request"),value:"reject"},{label:t("Truncate oldest conversation turns"),value:"truncate"}]})),a().createElement(l.Form.Item,{name:"allowedLlmServices",label:t("Allowed LLM services"),extra:t("Leave empty to allow every service enabled in the general configuration.")},a().createElement(l.Select,{mode:"multiple",allowClear:!0,showSearch:!0,optionFilterProp:"label",options:ee})),a().createElement(l.Form.Item,{name:"allowAllModels",label:t("Allow all models"),valuePropName:"checked"},a().createElement(l.Switch,null)),!1===h&&a().createElement(l.Form.Item,{name:"allowedModels",label:t("Allowed models")},a().createElement(l.Select,{mode:"multiple",allowClear:!0,showSearch:!0,optionFilterProp:"label",options:et})),a().createElement(l.Form.Item,{name:"enabled",label:t("Enabled"),valuePropName:"checked"},a().createElement(l.Switch,null))),U&&a().createElement(l.Card,{title:U.isDefault?t("Membership"):t("Members"),size:"small",style:{marginTop:24}},U.isDefault?a().createElement(l.Alert,{type:"info",showIcon:!0,message:t("Users who do not belong to any other group automatically use this default group — no need to add members.")}):a().createElement(a().Fragment,null,a().createElement(l.Form,{form:c,layout:"inline"},a().createElement(l.Form.Item,{name:"userId",label:t("User"),rules:[{required:!0}],style:{minWidth:240}},a().createElement(l.Select,{showSearch:!0,optionFilterProp:"label",options:$.map(function(e){return{label:Z(e),value:e.id}}),onFocus:function(){return Y()}})),a().createElement(l.Form.Item,null,a().createElement(l.Button,{type:"primary",onClick:function(){return m(function(){var r,n;return f(this,function(a){switch(a.label){case 0:if(!U)return[2];return[4,c.validateFields()];case 1:r=a.sent(),a.label=2;case 2:return a.trys.push([2,6,,7]),[4,e.api.request({url:"aiApiGroupMembers:create",method:"post",data:{groupId:U.id,userId:r.userId}})];case 3:return a.sent(),l.message.success(t("Member added")),c.resetFields(),[4,X(U.id)];case 4:return a.sent(),[4,Y()];case 5:return a.sent(),[3,7];case 6:return n=a.sent(),l.message.error((0,i.g)(n)),[3,7];case 7:return[2]}})})()}},t("Add member")))),a().createElement(l.Table,{rowKey:"id",columns:ea,dataSource:z,loading:B,pagination:!1,size:"small"})))))}},650:function(e,t,r){r.d(t,{k:function(){return u}});var n=r(155),a=r(694),l=JSON.parse('{"UU":"plugin-ai-api"}');function u(){var e=(0,a.useFlowEngine)();return(0,n.useCallback)(function(t){return e.context.t(t,{ns:[l.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 a(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 a},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,
|
|
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,i){return function(){"use strict";var o,a,u,c={485:function(t){t.exports=e},694:function(e){e.exports=i},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+"."+({185:"b552dc91ec2371ba",302:"3971233415999b2c",562:"db2984167250b1be",685:"cf16e5b829e06f85",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 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/client-v2:"+n){i=c;break}}i||(o=!0,(i=document.createElement("script")).timeout=120,p.nc&&i.setAttribute("nonce",p.nc),i.setAttribute("data-rspack","plugin-ai-api/client-v2:"+n),i.src=e),s[e]=[t];var l=function(t,n){i.onerror=i.onload=null,clearTimeout(f);var r=s[e];if(delete s[e],i.parentNode&&i.parentNode.removeChild(i),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=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)},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(/\/[^\/]+$/,"/"),o={889:0},p.f.j=function(e,t){var n=p.o(o,e)?o[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=o[e]=[t,r]});t.push(n[2]=r);var i=p.p+p.u(e),a=Error();p.l(i,function(t){if(p.o(o,e)&&(0!==(n=o[e])&&(o[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,n[1](a)}},"chunk-"+e,e)}},a=function(e,t){var n,r,i=t[0],a=t[1],u=t[2],c=0;if(i.some(function(e){return 0!==o[e]})){for(n in a)p.o(a,n)&&(p.m[n]=a[n]);u&&u(p)}for(e&&e(t);c<i.length;c++)r=i[c],p.o(o,r)&&o[r]&&o[r][0](),o[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 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-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,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 r(e,t,n){return(r=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=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,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(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=i(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||[],i(this).constructor):e.apply(this,t))}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&o(a,e),r=[{key:"load",value:function(){var e;return(e=function(){var e,n,r;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(i){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:"model-routing",title:this.t("Model routing"),aclSnippet:t,sort:4,componentLoader:function(){return p.e("185").then(p.bind(p,664))}}),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(i,o){var a=e.apply(t,r);function u(e){n(a,i,o,u,c,"next",e)}function c(e){n(a,i,o,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.
|
|
12
|
-
"@nocobase/plugin-acl": "2.
|
|
11
|
+
"@nocobase/client": "2.2.5",
|
|
12
|
+
"@nocobase/plugin-acl": "2.2.5",
|
|
13
13
|
"react": "18.2.0",
|
|
14
|
-
"@nocobase/flow-engine": "2.
|
|
15
|
-
"@nocobase/client-v2": "2.
|
|
16
|
-
"@nocobase/actions": "2.
|
|
14
|
+
"@nocobase/flow-engine": "2.2.5",
|
|
15
|
+
"@nocobase/client-v2": "2.2.5",
|
|
16
|
+
"@nocobase/actions": "2.2.5",
|
|
17
17
|
"dayjs": "1.11.13",
|
|
18
|
-
"@nocobase/database": "2.
|
|
18
|
+
"@nocobase/database": "2.2.5",
|
|
19
19
|
"sequelize": "6.35.2",
|
|
20
|
-
"@nocobase/server": "2.
|
|
20
|
+
"@nocobase/server": "2.2.5",
|
|
21
21
|
"antd": "5.24.2",
|
|
22
|
-
"@nocobase/resourcer": "2.
|
|
22
|
+
"@nocobase/resourcer": "2.2.5"
|
|
23
23
|
};
|