feat: 新增前端 API 客户端
- 新增 edit.ts: 图片编辑 API 客户端 - 新增 health.ts: 健康检查 API 客户端
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { post } from './client'
|
||||
|
||||
export interface EditImageRequest {
|
||||
image: string // base64 编码
|
||||
prompt: string
|
||||
count?: number
|
||||
}
|
||||
|
||||
export interface EditAssetResponse {
|
||||
data: string // base64 编码
|
||||
format: string
|
||||
}
|
||||
|
||||
export interface EditImageResponse {
|
||||
assets: EditAssetResponse[]
|
||||
}
|
||||
|
||||
export async function editImage(
|
||||
req: EditImageRequest,
|
||||
): Promise<EditImageResponse> {
|
||||
return post<EditImageResponse>('/api/v1/images/edit', req)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { get } from './client'
|
||||
|
||||
export interface HealthResponse {
|
||||
status: string
|
||||
}
|
||||
|
||||
export async function getHealth(): Promise<HealthResponse> {
|
||||
return get<HealthResponse>('/api/v1/health')
|
||||
}
|
||||
Reference in New Issue
Block a user