@ai-grator/api 0.1.18 → 0.1.20
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/admin/endpoints/admin.ts +3 -0
- package/admin/endpoints/queries/get-admin-kie-balance.query.ts +17 -0
- package/admin/endpoints/queries/index.ts +1 -0
- package/admin/models/admin-kie-balance-response.schema.ts +7 -0
- package/admin/models/index.ts +1 -0
- package/build/admin/endpoints/admin.d.ts +1 -0
- package/build/admin/endpoints/admin.d.ts.map +1 -1
- package/build/admin/endpoints/admin.js +2 -0
- package/build/admin/endpoints/queries/get-admin-kie-balance.query.d.ts +18 -0
- package/build/admin/endpoints/queries/get-admin-kie-balance.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-kie-balance.query.js +18 -0
- package/build/admin/endpoints/queries/index.d.ts +1 -0
- package/build/admin/endpoints/queries/index.d.ts.map +1 -1
- package/build/admin/endpoints/queries/index.js +1 -0
- package/build/admin/models/admin-kie-balance-response.schema.d.ts +6 -0
- package/build/admin/models/admin-kie-balance-response.schema.d.ts.map +1 -0
- package/build/admin/models/admin-kie-balance-response.schema.js +7 -0
- package/build/admin/models/index.d.ts +1 -0
- package/build/admin/models/index.d.ts.map +1 -1
- package/build/admin/models/index.js +1 -0
- package/build/errors/errors.d.ts +5 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +5 -0
- package/build/message/endpoints/queries/get-message-price-estimate.query.d.ts +6 -6
- package/build/message/endpoints/queries/get-message-price-estimate.query.d.ts.map +1 -1
- package/build/message/endpoints/queries/get-message-price-estimate.query.js +7 -7
- package/build/scripts/generate-openapi.js +5 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +5 -0
- package/message/endpoints/queries/get-message-price-estimate.query.ts +6 -6
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +10 -4
package/errors/errors.ts
CHANGED
|
@@ -665,6 +665,11 @@ export const ERRORS = {
|
|
|
665
665
|
code: 'ADMIN.STATS_ERROR',
|
|
666
666
|
message: 'Не удалось получить статистику',
|
|
667
667
|
},
|
|
668
|
+
KIE_BALANCE_ERROR: {
|
|
669
|
+
httpCode: 500,
|
|
670
|
+
code: 'ADMIN.KIE_BALANCE_ERROR',
|
|
671
|
+
message: 'Не удалось получить баланс Kie AI',
|
|
672
|
+
},
|
|
668
673
|
},
|
|
669
674
|
REFERRAL: {
|
|
670
675
|
SELF_REFERRAL: {
|
|
@@ -2,27 +2,27 @@ import { uuid, z } from 'zod';
|
|
|
2
2
|
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
3
|
import { MESSAGE_ROUTES } from '../message';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
messageLength: z.
|
|
5
|
+
export const GetMessagePriceEstimateBody = z.object({
|
|
6
|
+
messageLength: z.number().int().nonnegative(),
|
|
7
7
|
aiModelId: z.uuid(),
|
|
8
8
|
chatId: z.uuid().optional(),
|
|
9
9
|
fileIds: z.array(uuid()).optional(),
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const GetMessagePriceEstimateResponse = z.object({
|
|
13
13
|
price: z.number().nonnegative(),
|
|
14
14
|
currency: z.literal('RUB'),
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
export const GetMessagePriceEstimateQuery = defineContract({
|
|
18
|
-
method: HTTP_METHODS.
|
|
18
|
+
method: HTTP_METHODS.POST,
|
|
19
19
|
path: MESSAGE_ROUTES.GET_PRICE,
|
|
20
20
|
summary: 'Estimate message price before create request',
|
|
21
21
|
request: {
|
|
22
|
-
|
|
22
|
+
body: GetMessagePriceEstimateBody,
|
|
23
23
|
},
|
|
24
24
|
responses: {
|
|
25
|
-
200:
|
|
25
|
+
200: GetMessagePriceEstimateResponse,
|
|
26
26
|
400: HttpErrorResponseSchema,
|
|
27
27
|
404: HttpErrorResponseSchema,
|
|
28
28
|
500: HttpErrorResponseSchema,
|
package/package.json
CHANGED
|
@@ -86,6 +86,10 @@ import {
|
|
|
86
86
|
GetAdminStatsQueryQuery,
|
|
87
87
|
GetAdminStatsQueryResponse,
|
|
88
88
|
} from '../billing/endpoints/queries/get-admin-stats.query';
|
|
89
|
+
import {
|
|
90
|
+
GetAdminKieBalanceQuery,
|
|
91
|
+
GetAdminKieBalanceQueryResponse,
|
|
92
|
+
} from '../admin/endpoints/queries/get-admin-kie-balance.query';
|
|
89
93
|
import { AUTH_CONTROLLER } from '../auth/endpoints/auth';
|
|
90
94
|
import { AuthChangePasswordSchema, ChangePasswordCommand } from '../auth/endpoints/commands/change-password.command';
|
|
91
95
|
import { AuthDeleteAccountSchema, DeleteAccountCommand } from '../auth/endpoints/commands/delete-account.command';
|
|
@@ -144,8 +148,8 @@ import {
|
|
|
144
148
|
} from '../message/endpoints/queries/get-messages-by-chat.query';
|
|
145
149
|
import {
|
|
146
150
|
GetMessagePriceEstimateQuery,
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
GetMessagePriceEstimateBody,
|
|
152
|
+
GetMessagePriceEstimateResponse,
|
|
149
153
|
} from '../message/endpoints/queries/get-message-price-estimate.query';
|
|
150
154
|
import { FILE_CONTROLLER } from '../file/endpoints/file';
|
|
151
155
|
import {
|
|
@@ -383,8 +387,8 @@ async function main() {
|
|
|
383
387
|
registerSchema('MessageGetByUuidResponse', GetMessageByUuidQueryResponse);
|
|
384
388
|
registerSchema('MessageGetByChatParams', GetMessagesByChatQueryParams);
|
|
385
389
|
registerSchema('MessageGetByChatResponse', GetMessagesByChatQueryResponse);
|
|
386
|
-
registerSchema('
|
|
387
|
-
registerSchema('MessagePriceEstimateResponse',
|
|
390
|
+
registerSchema('MessagePriceEstimateBody', GetMessagePriceEstimateBody);
|
|
391
|
+
registerSchema('MessagePriceEstimateResponse', GetMessagePriceEstimateResponse);
|
|
388
392
|
registerSchema('MessageDeleteParams', DeleteMessageCommandParams);
|
|
389
393
|
registerSchema('MessageDeleteResponse', DeleteMessageCommandResponse);
|
|
390
394
|
registerSchema('FileUploadRequest', UploadFileCommandBody);
|
|
@@ -460,6 +464,7 @@ async function main() {
|
|
|
460
464
|
registerSchema('AdminGetUserTransactionsResponse', GetAdminUserTransactionsQueryResponse);
|
|
461
465
|
registerSchema('AdminGetStatsQuery', GetAdminStatsQueryQuery);
|
|
462
466
|
registerSchema('AdminGetStatsResponse', GetAdminStatsQueryResponse);
|
|
467
|
+
registerSchema('AdminGetKieBalanceResponse', GetAdminKieBalanceQueryResponse);
|
|
463
468
|
registerSchema('MarketplaceCardCreateRequest', CreateMarketplaceCardCommandBody);
|
|
464
469
|
registerSchema('MarketplaceCardCreateResponse', CreateMarketplaceCardCommandResponse);
|
|
465
470
|
registerSchema('MarketplaceCardGetByUuidParams', GetMarketplaceCardQueryParams);
|
|
@@ -544,6 +549,7 @@ async function main() {
|
|
|
544
549
|
GetAdminUserQuery,
|
|
545
550
|
GetAdminUserTransactionsQuery,
|
|
546
551
|
GetAdminStatsQuery,
|
|
552
|
+
GetAdminKieBalanceQuery,
|
|
547
553
|
];
|
|
548
554
|
|
|
549
555
|
for (const contract of authContracts) {
|