@ai-grator/api 0.1.31 → 0.1.33
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/ai-model/models/chat-price-scenarios.schema.ts +13 -0
- package/ai-model/models/index.ts +1 -0
- package/build/ai-model/models/chat-price-scenarios.schema.d.ts +13 -0
- package/build/ai-model/models/chat-price-scenarios.schema.d.ts.map +1 -0
- package/build/ai-model/models/chat-price-scenarios.schema.js +10 -0
- package/build/ai-model/models/index.d.ts +1 -0
- package/build/ai-model/models/index.d.ts.map +1 -1
- package/build/ai-model/models/index.js +1 -0
- package/build/errors/errors.d.ts +12 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +12 -0
- package/build/generation-job/models/suno-params.schema.d.ts.map +1 -1
- package/build/generation-job/models/suno-params.schema.js +2 -1
- package/build/generation-model/endpoints/queries/get-generation-price.query.d.ts +1 -0
- package/build/generation-model/endpoints/queries/get-generation-price.query.d.ts.map +1 -1
- package/build/generation-model/endpoints/queries/get-generation-price.query.js +1 -0
- package/build/generation-model/models/index.d.ts +1 -0
- package/build/generation-model/models/index.d.ts.map +1 -1
- package/build/generation-model/models/index.js +1 -0
- package/build/generation-model/models/seo-price-scenarios.schema.d.ts +5 -0
- package/build/generation-model/models/seo-price-scenarios.schema.d.ts.map +1 -0
- package/build/generation-model/models/seo-price-scenarios.schema.js +6 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/model-catalog/enums/price-unit.enum.d.ts +2 -1
- package/build/model-catalog/enums/price-unit.enum.d.ts.map +1 -1
- package/build/model-catalog/enums/price-unit.enum.js +1 -0
- package/build/model-page/endpoints/index.d.ts +3 -0
- package/build/model-page/endpoints/index.d.ts.map +1 -0
- package/build/model-page/endpoints/index.js +18 -0
- package/build/model-page/endpoints/model-page.d.ts +6 -0
- package/build/model-page/endpoints/model-page.d.ts.map +1 -0
- package/build/model-page/endpoints/model-page.js +8 -0
- package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts +349 -0
- package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts.map +1 -0
- package/build/model-page/endpoints/queries/get-public-model-by-slug.query.js +25 -0
- package/build/model-page/endpoints/queries/index.d.ts +3 -0
- package/build/model-page/endpoints/queries/index.d.ts.map +1 -0
- package/build/model-page/endpoints/queries/index.js +18 -0
- package/build/model-page/endpoints/queries/list-public-models.query.d.ts +39 -0
- package/build/model-page/endpoints/queries/list-public-models.query.d.ts.map +1 -0
- package/build/model-page/endpoints/queries/list-public-models.query.js +19 -0
- package/build/model-page/index.d.ts +3 -0
- package/build/model-page/index.d.ts.map +1 -0
- package/build/model-page/index.js +18 -0
- package/build/model-page/models/index.d.ts +5 -0
- package/build/model-page/models/index.d.ts.map +1 -0
- package/build/model-page/models/index.js +20 -0
- package/build/model-page/models/page-card.schema.d.ts +8 -0
- package/build/model-page/models/page-card.schema.d.ts.map +1 -0
- package/build/model-page/models/page-card.schema.js +9 -0
- package/build/model-page/models/page-content.schema.d.ts +411 -0
- package/build/model-page/models/page-content.schema.d.ts.map +1 -0
- package/build/model-page/models/page-content.schema.js +146 -0
- package/build/model-page/models/public-model-card.schema.d.ts +16 -0
- package/build/model-page/models/public-model-card.schema.d.ts.map +1 -0
- package/build/model-page/models/public-model-card.schema.js +15 -0
- package/build/model-page/models/public-model-detail.schema.d.ts +190 -0
- package/build/model-page/models/public-model-detail.schema.d.ts.map +1 -0
- package/build/model-page/models/public-model-detail.schema.js +32 -0
- package/build/scripts/generate-openapi.js +36 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +12 -0
- package/generation-job/models/suno-params.schema.ts +2 -1
- package/generation-model/endpoints/queries/get-generation-price.query.ts +1 -0
- package/generation-model/models/index.ts +1 -0
- package/generation-model/models/seo-price-scenarios.schema.ts +10 -0
- package/index.ts +1 -0
- package/model-catalog/enums/price-unit.enum.ts +1 -0
- package/model-page/endpoints/index.ts +2 -0
- package/model-page/endpoints/model-page.ts +6 -0
- package/model-page/endpoints/queries/get-public-model-by-slug.query.ts +25 -0
- package/model-page/endpoints/queries/index.ts +2 -0
- package/model-page/endpoints/queries/list-public-models.query.ts +18 -0
- package/model-page/index.ts +2 -0
- package/model-page/models/index.ts +4 -0
- package/model-page/models/page-card.schema.ts +9 -0
- package/model-page/models/page-content.schema.ts +182 -0
- package/model-page/models/public-model-card.schema.ts +15 -0
- package/model-page/models/public-model-detail.schema.ts +38 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +45 -0
package/errors/errors.ts
CHANGED
|
@@ -862,6 +862,18 @@ export const ERRORS = {
|
|
|
862
862
|
message: 'Не удалось получить каталог моделей',
|
|
863
863
|
},
|
|
864
864
|
},
|
|
865
|
+
MODEL_PAGE: {
|
|
866
|
+
INVALID_CONTENT: {
|
|
867
|
+
httpCode: 500,
|
|
868
|
+
code: 'MODEL_PAGE.INVALID_CONTENT',
|
|
869
|
+
message: 'Контент страницы модели не соответствует схеме',
|
|
870
|
+
},
|
|
871
|
+
PRICE_UNAVAILABLE: {
|
|
872
|
+
httpCode: 503,
|
|
873
|
+
code: 'MODEL_PAGE.PRICE_UNAVAILABLE',
|
|
874
|
+
message: 'Не удалось рассчитать цены для страницы модели',
|
|
875
|
+
},
|
|
876
|
+
},
|
|
865
877
|
USER_CONTEXT: {
|
|
866
878
|
FIND_ERROR: {
|
|
867
879
|
httpCode: 500,
|
|
@@ -9,6 +9,7 @@ export type SunoPersonaModel = z.infer<typeof SunoPersonaModelSchema>;
|
|
|
9
9
|
|
|
10
10
|
// KIE/Suno docs don't state an explicit max for V5_5; capped conservatively above the
|
|
11
11
|
// documented V4.5 ceiling (8 min) pending real limits/duration-aware pricing from product.
|
|
12
|
+
const MIN_DURATION_SECONDS = 30;
|
|
12
13
|
const MAX_DURATION_SECONDS = 600;
|
|
13
14
|
|
|
14
15
|
export const SunoParamsSchema = z
|
|
@@ -19,7 +20,7 @@ export const SunoParamsSchema = z
|
|
|
19
20
|
audioWeight: z.number().min(0).max(1).multipleOf(0.05).default(0.65),
|
|
20
21
|
title: z.string().max(80).optional(),
|
|
21
22
|
style: MusicStyleSchema.optional(),
|
|
22
|
-
duration: z.number().
|
|
23
|
+
duration: z.number().min(MIN_DURATION_SECONDS).max(MAX_DURATION_SECONDS).default(120),
|
|
23
24
|
vocalGender: SunoVocalGenderSchema.optional(),
|
|
24
25
|
negativeTags: z.string().max(500).optional(),
|
|
25
26
|
styleWeight: z.number().min(0).max(1).optional(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const SEO_PRICE_SCENARIO_KEY = /^[a-z0-9_]+$/;
|
|
4
|
+
|
|
5
|
+
export const SeoPriceScenariosSchema = z.record(
|
|
6
|
+
z.string().regex(SEO_PRICE_SCENARIO_KEY),
|
|
7
|
+
z.record(z.string(), z.unknown()),
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export type SeoPriceScenarios = z.infer<typeof SeoPriceScenariosSchema>;
|
package/index.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { PublicModelDetailSchema } from '../../models';
|
|
4
|
+
import { PUBLIC_MODEL_ROUTES } from '../model-page';
|
|
5
|
+
|
|
6
|
+
export const GetPublicModelBySlugQueryParams = z.object({
|
|
7
|
+
slug: z.string().min(1),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const GetPublicModelBySlugQueryResponse = PublicModelDetailSchema;
|
|
11
|
+
|
|
12
|
+
export const GetPublicModelBySlugQuery = defineContract({
|
|
13
|
+
method: HTTP_METHODS.GET,
|
|
14
|
+
path: PUBLIC_MODEL_ROUTES.GET_BY_SLUG(':slug'),
|
|
15
|
+
summary: 'Get published model by slug',
|
|
16
|
+
request: {
|
|
17
|
+
params: GetPublicModelBySlugQueryParams,
|
|
18
|
+
},
|
|
19
|
+
responses: {
|
|
20
|
+
200: GetPublicModelBySlugQueryResponse,
|
|
21
|
+
404: HttpErrorResponseSchema,
|
|
22
|
+
500: HttpErrorResponseSchema,
|
|
23
|
+
503: HttpErrorResponseSchema,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { PublicModelCardSchema } from '../../models';
|
|
4
|
+
import { PUBLIC_MODEL_ROUTES } from '../model-page';
|
|
5
|
+
|
|
6
|
+
export const ListPublicModelsQueryResponse = z.object({
|
|
7
|
+
models: z.array(PublicModelCardSchema),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const ListPublicModelsQuery = defineContract({
|
|
11
|
+
method: HTTP_METHODS.GET,
|
|
12
|
+
path: PUBLIC_MODEL_ROUTES.LIST,
|
|
13
|
+
summary: 'List published models (chat, image, video)',
|
|
14
|
+
responses: {
|
|
15
|
+
200: ListPublicModelsQueryResponse,
|
|
16
|
+
500: HttpErrorResponseSchema,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const PageImageSchema = z.object({
|
|
4
|
+
url: z.url(),
|
|
5
|
+
alt: z.string().min(1),
|
|
6
|
+
caption: z.string().min(1).nullable(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const BlockBaseSchema = z.object({
|
|
10
|
+
id: z.string().min(1),
|
|
11
|
+
heading: z.string().min(1).nullable(),
|
|
12
|
+
intro: z.string().min(1).nullable(),
|
|
13
|
+
outro: z.string().min(1).nullable(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const RichTextBlockSchema = BlockBaseSchema.extend({
|
|
17
|
+
type: z.literal('richText'),
|
|
18
|
+
body: z.string().min(1),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const FeatureListBlockSchema = BlockBaseSchema.extend({
|
|
22
|
+
type: z.literal('featureList'),
|
|
23
|
+
items: z
|
|
24
|
+
.array(
|
|
25
|
+
z.object({
|
|
26
|
+
title: z.string().min(1),
|
|
27
|
+
body: z.string().min(1),
|
|
28
|
+
}),
|
|
29
|
+
)
|
|
30
|
+
.min(1),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const SpecsBlockSchema = BlockBaseSchema.extend({
|
|
34
|
+
type: z.literal('specs'),
|
|
35
|
+
items: z
|
|
36
|
+
.array(
|
|
37
|
+
z.object({
|
|
38
|
+
label: z.string().min(1),
|
|
39
|
+
value: z.string().min(1),
|
|
40
|
+
}),
|
|
41
|
+
)
|
|
42
|
+
.min(1),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const ExamplesBlockSchema = BlockBaseSchema.extend({
|
|
46
|
+
type: z.literal('examples'),
|
|
47
|
+
items: z
|
|
48
|
+
.array(
|
|
49
|
+
z.object({
|
|
50
|
+
title: z.string().min(1),
|
|
51
|
+
alt: z.string().min(1),
|
|
52
|
+
prompt: z.string().min(1),
|
|
53
|
+
settings: z.string().min(1),
|
|
54
|
+
images: z.array(PageImageSchema),
|
|
55
|
+
}),
|
|
56
|
+
)
|
|
57
|
+
.min(1),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const ComparisonBlockSchema = BlockBaseSchema.extend({
|
|
61
|
+
type: z.literal('comparison'),
|
|
62
|
+
columns: z.array(z.string().min(1)).min(2),
|
|
63
|
+
rows: z
|
|
64
|
+
.array(
|
|
65
|
+
z.object({
|
|
66
|
+
label: z.string().min(1),
|
|
67
|
+
values: z.array(z.string().min(1)).min(1),
|
|
68
|
+
}),
|
|
69
|
+
)
|
|
70
|
+
.min(1),
|
|
71
|
+
}).superRefine((block, ctx) => {
|
|
72
|
+
block.rows.forEach((row, index) => {
|
|
73
|
+
if (row.values.length !== block.columns.length - 1) {
|
|
74
|
+
ctx.addIssue({
|
|
75
|
+
code: 'custom',
|
|
76
|
+
path: ['rows', index, 'values'],
|
|
77
|
+
message: `expected ${block.columns.length - 1} values to match columns`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const ProsConsBlockSchema = BlockBaseSchema.extend({
|
|
84
|
+
type: z.literal('prosCons'),
|
|
85
|
+
items: z
|
|
86
|
+
.array(
|
|
87
|
+
z.object({
|
|
88
|
+
title: z.string().min(1),
|
|
89
|
+
pros: z.array(z.string().min(1)),
|
|
90
|
+
cons: z.array(z.string().min(1)),
|
|
91
|
+
}),
|
|
92
|
+
)
|
|
93
|
+
.min(1),
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const StepsBlockSchema = BlockBaseSchema.extend({
|
|
97
|
+
type: z.literal('steps'),
|
|
98
|
+
items: z
|
|
99
|
+
.array(
|
|
100
|
+
z.object({
|
|
101
|
+
title: z.string().min(1),
|
|
102
|
+
body: z.string().min(1),
|
|
103
|
+
}),
|
|
104
|
+
)
|
|
105
|
+
.min(1),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export const FaqBlockSchema = BlockBaseSchema.extend({
|
|
109
|
+
type: z.literal('faq'),
|
|
110
|
+
items: z
|
|
111
|
+
.array(
|
|
112
|
+
z.object({
|
|
113
|
+
question: z.string().min(1),
|
|
114
|
+
answer: z.string().min(1),
|
|
115
|
+
}),
|
|
116
|
+
)
|
|
117
|
+
.min(1),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export const RELATED_LINK_KIND = {
|
|
121
|
+
model: 'model',
|
|
122
|
+
task: 'task',
|
|
123
|
+
} as const;
|
|
124
|
+
|
|
125
|
+
export const RelatedLinksBlockSchema = BlockBaseSchema.extend({
|
|
126
|
+
type: z.literal('relatedLinks'),
|
|
127
|
+
items: z
|
|
128
|
+
.array(
|
|
129
|
+
z.object({
|
|
130
|
+
kind: z.enum(RELATED_LINK_KIND),
|
|
131
|
+
slug: z.string().min(1),
|
|
132
|
+
title: z.string().min(1),
|
|
133
|
+
note: z.string().min(1).nullable(),
|
|
134
|
+
}),
|
|
135
|
+
)
|
|
136
|
+
.min(1),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const DemoBlockSchema = BlockBaseSchema.extend({
|
|
140
|
+
type: z.literal('demo'),
|
|
141
|
+
caption: z.string().min(1).nullable(),
|
|
142
|
+
presets: z
|
|
143
|
+
.array(
|
|
144
|
+
z.object({
|
|
145
|
+
id: z.string().min(1),
|
|
146
|
+
label: z.string().min(1),
|
|
147
|
+
prompt: z.string().min(1),
|
|
148
|
+
settings: z.string().min(1).nullable(),
|
|
149
|
+
image: PageImageSchema.nullable(),
|
|
150
|
+
}),
|
|
151
|
+
)
|
|
152
|
+
.min(1),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export const PricingWidgetBlockSchema = BlockBaseSchema.extend({
|
|
156
|
+
type: z.literal('pricingWidget'),
|
|
157
|
+
ctaLabel: z.string().min(1),
|
|
158
|
+
ctaSlug: z.string().min(1),
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export const PageContentBlockSchema = z.discriminatedUnion('type', [
|
|
162
|
+
RichTextBlockSchema,
|
|
163
|
+
FeatureListBlockSchema,
|
|
164
|
+
SpecsBlockSchema,
|
|
165
|
+
ExamplesBlockSchema,
|
|
166
|
+
ComparisonBlockSchema,
|
|
167
|
+
ProsConsBlockSchema,
|
|
168
|
+
StepsBlockSchema,
|
|
169
|
+
FaqBlockSchema,
|
|
170
|
+
RelatedLinksBlockSchema,
|
|
171
|
+
DemoBlockSchema,
|
|
172
|
+
PricingWidgetBlockSchema,
|
|
173
|
+
]);
|
|
174
|
+
|
|
175
|
+
export const PageContentSchema = z.object({
|
|
176
|
+
blocks: z.array(PageContentBlockSchema),
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
export type PageImageSchemaType = z.infer<typeof PageImageSchema>;
|
|
180
|
+
export type RelatedLinkKind = (typeof RELATED_LINK_KIND)[keyof typeof RELATED_LINK_KIND];
|
|
181
|
+
export type PageContentBlockSchemaType = z.infer<typeof PageContentBlockSchema>;
|
|
182
|
+
export type PageContentSchemaType = z.infer<typeof PageContentSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IconSchema } from '../../_common';
|
|
3
|
+
import { MODEL_CATEGORY } from '../../model-catalog';
|
|
4
|
+
|
|
5
|
+
export const PublicModelCardSchema = z.object({
|
|
6
|
+
slug: z.string().min(1),
|
|
7
|
+
title: z.string().min(1),
|
|
8
|
+
description: z.string().nullable(),
|
|
9
|
+
vendorName: z.string().min(1),
|
|
10
|
+
icons: IconSchema,
|
|
11
|
+
category: z.enum(MODEL_CATEGORY),
|
|
12
|
+
order: z.number().int(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type PublicModelCardSchemaType = z.infer<typeof PublicModelCardSchema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FILE_TYPE } from '../../file';
|
|
3
|
+
import { PageCardSchema } from './page-card.schema';
|
|
4
|
+
import { PageContentSchema } from './page-content.schema';
|
|
5
|
+
import { PublicModelCardSchema } from './public-model-card.schema';
|
|
6
|
+
|
|
7
|
+
export const PublicChatModelCapabilitiesSchema = z.object({
|
|
8
|
+
reasoning: z.boolean(),
|
|
9
|
+
webSearch: z.boolean(),
|
|
10
|
+
supportedFileTypes: z.array(z.enum(FILE_TYPE)),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const PublicChatModelDetailsSchema = z.object({
|
|
14
|
+
type: z.array(z.string()),
|
|
15
|
+
features: z.array(z.string()),
|
|
16
|
+
maxMessageLength: z.number().int().positive(),
|
|
17
|
+
maxContextWindow: z.number().int().positive(),
|
|
18
|
+
capabilities: PublicChatModelCapabilitiesSchema,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const PublicGenerationModelDetailsSchema = z.object({
|
|
22
|
+
supportedInputFileTypes: z.array(z.enum(FILE_TYPE)),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const PublicModelDetailSchema = PublicModelCardSchema.extend({
|
|
26
|
+
h1: z.string().min(1),
|
|
27
|
+
card: PageCardSchema.nullable(),
|
|
28
|
+
seoTitle: z.string().min(1),
|
|
29
|
+
seoDescription: z.string().nullable(),
|
|
30
|
+
content: PageContentSchema.nullable(),
|
|
31
|
+
chat: PublicChatModelDetailsSchema.nullable(),
|
|
32
|
+
generation: PublicGenerationModelDetailsSchema.nullable(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type PublicChatModelCapabilitiesSchemaType = z.infer<typeof PublicChatModelCapabilitiesSchema>;
|
|
36
|
+
export type PublicChatModelDetailsSchemaType = z.infer<typeof PublicChatModelDetailsSchema>;
|
|
37
|
+
export type PublicGenerationModelDetailsSchemaType = z.infer<typeof PublicGenerationModelDetailsSchema>;
|
|
38
|
+
export type PublicModelDetailSchemaType = z.infer<typeof PublicModelDetailSchema>;
|
package/package.json
CHANGED
|
@@ -215,12 +215,22 @@ import {
|
|
|
215
215
|
CreatePaymentCommandResponse,
|
|
216
216
|
} from '../payment/endpoints/commands/create-payment.command';
|
|
217
217
|
import { AI_MODELS_CONTROLLER } from '../ai-model/endpoints/ai-model';
|
|
218
|
+
import { PUBLIC_MODEL_CONTROLLER } from '../model-page/endpoints/model-page';
|
|
218
219
|
import {
|
|
219
220
|
GetAiModelByUuidQuery,
|
|
220
221
|
GetAiModelByUuidQueryParams,
|
|
221
222
|
GetAiModelByUuidQueryResponse,
|
|
222
223
|
} from '../ai-model/endpoints/queries/get-ai-model-by-uuid.query';
|
|
223
224
|
import { GetAllAiModelsQuery, GetAllAiModelsQueryResponse } from '../ai-model/endpoints/queries/get-ai-models.query';
|
|
225
|
+
import {
|
|
226
|
+
GetPublicModelBySlugQuery,
|
|
227
|
+
GetPublicModelBySlugQueryParams,
|
|
228
|
+
GetPublicModelBySlugQueryResponse,
|
|
229
|
+
} from '../model-page/endpoints/queries/get-public-model-by-slug.query';
|
|
230
|
+
import {
|
|
231
|
+
ListPublicModelsQuery,
|
|
232
|
+
ListPublicModelsQueryResponse,
|
|
233
|
+
} from '../model-page/endpoints/queries/list-public-models.query';
|
|
224
234
|
import { MODEL_CATALOG_CONTROLLER } from '../model-catalog/endpoints/model-catalog';
|
|
225
235
|
import {
|
|
226
236
|
GetModelCatalogQuery,
|
|
@@ -466,6 +476,9 @@ async function main() {
|
|
|
466
476
|
registerSchema('AiModelsGetAllResponse', GetAllAiModelsQueryResponse);
|
|
467
477
|
registerSchema('AiModelsGetByUuidParams', GetAiModelByUuidQueryParams);
|
|
468
478
|
registerSchema('AiModelsGetByUuidResponse', GetAiModelByUuidQueryResponse);
|
|
479
|
+
registerSchema('PublicModelsListResponse', ListPublicModelsQueryResponse);
|
|
480
|
+
registerSchema('PublicModelsGetBySlugParams', GetPublicModelBySlugQueryParams);
|
|
481
|
+
registerSchema('PublicModelsGetBySlugResponse', GetPublicModelBySlugQueryResponse);
|
|
469
482
|
registerSchema('ModelCatalogGetAllResponse', GetModelCatalogQueryResponse);
|
|
470
483
|
registerSchema('GenerationModelGetAllResponse', GetGenerationModelsQueryResponse);
|
|
471
484
|
registerSchema('GenerationModelGetByTypeParams', GetGenerationModelsByTypeQueryParams);
|
|
@@ -612,6 +625,7 @@ async function main() {
|
|
|
612
625
|
DeleteMarketplaceCardCommand,
|
|
613
626
|
];
|
|
614
627
|
const aiModelContracts: HttpContract[] = [GetAllAiModelsQuery, GetAiModelByUuidQuery];
|
|
628
|
+
const publicModelContracts: HttpContract[] = [ListPublicModelsQuery, GetPublicModelBySlugQuery];
|
|
615
629
|
const modelCatalogContracts: HttpContract[] = [GetModelCatalogQuery];
|
|
616
630
|
const generationModelContracts: HttpContract[] = [
|
|
617
631
|
GetGenerationModelsQuery,
|
|
@@ -908,6 +922,37 @@ async function main() {
|
|
|
908
922
|
});
|
|
909
923
|
}
|
|
910
924
|
|
|
925
|
+
for (const contract of publicModelContracts) {
|
|
926
|
+
const method = contract.method.toLowerCase();
|
|
927
|
+
if (!supportedHttpMethods.has(method)) {
|
|
928
|
+
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
registry.registerPath({
|
|
932
|
+
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
933
|
+
path: toOpenApiPath(PUBLIC_MODEL_CONTROLLER, contract.path),
|
|
934
|
+
summary: contract.summary,
|
|
935
|
+
tags: ['Models (public)'],
|
|
936
|
+
request: {
|
|
937
|
+
...(contract.request?.body
|
|
938
|
+
? {
|
|
939
|
+
body: {
|
|
940
|
+
required: true,
|
|
941
|
+
content: {
|
|
942
|
+
'application/json': {
|
|
943
|
+
schema: resolveSchema(contract.request.body),
|
|
944
|
+
},
|
|
945
|
+
},
|
|
946
|
+
},
|
|
947
|
+
}
|
|
948
|
+
: {}),
|
|
949
|
+
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
950
|
+
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
951
|
+
},
|
|
952
|
+
responses: buildResponses(contract.responses, resolveSchema),
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
|
|
911
956
|
for (const contract of modelCatalogContracts) {
|
|
912
957
|
const method = contract.method.toLowerCase();
|
|
913
958
|
if (!supportedHttpMethods.has(method)) {
|