This commit is contained in:
sjy
2026-07-03 18:07:58 +08:00
parent fca85b0157
commit c99f0f8c8f
8 changed files with 623 additions and 180 deletions
+14
View File
@@ -113,6 +113,20 @@ export async function optimizePrompt(
image_px: params.image_px || null,
});
}
export async function uploadAudio(file: File): Promise<{ url: string; filename: string }> {
const form = new FormData();
form.append('file', file);
const token = localStorage.getItem('auth_token');
const res = await fetch(`${import.meta.env.VITE_API_BASE || 'http://localhost:8000'}/api/generation-records/upload-audio`, {
method: 'POST',
headers: token ? { Authorization: `Bearer ${token}` } : {},
body: form,
});
if (!res.ok) throw new Error('图片上传失败');
const data = await res.json();
return { url: data.url, filename: data.filename };
}
export async function uploadImage(file: File): Promise<{ url: string; filename: string }> {
const form = new FormData();
form.append('file', file);