plugin-ai-api 1.0.15 → 1.0.21

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.
Files changed (92) hide show
  1. package/dist/client/286.01c0e3c5fff3cccb.js +10 -0
  2. package/dist/client/302.fc3a3491b4ec2dfd.js +10 -0
  3. package/dist/client/562.17a0a299d2e5152c.js +10 -0
  4. package/dist/client/757.a01403fb7a1bea01.js +10 -0
  5. package/dist/client/902.92e1daaf1ab16ebf.js +10 -0
  6. package/dist/client/97.72979a11a067a7c9.js +10 -0
  7. package/dist/client/index.js +1 -1
  8. package/dist/client-v2/302.d27fe4ea9b0b3bf5.js +10 -0
  9. package/dist/client-v2/562.fb2948ee6402de95.js +10 -0
  10. package/dist/client-v2/757.a117ce1cf7119cea.js +10 -0
  11. package/dist/client-v2/902.9054d990ddc223ac.js +10 -0
  12. package/dist/client-v2/952.94100128b7757f56.js +10 -0
  13. package/dist/client-v2/97.29c663318eebbd57.js +10 -0
  14. package/dist/client-v2/index.js +1 -1
  15. package/dist/constants.js +36 -0
  16. package/dist/externalVersion.js +9 -10
  17. package/dist/locale/en-US.json +105 -10
  18. package/dist/locale/vi-VN.json +105 -0
  19. package/dist/locale/zh-CN.json +105 -10
  20. package/dist/server/billing.js +331 -0
  21. package/dist/server/collections/ai-api-config.js +18 -0
  22. package/dist/server/collections/ai-api-model-metadata.js +83 -0
  23. package/dist/server/collections/ai-api-model-prices.js +55 -0
  24. package/dist/server/collections/ai-api-usage-records.js +9 -0
  25. package/dist/server/collections/ai-api-user-quota-buckets.js +54 -0
  26. package/dist/server/collections/ai-api-user-quota-policies.js +62 -0
  27. package/dist/server/plugin.js +36 -3
  28. package/dist/server/resource/ai-api-config.js +25 -0
  29. package/dist/server/resource/ai-api-usage-monitor.js +86 -0
  30. package/dist/server/routes/agent-completions.js +62 -51
  31. package/dist/server/routes/auth.js +11 -1
  32. package/dist/server/routes/chat-completions.js +157 -6
  33. package/dist/server/routes/completions.js +20 -3
  34. package/dist/server/routes/models.js +78 -20
  35. package/dist/server/routes/router.js +108 -23
  36. package/dist/server/usage.js +19 -2
  37. package/dist/server/utils/app-observability.js +110 -0
  38. package/dist/server/utils/streaming.js +15 -1
  39. package/dist/server/validation.js +120 -0
  40. package/dist/swagger.js +32 -1
  41. package/package.json +1 -1
  42. package/src/client/components/AiApiRolePermissions.tsx +11 -169
  43. package/src/client/locale.ts +11 -21
  44. package/src/client/plugin.tsx +82 -48
  45. package/src/client-v2/__tests__/settings-registration.test.tsx +58 -0
  46. package/src/client-v2/components/AiApiRolePermissions.tsx +173 -0
  47. package/src/client-v2/locale.ts +21 -0
  48. package/src/client-v2/pages/GeneralPage.tsx +183 -0
  49. package/src/client-v2/pages/ModelMetadataPage.tsx +280 -0
  50. package/src/client-v2/pages/ModelPricingPage.tsx +285 -0
  51. package/src/client-v2/pages/RolePermissionsTab.tsx +14 -0
  52. package/src/client-v2/pages/UsagePage.tsx +248 -0
  53. package/src/client-v2/pages/UserQuotasPage.tsx +258 -0
  54. package/src/client-v2/pages/api.ts +16 -0
  55. package/src/client-v2/plugin.tsx +62 -4
  56. package/src/constants.ts +21 -0
  57. package/src/locale/en-US.json +105 -10
  58. package/src/locale/vi-VN.json +105 -0
  59. package/src/locale/zh-CN.json +105 -10
  60. package/src/server/__tests__/app-observability.test.ts +98 -0
  61. package/src/server/__tests__/billing-quota.test.ts +134 -0
  62. package/src/server/__tests__/billing.test.ts +33 -0
  63. package/src/server/__tests__/models.test.ts +74 -0
  64. package/src/server/__tests__/request-body.test.ts +310 -0
  65. package/src/server/__tests__/streaming-observability.test.ts +51 -0
  66. package/src/server/__tests__/usage-monitor.test.ts +63 -0
  67. package/src/server/__tests__/usage-route.test.ts +4 -0
  68. package/src/server/billing.ts +387 -0
  69. package/src/server/collections/ai-api-config.ts +69 -51
  70. package/src/server/collections/ai-api-model-metadata.ts +72 -0
  71. package/src/server/collections/ai-api-model-prices.ts +25 -0
  72. package/src/server/collections/ai-api-usage-records.ts +9 -0
  73. package/src/server/collections/ai-api-user-quota-buckets.ts +24 -0
  74. package/src/server/collections/ai-api-user-quota-policies.ts +32 -0
  75. package/src/server/plugin.ts +47 -5
  76. package/src/server/resource/ai-api-config.ts +105 -74
  77. package/src/server/resource/ai-api-usage-monitor.ts +74 -0
  78. package/src/server/routes/agent-completions.ts +77 -62
  79. package/src/server/routes/auth.ts +14 -1
  80. package/src/server/routes/chat-completions.ts +275 -6
  81. package/src/server/routes/completions.ts +27 -4
  82. package/src/server/routes/models.ts +290 -195
  83. package/src/server/routes/router.ts +152 -27
  84. package/src/server/usage.ts +19 -1
  85. package/src/server/utils/app-observability.ts +105 -0
  86. package/src/server/utils/streaming.ts +13 -1
  87. package/src/server/validation.ts +89 -0
  88. package/src/swagger.ts +38 -1
  89. package/dist/client/778.5c452944cb747975.js +0 -10
  90. package/dist/client/950.83390c5f1d5a97fb.js +0 -10
  91. package/dist/client-v2/950.42b30b5cc9e32b8f.js +0 -10
  92. package/src/client/AiApiConfigPage.tsx +0 -309
@@ -0,0 +1,258 @@
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
+ import {
3
+ Button,
4
+ Card,
5
+ Form,
6
+ Input,
7
+ InputNumber,
8
+ Modal,
9
+ Popconfirm,
10
+ Select,
11
+ Space,
12
+ Switch,
13
+ Table,
14
+ Tag,
15
+ message,
16
+ } from 'antd';
17
+ import type { ColumnsType } from 'antd/es/table';
18
+ import { useFlowContext } from '@nocobase/flow-engine';
19
+ import { useT } from '../locale';
20
+ import { errorMessage, unwrapData } from './api';
21
+
22
+ interface UserSummary {
23
+ id: string | number;
24
+ nickname?: string;
25
+ username?: string;
26
+ email?: string;
27
+ }
28
+
29
+ interface QuotaPolicy {
30
+ id: string | number;
31
+ userId: string | number;
32
+ user?: UserSummary;
33
+ enabled: boolean;
34
+ periodType: 'daily' | 'monthly';
35
+ timezone: string;
36
+ requestLimit?: string;
37
+ totalTokenLimit?: string;
38
+ costLimit?: string;
39
+ currency: string;
40
+ rejectUnpricedModel: boolean;
41
+ missingUsageBehavior: 'allow' | 'use_reserved';
42
+ }
43
+
44
+ export default function UserQuotasPage() {
45
+ const ctx = useFlowContext();
46
+ const t = useT();
47
+ const [form] = Form.useForm<QuotaPolicy>();
48
+ const [rows, setRows] = useState<QuotaPolicy[]>([]);
49
+ const [users, setUsers] = useState<UserSummary[]>([]);
50
+ const [loading, setLoading] = useState(false);
51
+ const [saving, setSaving] = useState(false);
52
+ const [editing, setEditing] = useState<QuotaPolicy>();
53
+ const [open, setOpen] = useState(false);
54
+
55
+ const load = useCallback(async () => {
56
+ setLoading(true);
57
+ try {
58
+ const [policiesResponse, usersResponse] = await Promise.all([
59
+ ctx.api.request({
60
+ url: 'aiApiUserQuotaPolicies:list',
61
+ method: 'get',
62
+ params: { pageSize: 200, appends: ['user'], sort: '-updatedAt' },
63
+ }),
64
+ ctx.api.request({ url: 'users:list', method: 'get', params: { pageSize: 200 } }),
65
+ ]);
66
+ setRows(unwrapData<QuotaPolicy[]>(policiesResponse, []));
67
+ setUsers(unwrapData<UserSummary[]>(usersResponse, []));
68
+ } catch (error) {
69
+ message.error(errorMessage(error));
70
+ } finally {
71
+ setLoading(false);
72
+ }
73
+ }, [ctx.api]);
74
+
75
+ useEffect(() => {
76
+ load();
77
+ }, [load]);
78
+
79
+ const showCreate = () => {
80
+ setEditing(undefined);
81
+ form.setFieldsValue({
82
+ enabled: true,
83
+ periodType: 'monthly',
84
+ timezone: 'UTC',
85
+ currency: 'USD',
86
+ rejectUnpricedModel: true,
87
+ missingUsageBehavior: 'use_reserved',
88
+ } as QuotaPolicy);
89
+ setOpen(true);
90
+ };
91
+
92
+ const showEdit = (record: QuotaPolicy) => {
93
+ setEditing(record);
94
+ form.setFieldsValue(record);
95
+ setOpen(true);
96
+ };
97
+
98
+ const save = async () => {
99
+ const values = await form.validateFields();
100
+ setSaving(true);
101
+ try {
102
+ await ctx.api.request({
103
+ url: editing ? `aiApiUserQuotaPolicies:update/${editing.id}` : 'aiApiUserQuotaPolicies:create',
104
+ method: 'post',
105
+ data: values,
106
+ });
107
+ message.success(t('Saved successfully'));
108
+ setOpen(false);
109
+ await load();
110
+ } catch (error) {
111
+ message.error(errorMessage(error));
112
+ } finally {
113
+ setSaving(false);
114
+ }
115
+ };
116
+
117
+ const remove = async (record: QuotaPolicy) => {
118
+ try {
119
+ await ctx.api.request({
120
+ url: `aiApiUserQuotaPolicies:destroy/${record.id}`,
121
+ method: 'post',
122
+ });
123
+ message.success(t('Deleted successfully'));
124
+ await load();
125
+ } catch (error) {
126
+ message.error(errorMessage(error));
127
+ }
128
+ };
129
+
130
+ const userLabel = (user?: UserSummary) => user?.nickname || user?.username || user?.email || String(user?.id ?? '');
131
+ const columns: ColumnsType<QuotaPolicy> = [
132
+ {
133
+ title: t('User'),
134
+ key: 'user',
135
+ width: 180,
136
+ render: (_, record) => userLabel(record.user) || String(record.userId),
137
+ },
138
+ { title: t('Period'), dataIndex: 'periodType', key: 'periodType', width: 100 },
139
+ {
140
+ title: t('Request limit'),
141
+ dataIndex: 'requestLimit',
142
+ key: 'requestLimit',
143
+ width: 130,
144
+ render: (value) => value ?? t('Unlimited'),
145
+ },
146
+ {
147
+ title: t('Token limit'),
148
+ dataIndex: 'totalTokenLimit',
149
+ key: 'totalTokenLimit',
150
+ width: 130,
151
+ render: (value) => value ?? t('Unlimited'),
152
+ },
153
+ {
154
+ title: t('Cost limit'),
155
+ dataIndex: 'costLimit',
156
+ key: 'costLimit',
157
+ width: 120,
158
+ render: (value, record) => (value == null ? t('Unlimited') : `${value} ${record.currency}`),
159
+ },
160
+ { title: t('Timezone'), dataIndex: 'timezone', key: 'timezone', width: 140 },
161
+ {
162
+ title: t('Status'),
163
+ dataIndex: 'enabled',
164
+ key: 'enabled',
165
+ width: 100,
166
+ render: (enabled: boolean) => (
167
+ <Tag color={enabled ? 'green' : 'default'}>{enabled ? t('Enabled') : t('Disabled')}</Tag>
168
+ ),
169
+ },
170
+ {
171
+ title: t('Actions'),
172
+ key: 'actions',
173
+ width: 150,
174
+ fixed: 'right',
175
+ render: (_, record) => (
176
+ <Space size={0}>
177
+ <Button type="link" onClick={() => showEdit(record)}>
178
+ {t('Edit')}
179
+ </Button>
180
+ <Popconfirm title={t('Delete this quota?')} onConfirm={() => remove(record)}>
181
+ <Button type="link" danger>
182
+ {t('Delete')}
183
+ </Button>
184
+ </Popconfirm>
185
+ </Space>
186
+ ),
187
+ },
188
+ ];
189
+
190
+ return (
191
+ <Card
192
+ title={t('User quotas')}
193
+ extra={
194
+ <Button type="primary" onClick={showCreate}>
195
+ {t('Add quota')}
196
+ </Button>
197
+ }
198
+ >
199
+ <Table rowKey="id" columns={columns} dataSource={rows} loading={loading} scroll={{ x: 1100 }} />
200
+ <Modal
201
+ title={editing ? t('Edit quota') : t('Add quota')}
202
+ open={open}
203
+ onCancel={() => setOpen(false)}
204
+ onOk={save}
205
+ confirmLoading={saving}
206
+ destroyOnClose
207
+ >
208
+ <Form form={form} layout="vertical" preserve={false}>
209
+ <Form.Item name="userId" label={t('User')} rules={[{ required: true }]}>
210
+ <Select
211
+ disabled={Boolean(editing)}
212
+ showSearch
213
+ optionFilterProp="label"
214
+ options={users.map((user) => ({ label: userLabel(user), value: user.id }))}
215
+ />
216
+ </Form.Item>
217
+ <Form.Item name="periodType" label={t('Period')} rules={[{ required: true }]}>
218
+ <Select
219
+ options={[
220
+ { label: t('Daily'), value: 'daily' },
221
+ { label: t('Monthly'), value: 'monthly' },
222
+ ]}
223
+ />
224
+ </Form.Item>
225
+ <Form.Item name="timezone" label={t('Timezone')} rules={[{ required: true }]}>
226
+ <Input placeholder="UTC" />
227
+ </Form.Item>
228
+ <Form.Item name="requestLimit" label={t('Request limit')}>
229
+ <InputNumber min={0} stringMode style={{ width: '100%' }} />
230
+ </Form.Item>
231
+ <Form.Item name="totalTokenLimit" label={t('Token limit')}>
232
+ <InputNumber min={0} stringMode style={{ width: '100%' }} />
233
+ </Form.Item>
234
+ <Form.Item name="costLimit" label={t('Cost limit')}>
235
+ <InputNumber min={0} stringMode style={{ width: '100%' }} />
236
+ </Form.Item>
237
+ <Form.Item name="currency" label={t('Currency')} rules={[{ required: true }]}>
238
+ <Input />
239
+ </Form.Item>
240
+ <Form.Item name="rejectUnpricedModel" label={t('Reject unpriced models')} valuePropName="checked">
241
+ <Switch />
242
+ </Form.Item>
243
+ <Form.Item name="missingUsageBehavior" label={t('Missing usage behavior')} rules={[{ required: true }]}>
244
+ <Select
245
+ options={[
246
+ { label: t('Use reserved estimate'), value: 'use_reserved' },
247
+ { label: t('Allow without token charge'), value: 'allow' },
248
+ ]}
249
+ />
250
+ </Form.Item>
251
+ <Form.Item name="enabled" label={t('Enabled')} valuePropName="checked">
252
+ <Switch />
253
+ </Form.Item>
254
+ </Form>
255
+ </Modal>
256
+ </Card>
257
+ );
258
+ }
@@ -0,0 +1,16 @@
1
+ export interface ApiEnvelope<T> {
2
+ data?: {
3
+ data?: T;
4
+ meta?: { count?: number };
5
+ };
6
+ }
7
+
8
+ export function unwrapData<T>(response: unknown, fallback: T): T {
9
+ if (!response || typeof response !== 'object') return fallback;
10
+ const outer = response as ApiEnvelope<T>;
11
+ return outer.data?.data ?? fallback;
12
+ }
13
+
14
+ export function errorMessage(error: unknown): string {
15
+ return error instanceof Error ? error.message : String(error);
16
+ }
@@ -1,5 +1,19 @@
1
- import { Plugin, Application } from '@nocobase/client-v2';
2
1
  import React from 'react';
2
+ import { Plugin, Application } from '@nocobase/client-v2';
3
+ import { AI_API_ACL_SNIPPET } from '../constants';
4
+
5
+ interface PermissionTabOptions {
6
+ key: string;
7
+ label: string;
8
+ sort?: number;
9
+ componentLoader: () => Promise<{ default: React.ComponentType<{ activeRole?: { name?: string } | null }> }>;
10
+ }
11
+
12
+ interface AclPluginV2Compat {
13
+ settingsUI?: {
14
+ addPermissionsTab?: (options: PermissionTabOptions) => void;
15
+ };
16
+ }
3
17
 
4
18
  export class PluginAiApiClient extends Plugin<Record<string, never>, Application> {
5
19
  async load() {
@@ -7,17 +21,61 @@ export class PluginAiApiClient extends Plugin<Record<string, never>, Application
7
21
  key: 'ai-api',
8
22
  title: this.t('AI API Gateway'),
9
23
  icon: 'ApiOutlined',
10
- aclSnippet: 'pm.ai-api.configuration',
24
+ aclSnippet: AI_API_ACL_SNIPPET,
11
25
  });
12
26
 
13
27
  this.pluginSettingsManager.addPageTabItem({
14
28
  menuKey: 'ai-api',
15
29
  key: 'index',
16
30
  title: this.t('Configuration'),
17
-
18
- componentLoader: () => import('../client/AiApiConfigPage'),
31
+ aclSnippet: AI_API_ACL_SNIPPET,
32
+ sort: 1,
33
+ componentLoader: () => import('./pages/GeneralPage'),
19
34
  });
20
35
 
36
+ this.pluginSettingsManager.addPageTabItem({
37
+ menuKey: 'ai-api',
38
+ key: 'model-pricing',
39
+ title: this.t('Model pricing'),
40
+ aclSnippet: AI_API_ACL_SNIPPET,
41
+ sort: 2,
42
+ componentLoader: () => import('./pages/ModelPricingPage'),
43
+ });
44
+
45
+ this.pluginSettingsManager.addPageTabItem({
46
+ menuKey: 'ai-api',
47
+ key: 'model-metadata',
48
+ title: this.t('Model metadata'),
49
+ aclSnippet: AI_API_ACL_SNIPPET,
50
+ sort: 3,
51
+ componentLoader: () => import('./pages/ModelMetadataPage'),
52
+ });
53
+
54
+ this.pluginSettingsManager.addPageTabItem({
55
+ menuKey: 'ai-api',
56
+ key: 'user-quotas',
57
+ title: this.t('User quotas'),
58
+ aclSnippet: AI_API_ACL_SNIPPET,
59
+ sort: 4,
60
+ componentLoader: () => import('./pages/UserQuotasPage'),
61
+ });
62
+
63
+ this.pluginSettingsManager.addPageTabItem({
64
+ menuKey: 'ai-api',
65
+ key: 'usage',
66
+ title: this.t('Usage'),
67
+ aclSnippet: AI_API_ACL_SNIPPET,
68
+ sort: 5,
69
+ componentLoader: () => import('./pages/UsagePage'),
70
+ });
71
+
72
+ const aclPlugin = this.app.pm.get('@nocobase/plugin-acl') as AclPluginV2Compat | undefined;
73
+ aclPlugin?.settingsUI?.addPermissionsTab?.({
74
+ key: 'aiApi',
75
+ label: this.t('AI API'),
76
+ sort: 25,
77
+ componentLoader: () => import('./pages/RolePermissionsTab'),
78
+ });
21
79
  }
22
80
  }
23
81
 
@@ -0,0 +1,21 @@
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
+ /**
11
+ * The single admin snippet the server registers as `pm.${this.name}.configuration`.
12
+ *
13
+ * `this.name` is the plugin's package name with only `@nocobase/plugin-` or
14
+ * `@nocobase/preset-` stripped (see utils/plugin-package `getPluginNameFromPackageName`),
15
+ * so for this unscoped package it stays `plugin-ai-api` — verified against the running
16
+ * app, which reports `name: "plugin-ai-api"`. Spelling it `pm.ai-api.configuration` on the
17
+ * client names a snippet no role can ever hold.
18
+ *
19
+ * Shared by both client runtimes so a rename cannot silently desynchronise them.
20
+ */
21
+ export const AI_API_ACL_SNIPPET = 'pm.plugin-ai-api.configuration';
@@ -1,10 +1,105 @@
1
- {
2
- "AI API Gateway": "AI API Gateway",
3
- "Configuration": "Configuration",
4
- "Default AI Employee": "Default AI Employee",
5
- "Enabled LLM Services": "Enabled LLM Services",
6
- "Rate Limit": "Rate Limit",
7
- "Save Configuration": "Save Configuration",
8
- "Configuration saved": "Configuration saved",
9
- "Failed to save configuration": "Failed to save configuration"
10
- }
1
+ {
2
+ "AI API Gateway": "AI API Gateway",
3
+ "Configuration": "Configuration",
4
+ "Default AI Employee": "Default AI Employee",
5
+ "Enabled LLM Services": "Enabled LLM Services",
6
+ "Rate Limit": "Rate Limit",
7
+ "Save Configuration": "Save Configuration",
8
+ "Configuration saved": "Configuration saved",
9
+ "Failed to save configuration": "Failed to save configuration",
10
+ "API mode": "API mode",
11
+ "Direct LLM": "Direct LLM",
12
+ "AI Employee agent": "AI Employee agent",
13
+ "Default LLM service": "Default LLM service",
14
+ "Enable user quotas": "Enable user quotas",
15
+ "Default reserved output tokens": "Default reserved output tokens",
16
+ "Refresh": "Refresh",
17
+ "Model pricing": "Model pricing",
18
+ "User quotas": "User quotas",
19
+ "Usage": "Usage",
20
+ "LLM service": "LLM service",
21
+ "Model": "Model",
22
+ "Input price / 1M": "Input price / 1M",
23
+ "Output price / 1M": "Output price / 1M",
24
+ "Fixed request cost": "Fixed request cost",
25
+ "Currency": "Currency",
26
+ "Status": "Status",
27
+ "Enabled": "Enabled",
28
+ "Disabled": "Disabled",
29
+ "Actions": "Actions",
30
+ "Edit": "Edit",
31
+ "Delete": "Delete",
32
+ "Delete this price?": "Delete this price?",
33
+ "Add price": "Add price",
34
+ "Edit price": "Edit price",
35
+ "Effective from": "Effective from",
36
+ "Effective to": "Effective to",
37
+ "Notes": "Notes",
38
+ "Saved successfully": "Saved successfully",
39
+ "Deleted successfully": "Deleted successfully",
40
+ "User": "User",
41
+ "Period": "Period",
42
+ "Request limit": "Request limit",
43
+ "Token limit": "Token limit",
44
+ "Cost limit": "Cost limit",
45
+ "Timezone": "Timezone",
46
+ "Unlimited": "Unlimited",
47
+ "Add quota": "Add quota",
48
+ "Edit quota": "Edit quota",
49
+ "Delete this quota?": "Delete this quota?",
50
+ "Daily": "Daily",
51
+ "Monthly": "Monthly",
52
+ "Reject unpriced models": "Reject unpriced models",
53
+ "Missing usage behavior": "Missing usage behavior",
54
+ "Use reserved estimate": "Use reserved estimate",
55
+ "Allow without token charge": "Allow without token charge",
56
+ "Started at": "Started at",
57
+ "Requested model": "Requested model",
58
+ "Resolved service": "Resolved service",
59
+ "Resolved model": "Resolved model",
60
+ "Input tokens": "Input tokens",
61
+ "Output tokens": "Output tokens",
62
+ "Total tokens": "Total tokens",
63
+ "Cost": "Cost",
64
+ "Cost status": "Cost status",
65
+ "Request ID": "Request ID",
66
+ "Failed to load models": "Failed to load models",
67
+ "Select a model": "Select a model",
68
+ "Select an AI Employee": "Select an AI Employee",
69
+ "Usage guide": "Usage guide",
70
+ "OpenAI-compatible endpoint": "OpenAI-compatible endpoint",
71
+ "Base URL": "Base URL",
72
+ "Use a NocoBase API key as the Bearer token.": "Use a NocoBase API key as the Bearer token.",
73
+ "List available models": "List available models",
74
+ "Send a chat completion": "Send a chat completion",
75
+ "Usage filters": "Usage filters",
76
+ "Time range": "Time range",
77
+ "User ID": "User ID",
78
+ "Succeeded": "Succeeded",
79
+ "Failed": "Failed",
80
+ "Started": "Started",
81
+ "Apply filters": "Apply filters",
82
+ "Reset": "Reset",
83
+ "Requests": "Requests",
84
+ "Total cost": "Total cost",
85
+ "Usage records": "Usage records",
86
+ "Model metadata": "Model metadata",
87
+ "Add override": "Add override",
88
+ "Edit override": "Edit override",
89
+ "Delete this override?": "Delete this override?",
90
+ "Context window": "Context window",
91
+ "Max completion tokens": "Max completion tokens",
92
+ "Owned by": "Owned by",
93
+ "Display name": "Display name",
94
+ "Description": "Description",
95
+ "Leave empty to not override": "Leave empty to not override",
96
+ "Total input + output token capacity reported to clients.": "Total input + output token capacity reported to clients.",
97
+ "Maximum output tokens reported to clients.": "Maximum output tokens reported to clients.",
98
+ "AI API": "AI API",
99
+ "Allow this role to use the AI API": "Allow this role to use the AI API",
100
+ "Allow all AI Employees": "Allow all AI Employees",
101
+ "Select which AI Employees this role may use:": "Select which AI Employees this role may use:",
102
+ "Select allowed AI Employees": "Select allowed AI Employees",
103
+ "Max request body size (MB)": "Max request body size (MB)",
104
+ "Raise this to accept inline base64 images. Base64 adds about 33% to the original file size.": "Raise this to accept inline base64 images. Base64 adds about 33% to the original file size."
105
+ }
@@ -0,0 +1,105 @@
1
+ {
2
+ "AI API Gateway": "Cổng AI API",
3
+ "Configuration": "Cấu hình",
4
+ "Default AI Employee": "AI Employee mặc định",
5
+ "Enabled LLM Services": "Dịch vụ LLM được bật",
6
+ "Rate Limit": "Giới hạn tốc độ",
7
+ "Save Configuration": "Lưu cấu hình",
8
+ "Configuration saved": "Đã lưu cấu hình",
9
+ "Failed to save configuration": "Không thể lưu cấu hình",
10
+ "API mode": "Chế độ API",
11
+ "Direct LLM": "LLM trực tiếp",
12
+ "AI Employee agent": "AI Employee agent",
13
+ "Default LLM service": "Dịch vụ LLM mặc định",
14
+ "Enable user quotas": "Bật quota theo người dùng",
15
+ "Default reserved output tokens": "Số output token giữ chỗ mặc định",
16
+ "Refresh": "Làm mới",
17
+ "Model pricing": "Bảng giá model",
18
+ "User quotas": "Quota người dùng",
19
+ "Usage": "Lịch sử sử dụng",
20
+ "LLM service": "Dịch vụ LLM",
21
+ "Model": "Model",
22
+ "Input price / 1M": "Giá input / 1 triệu token",
23
+ "Output price / 1M": "Giá output / 1 triệu token",
24
+ "Fixed request cost": "Chi phí cố định mỗi request",
25
+ "Currency": "Tiền tệ",
26
+ "Status": "Trạng thái",
27
+ "Enabled": "Đang bật",
28
+ "Disabled": "Đã tắt",
29
+ "Actions": "Thao tác",
30
+ "Edit": "Sửa",
31
+ "Delete": "Xóa",
32
+ "Delete this price?": "Xóa cấu hình giá này?",
33
+ "Add price": "Thêm giá",
34
+ "Edit price": "Sửa giá",
35
+ "Effective from": "Hiệu lực từ",
36
+ "Effective to": "Hiệu lực đến",
37
+ "Notes": "Ghi chú",
38
+ "Saved successfully": "Đã lưu thành công",
39
+ "Deleted successfully": "Đã xóa thành công",
40
+ "User": "Người dùng",
41
+ "Period": "Chu kỳ",
42
+ "Request limit": "Giới hạn request",
43
+ "Token limit": "Giới hạn token",
44
+ "Cost limit": "Giới hạn chi phí",
45
+ "Timezone": "Múi giờ",
46
+ "Unlimited": "Không giới hạn",
47
+ "Add quota": "Thêm quota",
48
+ "Edit quota": "Sửa quota",
49
+ "Delete this quota?": "Xóa quota này?",
50
+ "Daily": "Hàng ngày",
51
+ "Monthly": "Hàng tháng",
52
+ "Reject unpriced models": "Từ chối model chưa có giá",
53
+ "Missing usage behavior": "Xử lý khi thiếu token usage",
54
+ "Use reserved estimate": "Dùng số liệu giữ chỗ để ước tính",
55
+ "Allow without token charge": "Cho phép và không tính token",
56
+ "Started at": "Bắt đầu lúc",
57
+ "Requested model": "Model được yêu cầu",
58
+ "Resolved service": "Service đã resolve",
59
+ "Resolved model": "Model đã resolve",
60
+ "Input tokens": "Input token",
61
+ "Output tokens": "Output token",
62
+ "Total tokens": "Tổng token",
63
+ "Cost": "Chi phí",
64
+ "Cost status": "Trạng thái chi phí",
65
+ "Request ID": "Request ID",
66
+ "Failed to load models": "Không thể tải danh sách model",
67
+ "Select a model": "Chọn model",
68
+ "Select an AI Employee": "Chọn AI Employee",
69
+ "Usage guide": "Hướng dẫn sử dụng",
70
+ "OpenAI-compatible endpoint": "Endpoint tương thích OpenAI",
71
+ "Base URL": "Base URL",
72
+ "Use a NocoBase API key as the Bearer token.": "Sử dụng NocoBase API key làm Bearer token.",
73
+ "List available models": "Liệt kê model khả dụng",
74
+ "Send a chat completion": "Gửi yêu cầu chat completion",
75
+ "Usage filters": "Bộ lọc usage",
76
+ "Time range": "Khoảng thời gian",
77
+ "User ID": "User ID",
78
+ "Succeeded": "Thành công",
79
+ "Failed": "Thất bại",
80
+ "Started": "Đã bắt đầu",
81
+ "Apply filters": "Áp dụng bộ lọc",
82
+ "Reset": "Đặt lại",
83
+ "Requests": "Số request",
84
+ "Total cost": "Tổng chi phí",
85
+ "Usage records": "Chi tiết usage",
86
+ "Model metadata": "Metadata model",
87
+ "Add override": "Thêm override",
88
+ "Edit override": "Sửa override",
89
+ "Delete this override?": "Xóa override này?",
90
+ "Context window": "Context window",
91
+ "Max completion tokens": "Max completion tokens",
92
+ "Owned by": "Nhà cung cấp",
93
+ "Display name": "Tên hiển thị",
94
+ "Description": "Mô tả",
95
+ "Leave empty to not override": "Để trống nếu không override",
96
+ "Total input + output token capacity reported to clients.": "Tổng dung lượng token (input + output) trả về cho client.",
97
+ "Maximum output tokens reported to clients.": "Số token output tối đa trả về cho client.",
98
+ "AI API": "AI API",
99
+ "Allow this role to use the AI API": "Cho phép vai trò này sử dụng AI API",
100
+ "Allow all AI Employees": "Cho phép tất cả AI Employee",
101
+ "Select which AI Employees this role may use:": "Chọn AI Employee mà vai trò này được dùng:",
102
+ "Select allowed AI Employees": "Chọn AI Employee được phép",
103
+ "Max request body size (MB)": "Giới hạn kích thước request body (MB)",
104
+ "Raise this to accept inline base64 images. Base64 adds about 33% to the original file size.": "Tăng giá trị này để nhận ảnh base64 gửi trực tiếp. Base64 làm tăng khoảng 33% so với kích thước tệp gốc."
105
+ }