@ai-grator/api 0.3.77 → 0.3.79

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 (286) hide show
  1. package/admin/endpoints/admin.ts +16 -0
  2. package/admin/endpoints/commands/create-admin-preset-category.command.ts +29 -0
  3. package/admin/endpoints/commands/create-admin-preset.command.ts +30 -0
  4. package/admin/endpoints/commands/delete-admin-preset-category.command.ts +29 -0
  5. package/admin/endpoints/commands/delete-admin-preset.command.ts +28 -0
  6. package/admin/endpoints/commands/index.ts +9 -0
  7. package/admin/endpoints/commands/probe-admin-trend-reference-video.command.ts +1 -0
  8. package/admin/endpoints/commands/reorder-admin-preset-categories.command.ts +33 -0
  9. package/admin/endpoints/commands/reorder-admin-presets.command.ts +33 -0
  10. package/admin/endpoints/commands/update-admin-preset-category.command.ts +36 -0
  11. package/admin/endpoints/commands/update-admin-preset-status.command.ts +37 -0
  12. package/admin/endpoints/commands/update-admin-preset.command.ts +36 -0
  13. package/admin/endpoints/queries/get-admin-preset-categories.query.ts +22 -0
  14. package/admin/endpoints/queries/get-admin-preset.query.ts +29 -0
  15. package/admin/endpoints/queries/get-admin-presets.query.ts +37 -0
  16. package/admin/endpoints/queries/index.ts +3 -0
  17. package/admin/models/admin-preset-category-response.schema.ts +14 -0
  18. package/admin/models/admin-preset-response.schema.ts +67 -0
  19. package/admin/models/index.ts +2 -0
  20. package/build/admin/endpoints/admin.d.ts +12 -0
  21. package/build/admin/endpoints/admin.d.ts.map +1 -1
  22. package/build/admin/endpoints/admin.js +14 -0
  23. package/build/admin/endpoints/commands/create-admin-preset-category.command.d.ts +51 -0
  24. package/build/admin/endpoints/commands/create-admin-preset-category.command.d.ts.map +1 -0
  25. package/build/admin/endpoints/commands/create-admin-preset-category.command.js +25 -0
  26. package/build/admin/endpoints/commands/create-admin-preset.command.d.ts +490 -0
  27. package/build/admin/endpoints/commands/create-admin-preset.command.d.ts.map +1 -0
  28. package/build/admin/endpoints/commands/create-admin-preset.command.js +26 -0
  29. package/build/admin/endpoints/commands/delete-admin-preset-category.command.d.ts +27 -0
  30. package/build/admin/endpoints/commands/delete-admin-preset-category.command.d.ts.map +1 -0
  31. package/build/admin/endpoints/commands/delete-admin-preset-category.command.js +26 -0
  32. package/build/admin/endpoints/commands/delete-admin-preset.command.d.ts +26 -0
  33. package/build/admin/endpoints/commands/delete-admin-preset.command.d.ts.map +1 -0
  34. package/build/admin/endpoints/commands/delete-admin-preset.command.js +25 -0
  35. package/build/admin/endpoints/commands/index.d.ts +9 -0
  36. package/build/admin/endpoints/commands/index.d.ts.map +1 -1
  37. package/build/admin/endpoints/commands/index.js +9 -0
  38. package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.d.ts +2 -0
  39. package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.d.ts.map +1 -1
  40. package/build/admin/endpoints/commands/probe-admin-trend-reference-video.command.js +1 -0
  41. package/build/admin/endpoints/commands/reorder-admin-preset-categories.command.d.ts +26 -0
  42. package/build/admin/endpoints/commands/reorder-admin-preset-categories.command.d.ts.map +1 -0
  43. package/build/admin/endpoints/commands/reorder-admin-preset-categories.command.js +28 -0
  44. package/build/admin/endpoints/commands/reorder-admin-presets.command.d.ts +29 -0
  45. package/build/admin/endpoints/commands/reorder-admin-presets.command.d.ts.map +1 -0
  46. package/build/admin/endpoints/commands/reorder-admin-presets.command.js +30 -0
  47. package/build/admin/endpoints/commands/update-admin-preset-category.command.d.ts +59 -0
  48. package/build/admin/endpoints/commands/update-admin-preset-category.command.d.ts.map +1 -0
  49. package/build/admin/endpoints/commands/update-admin-preset-category.command.js +31 -0
  50. package/build/admin/endpoints/commands/update-admin-preset-status.command.d.ts +312 -0
  51. package/build/admin/endpoints/commands/update-admin-preset-status.command.d.ts.map +1 -0
  52. package/build/admin/endpoints/commands/update-admin-preset-status.command.js +32 -0
  53. package/build/admin/endpoints/commands/update-admin-preset.command.d.ts +497 -0
  54. package/build/admin/endpoints/commands/update-admin-preset.command.d.ts.map +1 -0
  55. package/build/admin/endpoints/commands/update-admin-preset.command.js +31 -0
  56. package/build/admin/endpoints/queries/get-admin-preset-categories.query.d.ts +38 -0
  57. package/build/admin/endpoints/queries/get-admin-preset-categories.query.d.ts.map +1 -0
  58. package/build/admin/endpoints/queries/get-admin-preset-categories.query.js +21 -0
  59. package/build/admin/endpoints/queries/get-admin-preset.query.d.ts +304 -0
  60. package/build/admin/endpoints/queries/get-admin-preset.query.d.ts.map +1 -0
  61. package/build/admin/endpoints/queries/get-admin-preset.query.js +26 -0
  62. package/build/admin/endpoints/queries/get-admin-presets.query.d.ts +141 -0
  63. package/build/admin/endpoints/queries/get-admin-presets.query.d.ts.map +1 -0
  64. package/build/admin/endpoints/queries/get-admin-presets.query.js +34 -0
  65. package/build/admin/endpoints/queries/index.d.ts +3 -0
  66. package/build/admin/endpoints/queries/index.d.ts.map +1 -1
  67. package/build/admin/endpoints/queries/index.js +3 -0
  68. package/build/admin/models/admin-preset-category-response.schema.d.ts +13 -0
  69. package/build/admin/models/admin-preset-category-response.schema.d.ts.map +1 -0
  70. package/build/admin/models/admin-preset-category-response.schema.js +14 -0
  71. package/build/admin/models/admin-preset-response.schema.d.ts +205 -0
  72. package/build/admin/models/admin-preset-response.schema.d.ts.map +1 -0
  73. package/build/admin/models/admin-preset-response.schema.js +52 -0
  74. package/build/admin/models/index.d.ts +2 -0
  75. package/build/admin/models/index.d.ts.map +1 -1
  76. package/build/admin/models/index.js +2 -0
  77. package/build/chat/endpoints/commands/create-chat.command.d.ts +8 -0
  78. package/build/chat/endpoints/commands/create-chat.command.d.ts.map +1 -1
  79. package/build/chat/endpoints/commands/update-chat.command.d.ts +8 -0
  80. package/build/chat/endpoints/commands/update-chat.command.d.ts.map +1 -1
  81. package/build/chat/endpoints/queries/get-chat-by-uuid.query.d.ts +8 -0
  82. package/build/chat/endpoints/queries/get-chat-by-uuid.query.d.ts.map +1 -1
  83. package/build/chat/endpoints/queries/get-chats.query.d.ts +10 -0
  84. package/build/chat/endpoints/queries/get-chats.query.d.ts.map +1 -1
  85. package/build/chat/endpoints/queries/get-chats.query.js +4 -1
  86. package/build/chat/models/chat-response.schema.d.ts +4 -0
  87. package/build/chat/models/chat-response.schema.d.ts.map +1 -1
  88. package/build/chat/models/chat-response.schema.js +2 -0
  89. package/build/errors/errors.d.ts +207 -0
  90. package/build/errors/errors.d.ts.map +1 -1
  91. package/build/errors/errors.js +207 -0
  92. package/build/generation-job/endpoints/commands/create-generation-job.command.d.ts +8 -0
  93. package/build/generation-job/endpoints/commands/create-generation-job.command.d.ts.map +1 -1
  94. package/build/generation-job/endpoints/commands/update-generation-job.command.d.ts +8 -0
  95. package/build/generation-job/endpoints/commands/update-generation-job.command.d.ts.map +1 -1
  96. package/build/generation-job/endpoints/queries/get-generation-job-by-uuid.query.d.ts +8 -0
  97. package/build/generation-job/endpoints/queries/get-generation-job-by-uuid.query.d.ts.map +1 -1
  98. package/build/generation-job/endpoints/queries/get-generation-job-history.query.d.ts +14 -0
  99. package/build/generation-job/endpoints/queries/get-generation-job-history.query.d.ts.map +1 -1
  100. package/build/generation-job/endpoints/queries/get-generation-job-history.query.js +2 -0
  101. package/build/generation-job/endpoints/queries/get-generation-jobs.query.d.ts +10 -0
  102. package/build/generation-job/endpoints/queries/get-generation-jobs.query.d.ts.map +1 -1
  103. package/build/generation-job/endpoints/queries/get-generation-jobs.query.js +2 -0
  104. package/build/generation-job/models/generation-job-response.schema.d.ts +4 -0
  105. package/build/generation-job/models/generation-job-response.schema.d.ts.map +1 -1
  106. package/build/generation-job/models/generation-job-response.schema.js +2 -0
  107. package/build/generation-job/models/index.d.ts +1 -0
  108. package/build/generation-job/models/index.d.ts.map +1 -1
  109. package/build/generation-job/models/index.js +1 -0
  110. package/build/generation-job/models/seedance-2_5-params.schema.d.ts +50 -0
  111. package/build/generation-job/models/seedance-2_5-params.schema.d.ts.map +1 -0
  112. package/build/generation-job/models/seedance-2_5-params.schema.js +30 -0
  113. package/build/generation-job-chat/endpoints/commands/create-generation-job-chat.command.d.ts +8 -0
  114. package/build/generation-job-chat/endpoints/commands/create-generation-job-chat.command.d.ts.map +1 -1
  115. package/build/generation-job-chat/endpoints/commands/update-generation-job-chat.command.d.ts +8 -0
  116. package/build/generation-job-chat/endpoints/commands/update-generation-job-chat.command.d.ts.map +1 -1
  117. package/build/generation-job-chat/endpoints/queries/get-generation-job-chat-by-uuid.query.d.ts +8 -0
  118. package/build/generation-job-chat/endpoints/queries/get-generation-job-chat-by-uuid.query.d.ts.map +1 -1
  119. package/build/generation-job-chat/endpoints/queries/get-generation-job-chats.query.d.ts +10 -0
  120. package/build/generation-job-chat/endpoints/queries/get-generation-job-chats.query.d.ts.map +1 -1
  121. package/build/generation-job-chat/endpoints/queries/get-generation-job-chats.query.js +2 -0
  122. package/build/generation-job-chat/models/generation-job-chat-response.schema.d.ts +4 -0
  123. package/build/generation-job-chat/models/generation-job-chat-response.schema.d.ts.map +1 -1
  124. package/build/generation-job-chat/models/generation-job-chat-response.schema.js +2 -0
  125. package/build/index.d.ts +1 -0
  126. package/build/index.d.ts.map +1 -1
  127. package/build/index.js +1 -0
  128. package/build/preset/endpoints/commands/add-preset-favorite.command.d.ts +25 -0
  129. package/build/preset/endpoints/commands/add-preset-favorite.command.d.ts.map +1 -0
  130. package/build/preset/endpoints/commands/add-preset-favorite.command.js +22 -0
  131. package/build/preset/endpoints/commands/index.d.ts +5 -0
  132. package/build/preset/endpoints/commands/index.d.ts.map +1 -0
  133. package/build/preset/endpoints/commands/index.js +20 -0
  134. package/build/preset/endpoints/commands/prepare-preset.command.d.ts +198 -0
  135. package/build/preset/endpoints/commands/prepare-preset.command.d.ts.map +1 -0
  136. package/build/preset/endpoints/commands/prepare-preset.command.js +41 -0
  137. package/build/preset/endpoints/commands/remove-preset-favorite.command.d.ts +25 -0
  138. package/build/preset/endpoints/commands/remove-preset-favorite.command.d.ts.map +1 -0
  139. package/build/preset/endpoints/commands/remove-preset-favorite.command.js +22 -0
  140. package/build/preset/endpoints/commands/run-preset.command.d.ts +387 -0
  141. package/build/preset/endpoints/commands/run-preset.command.d.ts.map +1 -0
  142. package/build/preset/endpoints/commands/run-preset.command.js +55 -0
  143. package/build/preset/endpoints/index.d.ts +4 -0
  144. package/build/preset/endpoints/index.d.ts.map +1 -0
  145. package/build/preset/endpoints/index.js +19 -0
  146. package/build/preset/endpoints/preset.d.ts +16 -0
  147. package/build/preset/endpoints/preset.d.ts.map +1 -0
  148. package/build/preset/endpoints/preset.js +18 -0
  149. package/build/preset/endpoints/queries/get-preset-price.query.d.ts +62 -0
  150. package/build/preset/endpoints/queries/get-preset-price.query.d.ts.map +1 -0
  151. package/build/preset/endpoints/queries/get-preset-price.query.js +30 -0
  152. package/build/preset/endpoints/queries/get-preset-results.query.d.ts +74 -0
  153. package/build/preset/endpoints/queries/get-preset-results.query.d.ts.map +1 -0
  154. package/build/preset/endpoints/queries/get-preset-results.query.js +32 -0
  155. package/build/preset/endpoints/queries/get-public-preset-by-slug.query.d.ts +334 -0
  156. package/build/preset/endpoints/queries/get-public-preset-by-slug.query.d.ts.map +1 -0
  157. package/build/preset/endpoints/queries/get-public-preset-by-slug.query.js +25 -0
  158. package/build/preset/endpoints/queries/index.d.ts +6 -0
  159. package/build/preset/endpoints/queries/index.d.ts.map +1 -0
  160. package/build/preset/endpoints/queries/index.js +21 -0
  161. package/build/preset/endpoints/queries/list-public-preset-categories.query.d.ts +28 -0
  162. package/build/preset/endpoints/queries/list-public-preset-categories.query.d.ts.map +1 -0
  163. package/build/preset/endpoints/queries/list-public-preset-categories.query.js +19 -0
  164. package/build/preset/endpoints/queries/list-public-presets.query.d.ts +122 -0
  165. package/build/preset/endpoints/queries/list-public-presets.query.d.ts.map +1 -0
  166. package/build/preset/endpoints/queries/list-public-presets.query.js +32 -0
  167. package/build/preset/enums/index.d.ts +10 -0
  168. package/build/preset/enums/index.d.ts.map +1 -0
  169. package/build/preset/enums/index.js +25 -0
  170. package/build/preset/enums/preset-card-media-type.enum.d.ts +6 -0
  171. package/build/preset/enums/preset-card-media-type.enum.d.ts.map +1 -0
  172. package/build/preset/enums/preset-card-media-type.enum.js +9 -0
  173. package/build/preset/enums/preset-example-type.enum.d.ts +5 -0
  174. package/build/preset/enums/preset-example-type.enum.d.ts.map +1 -0
  175. package/build/preset/enums/preset-example-type.enum.js +8 -0
  176. package/build/preset/enums/preset-field-type.enum.d.ts +6 -0
  177. package/build/preset/enums/preset-field-type.enum.d.ts.map +1 -0
  178. package/build/preset/enums/preset-field-type.enum.js +9 -0
  179. package/build/preset/enums/preset-filter.enum.d.ts +6 -0
  180. package/build/preset/enums/preset-filter.enum.d.ts.map +1 -0
  181. package/build/preset/enums/preset-filter.enum.js +9 -0
  182. package/build/preset/enums/preset-limits.d.ts +30 -0
  183. package/build/preset/enums/preset-limits.d.ts.map +1 -0
  184. package/build/preset/enums/preset-limits.js +32 -0
  185. package/build/preset/enums/preset-result-type.enum.d.ts +5 -0
  186. package/build/preset/enums/preset-result-type.enum.d.ts.map +1 -0
  187. package/build/preset/enums/preset-result-type.enum.js +8 -0
  188. package/build/preset/enums/preset-select-display.enum.d.ts +7 -0
  189. package/build/preset/enums/preset-select-display.enum.d.ts.map +1 -0
  190. package/build/preset/enums/preset-select-display.enum.js +10 -0
  191. package/build/preset/enums/preset-status.enum.d.ts +5 -0
  192. package/build/preset/enums/preset-status.enum.d.ts.map +1 -0
  193. package/build/preset/enums/preset-status.enum.js +8 -0
  194. package/build/preset/enums/preset-tool.enum.d.ts +6 -0
  195. package/build/preset/enums/preset-tool.enum.d.ts.map +1 -0
  196. package/build/preset/enums/preset-tool.enum.js +9 -0
  197. package/build/preset/helpers/index.d.ts +3 -0
  198. package/build/preset/helpers/index.d.ts.map +1 -0
  199. package/build/preset/helpers/index.js +18 -0
  200. package/build/preset/helpers/preset-prompt-placeholder.helper.d.ts +4 -0
  201. package/build/preset/helpers/preset-prompt-placeholder.helper.d.ts.map +1 -0
  202. package/build/preset/helpers/preset-prompt-placeholder.helper.js +12 -0
  203. package/build/preset/helpers/preset-tag.helper.d.ts +3 -0
  204. package/build/preset/helpers/preset-tag.helper.d.ts.map +1 -0
  205. package/build/preset/helpers/preset-tag.helper.js +9 -0
  206. package/build/preset/index.d.ts +5 -0
  207. package/build/preset/index.d.ts.map +1 -0
  208. package/build/preset/index.js +20 -0
  209. package/build/preset/models/index.d.ts +9 -0
  210. package/build/preset/models/index.d.ts.map +1 -0
  211. package/build/preset/models/index.js +24 -0
  212. package/build/preset/models/preset-common.schema.d.ts +23 -0
  213. package/build/preset/models/preset-common.schema.d.ts.map +1 -0
  214. package/build/preset/models/preset-common.schema.js +26 -0
  215. package/build/preset/models/preset-field-value.schema.d.ts +51 -0
  216. package/build/preset/models/preset-field-value.schema.d.ts.map +1 -0
  217. package/build/preset/models/preset-field-value.schema.js +44 -0
  218. package/build/preset/models/preset-field.schema.d.ts +310 -0
  219. package/build/preset/models/preset-field.schema.d.ts.map +1 -0
  220. package/build/preset/models/preset-field.schema.js +186 -0
  221. package/build/preset/models/preset-input.schema.d.ts +106 -0
  222. package/build/preset/models/preset-input.schema.d.ts.map +1 -0
  223. package/build/preset/models/preset-input.schema.js +97 -0
  224. package/build/preset/models/preset-media.schema.d.ts +81 -0
  225. package/build/preset/models/preset-media.schema.d.ts.map +1 -0
  226. package/build/preset/models/preset-media.schema.js +75 -0
  227. package/build/preset/models/preset-result.schema.d.ts +23 -0
  228. package/build/preset/models/preset-result.schema.d.ts.map +1 -0
  229. package/build/preset/models/preset-result.schema.js +21 -0
  230. package/build/preset/models/preset-tag.schema.d.ts +10 -0
  231. package/build/preset/models/preset-tag.schema.d.ts.map +1 -0
  232. package/build/preset/models/preset-tag.schema.js +11 -0
  233. package/build/preset/models/public-preset.schema.d.ts +322 -0
  234. package/build/preset/models/public-preset.schema.d.ts.map +1 -0
  235. package/build/preset/models/public-preset.schema.js +50 -0
  236. package/build/trend/endpoints/commands/generate-trend.command.d.ts +8 -0
  237. package/build/trend/endpoints/commands/generate-trend.command.d.ts.map +1 -1
  238. package/build/tsconfig.tsbuildinfo +1 -1
  239. package/chat/endpoints/queries/get-chats.query.ts +4 -1
  240. package/chat/models/chat-response.schema.ts +2 -0
  241. package/errors/errors.ts +207 -0
  242. package/generation-job/endpoints/queries/get-generation-job-history.query.ts +2 -0
  243. package/generation-job/endpoints/queries/get-generation-jobs.query.ts +2 -0
  244. package/generation-job/models/generation-job-response.schema.ts +2 -0
  245. package/generation-job/models/index.ts +1 -0
  246. package/generation-job/models/seedance-2_5-params.schema.ts +32 -0
  247. package/generation-job-chat/endpoints/queries/get-generation-job-chats.query.ts +2 -0
  248. package/generation-job-chat/models/generation-job-chat-response.schema.ts +2 -0
  249. package/index.ts +1 -0
  250. package/package.json +1 -1
  251. package/preset/endpoints/commands/add-preset-favorite.command.ts +26 -0
  252. package/preset/endpoints/commands/index.ts +4 -0
  253. package/preset/endpoints/commands/prepare-preset.command.ts +47 -0
  254. package/preset/endpoints/commands/remove-preset-favorite.command.ts +26 -0
  255. package/preset/endpoints/commands/run-preset.command.ts +65 -0
  256. package/preset/endpoints/index.ts +3 -0
  257. package/preset/endpoints/preset.ts +18 -0
  258. package/preset/endpoints/queries/get-preset-price.query.ts +35 -0
  259. package/preset/endpoints/queries/get-preset-results.query.ts +37 -0
  260. package/preset/endpoints/queries/get-public-preset-by-slug.query.ts +30 -0
  261. package/preset/endpoints/queries/index.ts +5 -0
  262. package/preset/endpoints/queries/list-public-preset-categories.query.ts +20 -0
  263. package/preset/endpoints/queries/list-public-presets.query.ts +35 -0
  264. package/preset/enums/index.ts +9 -0
  265. package/preset/enums/preset-card-media-type.enum.ts +5 -0
  266. package/preset/enums/preset-example-type.enum.ts +4 -0
  267. package/preset/enums/preset-field-type.enum.ts +5 -0
  268. package/preset/enums/preset-filter.enum.ts +5 -0
  269. package/preset/enums/preset-limits.ts +33 -0
  270. package/preset/enums/preset-result-type.enum.ts +4 -0
  271. package/preset/enums/preset-select-display.enum.ts +6 -0
  272. package/preset/enums/preset-status.enum.ts +4 -0
  273. package/preset/enums/preset-tool.enum.ts +5 -0
  274. package/preset/helpers/index.ts +2 -0
  275. package/preset/helpers/preset-prompt-placeholder.helper.ts +9 -0
  276. package/preset/helpers/preset-tag.helper.ts +9 -0
  277. package/preset/index.ts +4 -0
  278. package/preset/models/index.ts +8 -0
  279. package/preset/models/preset-common.schema.ts +45 -0
  280. package/preset/models/preset-field-value.schema.ts +51 -0
  281. package/preset/models/preset-field.schema.ts +251 -0
  282. package/preset/models/preset-input.schema.ts +129 -0
  283. package/preset/models/preset-media.schema.ts +94 -0
  284. package/preset/models/preset-result.schema.ts +21 -0
  285. package/preset/models/preset-tag.schema.ts +13 -0
  286. package/preset/models/public-preset.schema.ts +68 -0
@@ -2,8 +2,11 @@ import { z } from 'zod';
2
2
  import { defineContract, defineCursorPaginationQuery, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
3
  import { ChatResponseSchema } from '../../models';
4
4
  import { CHAT_ROUTES } from '../chat';
5
+ import { PresetFilterQuerySchema } from '../../../preset/models/preset-tag.schema';
5
6
 
6
- export const GetChatsQueryQuery = defineCursorPaginationQuery(z.uuid());
7
+ export const GetChatsQueryQuery = defineCursorPaginationQuery(z.uuid()).extend({
8
+ presetFilter: PresetFilterQuerySchema,
9
+ });
7
10
 
8
11
  export const GetChatsQueryResponse = z.object({
9
12
  chats: z.array(ChatResponseSchema),
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { PresetTagSchema } from '../../preset/models/preset-tag.schema';
2
3
  import { CHAT_STATUS } from '../enums';
3
4
 
4
5
  export const ChatLastModelSchema = z.object({
@@ -17,6 +18,7 @@ export const ChatResponseSchema = z.object({
17
18
  title: z.string().min(1),
18
19
  chatStatus: z.enum(CHAT_STATUS),
19
20
  lastModel: ChatLastModelSchema.nullable(),
21
+ preset: PresetTagSchema.nullable(),
20
22
  createdAt: z.iso.datetime(),
21
23
  updatedAt: z.iso.datetime(),
22
24
  lastMessageAt: z.iso.datetime(),
package/errors/errors.ts CHANGED
@@ -389,6 +389,11 @@ export const ERRORS = {
389
389
  code: 'GENERATION_JOB.INVALID_ELEMENT_REFERENCES',
390
390
  message: 'Субъекты или голоса заданы некорректно',
391
391
  },
392
+ TASK_TYPE_REQUIRES_REFERENCES: {
393
+ httpCode: 400,
394
+ code: 'GENERATION_JOB.TASK_TYPE_REQUIRES_REFERENCES',
395
+ message: 'Для выбранного типа задачи не хватает референсов',
396
+ },
392
397
  TOO_MANY_REFERENCES: {
393
398
  httpCode: 400,
394
399
  code: 'GENERATION_JOB.TOO_MANY_REFERENCES',
@@ -1416,6 +1421,208 @@ export const ERRORS = {
1416
1421
  message: 'Не удалось запустить генерацию по тренду',
1417
1422
  },
1418
1423
  },
1424
+ PRESET: {
1425
+ NOT_FOUND: {
1426
+ httpCode: 404,
1427
+ code: 'PRESET.NOT_FOUND',
1428
+ message: 'Пресет не найден',
1429
+ },
1430
+ SLUG_CONFLICT: {
1431
+ httpCode: 409,
1432
+ code: 'PRESET.SLUG_CONFLICT',
1433
+ message: 'Пресет с таким slug уже существует',
1434
+ },
1435
+ CATEGORY_NOT_FOUND: {
1436
+ httpCode: 404,
1437
+ code: 'PRESET.CATEGORY_NOT_FOUND',
1438
+ message: 'Категория пресетов не найдена',
1439
+ },
1440
+ CATEGORY_SLUG_CONFLICT: {
1441
+ httpCode: 409,
1442
+ code: 'PRESET.CATEGORY_SLUG_CONFLICT',
1443
+ message: 'Категория пресетов с таким slug уже существует',
1444
+ },
1445
+ CATEGORY_NOT_EMPTY: {
1446
+ httpCode: 409,
1447
+ code: 'PRESET.CATEGORY_NOT_EMPTY',
1448
+ message: 'В категории есть пресеты, удалите или перенесите их',
1449
+ },
1450
+ CATEGORY_REORDER_INVALID: {
1451
+ httpCode: 400,
1452
+ code: 'PRESET.CATEGORY_REORDER_INVALID',
1453
+ message: 'Список для сортировки должен содержать все категории ровно один раз',
1454
+ },
1455
+ REORDER_INVALID: {
1456
+ httpCode: 400,
1457
+ code: 'PRESET.REORDER_INVALID',
1458
+ message: 'Список для сортировки должен содержать все пресеты категории ровно один раз',
1459
+ },
1460
+ MODEL_NOT_FOUND: {
1461
+ httpCode: 404,
1462
+ code: 'PRESET.MODEL_NOT_FOUND',
1463
+ message: 'Модель для пресета не найдена',
1464
+ },
1465
+ MODEL_TOOL_MISMATCH: {
1466
+ httpCode: 400,
1467
+ code: 'PRESET.MODEL_TOOL_MISMATCH',
1468
+ message: 'Модель не соответствует инструменту пресета',
1469
+ },
1470
+ MODEL_UNAVAILABLE: {
1471
+ httpCode: 400,
1472
+ code: 'PRESET.MODEL_UNAVAILABLE',
1473
+ message: 'Модель пресета сейчас недоступна',
1474
+ },
1475
+ PARAMS_INVALID: {
1476
+ httpCode: 400,
1477
+ code: 'PRESET.PARAMS_INVALID',
1478
+ message: 'Параметры пресета не подходят модели',
1479
+ },
1480
+ MEDIA_FILE_NOT_FOUND: {
1481
+ httpCode: 404,
1482
+ code: 'PRESET.MEDIA_FILE_NOT_FOUND',
1483
+ message: 'Файл медиа пресета не найден',
1484
+ },
1485
+ MEDIA_FILE_TYPE_INVALID: {
1486
+ httpCode: 400,
1487
+ code: 'PRESET.MEDIA_FILE_TYPE_INVALID',
1488
+ message: 'Файл медиа пресета имеет неверный тип',
1489
+ },
1490
+ ATTACHMENT_SLOT_NOT_FOUND: {
1491
+ httpCode: 400,
1492
+ code: 'PRESET.ATTACHMENT_SLOT_NOT_FOUND',
1493
+ message: 'Модель не поддерживает указанный слот вложений',
1494
+ },
1495
+ ATTACHMENT_SLOT_LIMIT_EXCEEDED: {
1496
+ httpCode: 400,
1497
+ code: 'PRESET.ATTACHMENT_SLOT_LIMIT_EXCEEDED',
1498
+ message: 'Количество файлов в полях превышает лимит модели',
1499
+ },
1500
+ PROMPT_UNKNOWN_FIELD: {
1501
+ httpCode: 400,
1502
+ code: 'PRESET.PROMPT_UNKNOWN_FIELD',
1503
+ message: 'Промпт ссылается на несуществующее поле',
1504
+ },
1505
+ FIELD_NOT_FOUND: {
1506
+ httpCode: 400,
1507
+ code: 'PRESET.FIELD_NOT_FOUND',
1508
+ message: 'Поле не принадлежит пресету',
1509
+ },
1510
+ FIELD_VALUE_MISSING: {
1511
+ httpCode: 400,
1512
+ code: 'PRESET.FIELD_VALUE_MISSING',
1513
+ message: 'Заполните обязательные поля пресета',
1514
+ },
1515
+ FIELD_VALUE_TYPE_MISMATCH: {
1516
+ httpCode: 400,
1517
+ code: 'PRESET.FIELD_VALUE_TYPE_MISMATCH',
1518
+ message: 'Тип значения не совпадает с типом поля',
1519
+ },
1520
+ FIELD_OPTION_NOT_FOUND: {
1521
+ httpCode: 400,
1522
+ code: 'PRESET.FIELD_OPTION_NOT_FOUND',
1523
+ message: 'Выбранный вариант не существует',
1524
+ },
1525
+ FIELD_MULTIPLE_NOT_ALLOWED: {
1526
+ httpCode: 400,
1527
+ code: 'PRESET.FIELD_MULTIPLE_NOT_ALLOWED',
1528
+ message: 'В поле можно выбрать только один вариант',
1529
+ },
1530
+ FIELD_CUSTOM_NOT_ALLOWED: {
1531
+ httpCode: 400,
1532
+ code: 'PRESET.FIELD_CUSTOM_NOT_ALLOWED',
1533
+ message: 'В поле нельзя указать свой вариант',
1534
+ },
1535
+ FIELD_TEXT_TOO_LONG: {
1536
+ httpCode: 400,
1537
+ code: 'PRESET.FIELD_TEXT_TOO_LONG',
1538
+ message: 'Текст превышает допустимую длину поля',
1539
+ },
1540
+ FIELD_FILE_COUNT_INVALID: {
1541
+ httpCode: 400,
1542
+ code: 'PRESET.FIELD_FILE_COUNT_INVALID',
1543
+ message: 'Количество файлов не соответствует полю',
1544
+ },
1545
+ FIELD_FILE_TYPE_INVALID: {
1546
+ httpCode: 400,
1547
+ code: 'PRESET.FIELD_FILE_TYPE_INVALID',
1548
+ message: 'Тип файла не подходит для поля',
1549
+ },
1550
+ FIELD_REQUIRE_ONE_OF_MISSING: {
1551
+ httpCode: 400,
1552
+ code: 'PRESET.FIELD_REQUIRE_ONE_OF_MISSING',
1553
+ message: 'Заполните хотя бы одно поле из группы',
1554
+ },
1555
+ FIELD_HIDDEN_VALUE: {
1556
+ httpCode: 400,
1557
+ code: 'PRESET.FIELD_HIDDEN_VALUE',
1558
+ message: 'Передано значение скрытого поля',
1559
+ },
1560
+ MODEL_FEATURE_UNSUPPORTED: {
1561
+ httpCode: 400,
1562
+ code: 'PRESET.MODEL_FEATURE_UNSUPPORTED',
1563
+ message: 'Модель не поддерживает выбранные опции чата',
1564
+ },
1565
+ PROMPT_TOO_LONG: {
1566
+ httpCode: 400,
1567
+ code: 'PRESET.PROMPT_TOO_LONG',
1568
+ message: 'Промпт с подставленными значениями превышает лимит модели',
1569
+ },
1570
+ FIND_ERROR: {
1571
+ httpCode: 500,
1572
+ code: 'PRESET.FIND_ERROR',
1573
+ message: 'Не удалось получить пресеты',
1574
+ },
1575
+ CREATE_ERROR: {
1576
+ httpCode: 500,
1577
+ code: 'PRESET.CREATE_ERROR',
1578
+ message: 'Не удалось создать пресет',
1579
+ },
1580
+ UPDATE_ERROR: {
1581
+ httpCode: 500,
1582
+ code: 'PRESET.UPDATE_ERROR',
1583
+ message: 'Не удалось обновить пресет',
1584
+ },
1585
+ DELETE_ERROR: {
1586
+ httpCode: 500,
1587
+ code: 'PRESET.DELETE_ERROR',
1588
+ message: 'Не удалось удалить пресет',
1589
+ },
1590
+ CATEGORY_SAVE_ERROR: {
1591
+ httpCode: 500,
1592
+ code: 'PRESET.CATEGORY_SAVE_ERROR',
1593
+ message: 'Не удалось сохранить категорию пресетов',
1594
+ },
1595
+ CATEGORY_DELETE_ERROR: {
1596
+ httpCode: 500,
1597
+ code: 'PRESET.CATEGORY_DELETE_ERROR',
1598
+ message: 'Не удалось удалить категорию пресетов',
1599
+ },
1600
+ FAVORITE_ERROR: {
1601
+ httpCode: 500,
1602
+ code: 'PRESET.FAVORITE_ERROR',
1603
+ message: 'Не удалось обновить избранное',
1604
+ },
1605
+ PRICE_ERROR: {
1606
+ httpCode: 500,
1607
+ code: 'PRESET.PRICE_ERROR',
1608
+ message: 'Не удалось рассчитать стоимость пресета',
1609
+ },
1610
+ RUN_ERROR: {
1611
+ httpCode: 500,
1612
+ code: 'PRESET.RUN_ERROR',
1613
+ message: 'Не удалось запустить пресет',
1614
+ },
1615
+ PREPARE_ERROR: {
1616
+ httpCode: 500,
1617
+ code: 'PRESET.PREPARE_ERROR',
1618
+ message: 'Не удалось подготовить чат по пресету',
1619
+ },
1620
+ RESULTS_ERROR: {
1621
+ httpCode: 500,
1622
+ code: 'PRESET.RESULTS_ERROR',
1623
+ message: 'Не удалось получить результаты по пресету',
1624
+ },
1625
+ },
1419
1626
  ANTIFRAUD: {
1420
1627
  CHECK_NOT_FOUND: {
1421
1628
  httpCode: 404,
@@ -3,6 +3,7 @@ import { defineContract, defineCursorPaginationQuery, HTTP_METHODS, HttpErrorRes
3
3
  import { GenerationTypeSchema } from '../../../generation-model';
4
4
  import { GenerationJobResponseSchema } from '../../models';
5
5
  import { GENERATION_JOB_ROUTES } from '../generation-job';
6
+ import { PresetFilterQuerySchema } from '../../../preset/models/preset-tag.schema';
6
7
 
7
8
  export const GetGenerationJobHistoryQueryQuery = defineCursorPaginationQuery(z.uuid()).extend({
8
9
  generationType: GenerationTypeSchema.optional(),
@@ -10,6 +11,7 @@ export const GetGenerationJobHistoryQueryQuery = defineCursorPaginationQuery(z.u
10
11
  prompt: z.string().min(1).optional(),
11
12
  dateFrom: z.coerce.date().optional(),
12
13
  dateTo: z.coerce.date().optional(),
14
+ presetFilter: PresetFilterQuerySchema,
13
15
  });
14
16
 
15
17
  export const GenerationJobHistoryItemSchema = GenerationJobResponseSchema.extend({
@@ -3,9 +3,11 @@ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../
3
3
  import { GenerationTypeSchema } from '../../../generation-model';
4
4
  import { GenerationJobResponseSchema } from '../../models';
5
5
  import { GENERATION_JOB_ROUTES } from '../generation-job';
6
+ import { PresetFilterQuerySchema } from '../../../preset/models/preset-tag.schema';
6
7
 
7
8
  export const GetGenerationJobsQueryQuery = z.object({
8
9
  generationType: GenerationTypeSchema.optional(),
10
+ presetFilter: PresetFilterQuerySchema,
9
11
  });
10
12
 
11
13
  export const GetGenerationJobsQueryResponse = z.object({
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { GenerationTypeSchema } from '../../generation-model';
3
+ import { PresetTagSchema } from '../../preset/models/preset-tag.schema';
3
4
  import { GENERATION_JOB_STATUS } from '../enums';
4
5
  import { GenerationJobAttachmentFileSchema } from './generation-job-attachment-file.schema';
5
6
 
@@ -19,6 +20,7 @@ export const GenerationJobOutputSchema = z.object({
19
20
  export const GenerationJobResponseSchema = z.object({
20
21
  uuid: z.uuid(),
21
22
  jobChatId: z.uuid().nullable(),
23
+ preset: PresetTagSchema.nullable(),
22
24
  modelId: z.uuid(),
23
25
  generationType: GenerationTypeSchema,
24
26
  status: GenerationJobStatusSchema,
@@ -1,3 +1,4 @@
1
1
  export * from './generation-job-attachment-file.schema';
2
2
  export * from './generation-job-response.schema';
3
3
  export * from './suno-params.schema';
4
+ export * from './seedance-2_5-params.schema';
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+
3
+ export const SEEDANCE_2_5_TASK_TYPE = {
4
+ AUTO: 'auto',
5
+ REFERENCE: 'reference',
6
+ EDIT: 'edit',
7
+ EXTEND: 'extend',
8
+ } as const;
9
+
10
+ export const Seedance25TaskTypeSchema = z.enum([
11
+ SEEDANCE_2_5_TASK_TYPE.AUTO,
12
+ SEEDANCE_2_5_TASK_TYPE.REFERENCE,
13
+ SEEDANCE_2_5_TASK_TYPE.EDIT,
14
+ SEEDANCE_2_5_TASK_TYPE.EXTEND,
15
+ ]);
16
+ export type Seedance25TaskType = z.infer<typeof Seedance25TaskTypeSchema>;
17
+
18
+ export const Seedance25ParamsSchema = z.object({
19
+ prompt: z.string().min(3).max(30000),
20
+ aspect_ratio: z.enum(['adaptive', '1:1', '16:9', '21:9', '3:4', '4:3', '9:16']).default('16:9'),
21
+ resolution: z.enum(['480p', '720p', '1080p']).default('720p'),
22
+ duration: z.number().min(4).max(30).default(5),
23
+ generate_audio: z.boolean().default(false),
24
+ output_format: z.enum(['mov', 'mp4']).default('mp4'),
25
+ return_last_frame: z.boolean().default(false),
26
+ omni_reference_task_type: Seedance25TaskTypeSchema.optional(),
27
+ first_frame_url: z.string().optional(),
28
+ last_frame_url: z.string().optional(),
29
+ reference_image_urls: z.array(z.string()).optional(),
30
+ reference_video_urls: z.array(z.string()).optional(),
31
+ });
32
+ export type Seedance25Params = z.infer<typeof Seedance25ParamsSchema>;
@@ -3,9 +3,11 @@ import { defineContract, defineCursorPaginationQuery, HTTP_METHODS, HttpErrorRes
3
3
  import { GenerationTypeSchema } from '../../../generation-model';
4
4
  import { GenerationJobChatResponseSchema } from '../../models';
5
5
  import { GENERATION_JOB_CHAT_ROUTES } from '../generation-job-chat';
6
+ import { PresetFilterQuerySchema } from '../../../preset/models/preset-tag.schema';
6
7
 
7
8
  export const GetGenerationJobChatsQueryQuery = defineCursorPaginationQuery(z.uuid()).extend({
8
9
  type: GenerationTypeSchema.optional(),
10
+ presetFilter: PresetFilterQuerySchema,
9
11
  });
10
12
 
11
13
  export const GetGenerationJobChatsQueryResponse = z.object({
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { GenerationTypeSchema } from '../../generation-model';
3
+ import { PresetTagSchema } from '../../preset/models/preset-tag.schema';
3
4
 
4
5
  export const GenerationJobChatResponseSchema = z.object({
5
6
  uuid: z.uuid(),
@@ -7,6 +8,7 @@ export const GenerationJobChatResponseSchema = z.object({
7
8
  type: GenerationTypeSchema,
8
9
  modelId: z.uuid().nullable(),
9
10
  trendId: z.uuid().nullable(),
11
+ preset: PresetTagSchema.nullable(),
10
12
  icon: z.url().nullable(),
11
13
  createdAt: z.iso.datetime(),
12
14
  updatedAt: z.iso.datetime(),
package/index.ts CHANGED
@@ -25,3 +25,4 @@ export * from './trend';
25
25
  export * from './support';
26
26
  export * from './user-context';
27
27
  export * from './organization';
28
+ export * from './preset';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-grator/api",
3
- "version": "0.3.77",
3
+ "version": "0.3.79",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema, HttpSuccessResponseSchema } from '../../../_common';
3
+ import { PRESET_ROUTES } from '../preset';
4
+ import { PresetSlugParams } from '../queries/get-public-preset-by-slug.query';
5
+
6
+ export const AddPresetFavoriteCommandParams = PresetSlugParams;
7
+
8
+ export const AddPresetFavoriteCommandResponse = HttpSuccessResponseSchema;
9
+
10
+ export const AddPresetFavoriteCommand = defineContract({
11
+ method: HTTP_METHODS.PUT,
12
+ path: PRESET_ROUTES.ADD_FAVORITE(':slug'),
13
+ summary: 'Add preset to favorites of the current user; idempotent',
14
+ request: {
15
+ params: AddPresetFavoriteCommandParams,
16
+ },
17
+ responses: {
18
+ 200: AddPresetFavoriteCommandResponse,
19
+ 401: HttpErrorResponseSchema,
20
+ 404: HttpErrorResponseSchema,
21
+ 500: HttpErrorResponseSchema,
22
+ },
23
+ });
24
+
25
+ export type AddPresetFavoriteCommandParamsType = z.infer<typeof AddPresetFavoriteCommandParams>;
26
+ export type AddPresetFavoriteCommandResponseType = z.infer<typeof AddPresetFavoriteCommandResponse>;
@@ -0,0 +1,4 @@
1
+ export * from './run-preset.command';
2
+ export * from './prepare-preset.command';
3
+ export * from './add-preset-favorite.command';
4
+ export * from './remove-preset-favorite.command';
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { GenerationJobChatResponseSchema } from '../../../generation-job-chat/models/generation-job-chat-response.schema';
4
+ import { PRESET_TOOL } from '../../enums';
5
+ import { PresetModelParamsSchema } from '../../models';
6
+ import { PRESET_ROUTES } from '../preset';
7
+ import { PresetSlugParams } from '../queries/get-public-preset-by-slug.query';
8
+ import { PresetFieldValuesBody, PresetTextChatLaunchSchema } from './run-preset.command';
9
+
10
+ const PresetGenerationDraftSchema = z.object({
11
+ chat: GenerationJobChatResponseSchema,
12
+ modelId: z.uuid(),
13
+ prompt: z.string().min(1),
14
+ params: PresetModelParamsSchema,
15
+ attachments: z.record(z.string(), z.array(z.uuid())),
16
+ });
17
+
18
+ export const PreparePresetCommandParams = PresetSlugParams;
19
+
20
+ export const PreparePresetCommandBody = PresetFieldValuesBody;
21
+
22
+ export const PreparePresetCommandResponse = z.discriminatedUnion('tool', [
23
+ PresetGenerationDraftSchema.extend({ tool: z.literal(PRESET_TOOL.IMAGE) }),
24
+ PresetGenerationDraftSchema.extend({ tool: z.literal(PRESET_TOOL.VIDEO) }),
25
+ PresetTextChatLaunchSchema,
26
+ ]);
27
+
28
+ export const PreparePresetCommand = defineContract({
29
+ method: HTTP_METHODS.POST,
30
+ path: PRESET_ROUTES.PREPARE(':slug'),
31
+ summary: 'Create a tagged chat of the preset tool and return assembled prompt, model and params without running',
32
+ request: {
33
+ params: PreparePresetCommandParams,
34
+ body: PreparePresetCommandBody,
35
+ },
36
+ responses: {
37
+ 201: PreparePresetCommandResponse,
38
+ 400: HttpErrorResponseSchema,
39
+ 401: HttpErrorResponseSchema,
40
+ 404: HttpErrorResponseSchema,
41
+ 500: HttpErrorResponseSchema,
42
+ },
43
+ });
44
+
45
+ export type PreparePresetCommandParamsType = z.infer<typeof PreparePresetCommandParams>;
46
+ export type PreparePresetCommandBodyType = z.infer<typeof PreparePresetCommandBody>;
47
+ export type PreparePresetCommandResponseType = z.infer<typeof PreparePresetCommandResponse>;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema, HttpSuccessResponseSchema } from '../../../_common';
3
+ import { PRESET_ROUTES } from '../preset';
4
+ import { PresetSlugParams } from '../queries/get-public-preset-by-slug.query';
5
+
6
+ export const RemovePresetFavoriteCommandParams = PresetSlugParams;
7
+
8
+ export const RemovePresetFavoriteCommandResponse = HttpSuccessResponseSchema;
9
+
10
+ export const RemovePresetFavoriteCommand = defineContract({
11
+ method: HTTP_METHODS.DELETE,
12
+ path: PRESET_ROUTES.REMOVE_FAVORITE(':slug'),
13
+ summary: 'Remove preset from favorites of the current user; idempotent',
14
+ request: {
15
+ params: RemovePresetFavoriteCommandParams,
16
+ },
17
+ responses: {
18
+ 200: RemovePresetFavoriteCommandResponse,
19
+ 401: HttpErrorResponseSchema,
20
+ 404: HttpErrorResponseSchema,
21
+ 500: HttpErrorResponseSchema,
22
+ },
23
+ });
24
+
25
+ export type RemovePresetFavoriteCommandParamsType = z.infer<typeof RemovePresetFavoriteCommandParams>;
26
+ export type RemovePresetFavoriteCommandResponseType = z.infer<typeof RemovePresetFavoriteCommandResponse>;
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { ChatResponseSchema } from '../../../chat/models/chat-response.schema';
4
+ import { GenerationJobResponseSchema } from '../../../generation-job/models/generation-job-response.schema';
5
+ import { GenerationJobChatResponseSchema } from '../../../generation-job-chat/models/generation-job-chat-response.schema';
6
+ import { PRESET_TOOL } from '../../enums';
7
+ import { PresetChatOptionsSchema, PresetFieldValuesSchema } from '../../models';
8
+ import { PRESET_ROUTES } from '../preset';
9
+ import { PresetSlugParams } from '../queries/get-public-preset-by-slug.query';
10
+
11
+ export const PresetFieldValuesBody = z.object({
12
+ values: PresetFieldValuesSchema,
13
+ });
14
+
15
+ export const PresetTextChatLaunchSchema = z.object({
16
+ tool: z.literal(PRESET_TOOL.TEXT),
17
+ chat: ChatResponseSchema,
18
+ aiModelId: z.uuid(),
19
+ prompt: z.string().min(1),
20
+ fileIds: z.array(z.uuid()),
21
+ options: PresetChatOptionsSchema,
22
+ });
23
+
24
+ export const RunPresetCommandParams = PresetSlugParams;
25
+
26
+ export const RunPresetCommandBody = PresetFieldValuesBody;
27
+
28
+ export const RunPresetCommandResponse = z.discriminatedUnion('tool', [
29
+ z.object({
30
+ tool: z.literal(PRESET_TOOL.IMAGE),
31
+ chat: GenerationJobChatResponseSchema,
32
+ job: GenerationJobResponseSchema,
33
+ }),
34
+ z.object({
35
+ tool: z.literal(PRESET_TOOL.VIDEO),
36
+ chat: GenerationJobChatResponseSchema,
37
+ job: GenerationJobResponseSchema,
38
+ }),
39
+ PresetTextChatLaunchSchema,
40
+ ]);
41
+
42
+ export const RunPresetCommand = defineContract({
43
+ method: HTTP_METHODS.POST,
44
+ path: PRESET_ROUTES.RUN(':slug'),
45
+ summary:
46
+ 'Run preset: image/video creates a tagged generation chat and starts generation; text creates a tagged LLM chat and returns the prompt to send',
47
+ request: {
48
+ params: RunPresetCommandParams,
49
+ body: RunPresetCommandBody,
50
+ },
51
+ responses: {
52
+ 201: RunPresetCommandResponse,
53
+ 400: HttpErrorResponseSchema,
54
+ 401: HttpErrorResponseSchema,
55
+ 402: HttpErrorResponseSchema,
56
+ 404: HttpErrorResponseSchema,
57
+ 500: HttpErrorResponseSchema,
58
+ },
59
+ });
60
+
61
+ export type PresetFieldValuesBodyType = z.infer<typeof PresetFieldValuesBody>;
62
+ export type PresetTextChatLaunchSchemaType = z.infer<typeof PresetTextChatLaunchSchema>;
63
+ export type RunPresetCommandParamsType = z.infer<typeof RunPresetCommandParams>;
64
+ export type RunPresetCommandBodyType = z.infer<typeof RunPresetCommandBody>;
65
+ export type RunPresetCommandResponseType = z.infer<typeof RunPresetCommandResponse>;
@@ -0,0 +1,3 @@
1
+ export * from './preset';
2
+ export * from './commands';
3
+ export * from './queries';
@@ -0,0 +1,18 @@
1
+ export const PRESET_CONTROLLER = 'presets' as const;
2
+
3
+ export const PRESET_ROUTES = {
4
+ LIST: '',
5
+ GET_BY_SLUG: (slug: string) => `${slug}`,
6
+ GET_PRICE: (slug: string) => `${slug}/price`,
7
+ RUN: (slug: string) => `${slug}/run`,
8
+ PREPARE: (slug: string) => `${slug}/prepare`,
9
+ GET_RESULTS: (slug: string) => `${slug}/results`,
10
+ ADD_FAVORITE: (slug: string) => `${slug}/favorite`,
11
+ REMOVE_FAVORITE: (slug: string) => `${slug}/favorite`,
12
+ } as const;
13
+
14
+ export const PRESET_CATEGORY_CONTROLLER = 'preset-categories' as const;
15
+
16
+ export const PRESET_CATEGORY_ROUTES = {
17
+ LIST: '',
18
+ } as const;
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { PresetFieldValuesSchema } from '../../models';
4
+ import { PRESET_ROUTES } from '../preset';
5
+ import { PresetSlugParams } from './get-public-preset-by-slug.query';
6
+
7
+ export const GetPresetPriceQueryParams = PresetSlugParams;
8
+
9
+ export const GetPresetPriceQueryBody = z.object({
10
+ values: PresetFieldValuesSchema.default([]),
11
+ });
12
+
13
+ export const GetPresetPriceQueryResponse = z.object({
14
+ totalCost: z.number().nonnegative(),
15
+ });
16
+
17
+ export const GetPresetPriceQuery = defineContract({
18
+ method: HTTP_METHODS.POST,
19
+ path: PRESET_ROUTES.GET_PRICE(':slug'),
20
+ summary: 'Calculate preset price by model price with fixed params and params of selected options',
21
+ request: {
22
+ params: GetPresetPriceQueryParams,
23
+ body: GetPresetPriceQueryBody,
24
+ },
25
+ responses: {
26
+ 200: GetPresetPriceQueryResponse,
27
+ 400: HttpErrorResponseSchema,
28
+ 404: HttpErrorResponseSchema,
29
+ 500: HttpErrorResponseSchema,
30
+ },
31
+ });
32
+
33
+ export type GetPresetPriceQueryParamsType = z.infer<typeof GetPresetPriceQueryParams>;
34
+ export type GetPresetPriceQueryBodyType = z.infer<typeof GetPresetPriceQueryBody>;
35
+ export type GetPresetPriceQueryResponseType = z.infer<typeof GetPresetPriceQueryResponse>;
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
3
+ import { PRESET_RESULTS_DEFAULT_LIMIT, PRESET_RESULTS_MAX_LIMIT } from '../../enums';
4
+ import { PresetResultItemSchema } from '../../models';
5
+ import { PRESET_ROUTES } from '../preset';
6
+ import { PresetSlugParams } from './get-public-preset-by-slug.query';
7
+
8
+ export const GetPresetResultsQueryParams = PresetSlugParams;
9
+
10
+ export const GetPresetResultsQueryQuery = z.object({
11
+ limit: z.coerce.number().int().min(1).max(PRESET_RESULTS_MAX_LIMIT).default(PRESET_RESULTS_DEFAULT_LIMIT),
12
+ });
13
+
14
+ export const GetPresetResultsQueryResponse = z.object({
15
+ total: z.number().int().nonnegative(),
16
+ items: z.array(PresetResultItemSchema),
17
+ });
18
+
19
+ export const GetPresetResultsQuery = defineContract({
20
+ method: HTTP_METHODS.GET,
21
+ path: PRESET_ROUTES.GET_RESULTS(':slug'),
22
+ summary: 'Count and latest results of the current user made through the preset',
23
+ request: {
24
+ params: GetPresetResultsQueryParams,
25
+ query: GetPresetResultsQueryQuery,
26
+ },
27
+ responses: {
28
+ 200: GetPresetResultsQueryResponse,
29
+ 401: HttpErrorResponseSchema,
30
+ 404: HttpErrorResponseSchema,
31
+ 500: HttpErrorResponseSchema,
32
+ },
33
+ });
34
+
35
+ export type GetPresetResultsQueryParamsType = z.infer<typeof GetPresetResultsQueryParams>;
36
+ export type GetPresetResultsQueryQueryType = z.infer<typeof GetPresetResultsQueryQuery>;
37
+ export type GetPresetResultsQueryResponseType = z.infer<typeof GetPresetResultsQueryResponse>;