feat(edit): AI套图生成、图片切七牛
This commit is contained in:
@@ -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)),
|
||||
};
|
||||
Reference in New Issue
Block a user