mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 00:55:14 -07:00
formatting
This commit is contained in:
@@ -33,11 +33,14 @@ export function useExportGeneration() {
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async ({ generationId, text }: { generationId: string; text: string }) => {
|
mutationFn: async ({ generationId, text }: { generationId: string; text: string }) => {
|
||||||
const blob = await apiClient.exportGeneration(generationId);
|
const blob = await apiClient.exportGeneration(generationId);
|
||||||
|
|
||||||
// Create safe filename from text
|
// Create safe filename from text
|
||||||
const safeText = text.substring(0, 30).replace(/[^a-z0-9]/gi, '-').toLowerCase();
|
const safeText = text
|
||||||
|
.substring(0, 30)
|
||||||
|
.replace(/[^a-z0-9]/gi, '-')
|
||||||
|
.toLowerCase();
|
||||||
const filename = `generation-${safeText}.voicebox.zip`;
|
const filename = `generation-${safeText}.voicebox.zip`;
|
||||||
|
|
||||||
if (isTauri()) {
|
if (isTauri()) {
|
||||||
// Use Tauri's native save dialog
|
// Use Tauri's native save dialog
|
||||||
try {
|
try {
|
||||||
@@ -51,7 +54,7 @@ export function useExportGeneration() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
// Write file using Tauri's filesystem API
|
// Write file using Tauri's filesystem API
|
||||||
const { writeBinaryFile } = await import('@tauri-apps/plugin-fs');
|
const { writeBinaryFile } = await import('@tauri-apps/plugin-fs');
|
||||||
@@ -81,7 +84,7 @@ export function useExportGeneration() {
|
|||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
return blob;
|
return blob;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -91,11 +94,14 @@ export function useExportGenerationAudio() {
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async ({ generationId, text }: { generationId: string; text: string }) => {
|
mutationFn: async ({ generationId, text }: { generationId: string; text: string }) => {
|
||||||
const blob = await apiClient.exportGenerationAudio(generationId);
|
const blob = await apiClient.exportGenerationAudio(generationId);
|
||||||
|
|
||||||
// Create safe filename from text
|
// Create safe filename from text
|
||||||
const safeText = text.substring(0, 30).replace(/[^a-z0-9]/gi, '-').toLowerCase();
|
const safeText = text
|
||||||
|
.substring(0, 30)
|
||||||
|
.replace(/[^a-z0-9]/gi, '-')
|
||||||
|
.toLowerCase();
|
||||||
const filename = `${safeText}.wav`;
|
const filename = `${safeText}.wav`;
|
||||||
|
|
||||||
if (isTauri()) {
|
if (isTauri()) {
|
||||||
// Use Tauri's native save dialog
|
// Use Tauri's native save dialog
|
||||||
try {
|
try {
|
||||||
@@ -109,7 +115,7 @@ export function useExportGenerationAudio() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
// Write file using Tauri's filesystem API
|
// Write file using Tauri's filesystem API
|
||||||
const { writeBinaryFile } = await import('@tauri-apps/plugin-fs');
|
const { writeBinaryFile } = await import('@tauri-apps/plugin-fs');
|
||||||
@@ -139,7 +145,7 @@ export function useExportGenerationAudio() {
|
|||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
return blob;
|
return blob;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -120,12 +120,12 @@ export function useExportProfile() {
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (profileId: string) => {
|
mutationFn: async (profileId: string) => {
|
||||||
const blob = await apiClient.exportProfile(profileId);
|
const blob = await apiClient.exportProfile(profileId);
|
||||||
|
|
||||||
// Get profile name for filename
|
// Get profile name for filename
|
||||||
const profile = await apiClient.getProfile(profileId);
|
const profile = await apiClient.getProfile(profileId);
|
||||||
const safeName = profile.name.replace(/[^a-z0-9]/gi, '-').toLowerCase();
|
const safeName = profile.name.replace(/[^a-z0-9]/gi, '-').toLowerCase();
|
||||||
const filename = `profile-${safeName}.voicebox.zip`;
|
const filename = `profile-${safeName}.voicebox.zip`;
|
||||||
|
|
||||||
if (isTauri()) {
|
if (isTauri()) {
|
||||||
// Use Tauri's native save dialog
|
// Use Tauri's native save dialog
|
||||||
try {
|
try {
|
||||||
@@ -139,7 +139,7 @@ export function useExportProfile() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
// Write file using Tauri's filesystem API
|
// Write file using Tauri's filesystem API
|
||||||
const { writeBinaryFile } = await import('@tauri-apps/plugin-fs');
|
const { writeBinaryFile } = await import('@tauri-apps/plugin-fs');
|
||||||
@@ -169,7 +169,7 @@ export function useExportProfile() {
|
|||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
return blob;
|
return blob;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user