feat(edit): AI套图生成、图片切七牛

This commit is contained in:
2026-10-04 20:47:47 +08:00
parent 696112e74d
commit e20cd7547f
60 changed files with 6241 additions and 312 deletions
+20
View File
@@ -0,0 +1,20 @@
import type { CreateImageSuiteRequest, ImageSuite, ImageSuitePlanInput } from '@atlas/contracts';
import { api } from './api';
const path = (productId: string) => `/products/${productId}/ai/image-suites`;
const headers = (key: string) => ({ headers: { 'Idempotency-Key': key } });
export const imageSuitesApi = {
plan: (productId: string, input: ImageSuitePlanInput, key: string) =>
api.post<ImageSuite>(`/products/${productId}/ai/suite-plans`, input, headers(key)),
generate: (productId: string, input: CreateImageSuiteRequest, key: string) =>
api.post<ImageSuite>(path(productId), input, headers(key)),
read: (productId: string, id: string) => api.get<ImageSuite>(`${path(productId)}/${id}`),
list: (productId: string, cursor?: string) =>
api.getList<ImageSuite, { next_cursor: string | null; has_more: boolean }>(
`${path(productId)}?limit=100${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''}`
),
cancel: (productId: string, id: string) =>
api.post<ImageSuite>(`${path(productId)}/${id}/cancel`, {}, headers(crypto.randomUUID())),
retry: (productId: string, id: string, key: string) =>
api.post<ImageSuite>(`${path(productId)}/${id}/retry`, {}, headers(key)),
};