feat(core): standalone image-gen endpoint + api.ts methods (profile/password/avatar/generate-image)

- POST /api/ai/generate-image/ — project-less image generation (AITask.project nullable, no schema change),
  reuses VolcanoArk image_generation + credit reserve/charge; modes image/model/cover.
  Verified: manage.py check clean; 2 active IMAGE models present (doubao-seedream-4.5/5.0).
  (Real generation calls Volcano API + charges credit — not yet live-tested to avoid spend.)
- api.ts: updateProfile / changePassword / uploadAvatar / generateImage

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
seaislee1209
2026-06-05 15:51:36 +08:00
co-authored by Claude Opus 4.8
parent aad9bd683b
commit a8f4608d10
4 changed files with 115 additions and 3 deletions
+12
View File
@@ -66,6 +66,15 @@ export const api = {
me() {
return request<{ user: User; team: Team }>("/api/auth/me/");
},
updateProfile(payload: { name?: string; phone?: string; email?: string }) {
return request<{ user: User; team: Team }>("/api/auth/me/", { method: "PATCH", body: JSON.stringify(payload) });
},
changePassword(payload: { old_password: string; new_password: string }) {
return request<{ token: string }>("/api/auth/me/password/", { method: "POST", body: JSON.stringify(payload) });
},
uploadAvatar(formData: FormData) {
return request<User>("/api/auth/me/avatar/", { method: "POST", body: formData });
},
logout() {
return request<void>("/api/auth/logout/", { method: "POST" });
},
@@ -183,6 +192,9 @@ export const api = {
aiTasks() {
return request<Paginated<AITask>>("/api/ai/tasks/");
},
generateImage(payload: { prompt: string; mode?: "image" | "model" | "cover"; count?: number }) {
return request<{ assets: Asset[] }>("/api/ai/generate-image/", { method: "POST", body: JSON.stringify(payload) });
},
recharge(payload: { amount: number | string; bonus?: number | string; channel?: string }) {
return request<RechargeResult>("/api/billing/recharge/", { method: "POST", body: JSON.stringify(payload) });
},