0.10.0 Audbile Prototype

This commit is contained in:
2026-03-14 13:35:23 +00:00
parent 5d79a34905
commit e56cff43a9
22 changed files with 1667 additions and 148 deletions

View File

@@ -78,11 +78,13 @@ function afterMutationInvalidate(prefixes = []) {
}
async function request(path, options = {}) {
const isFormDataBody = typeof FormData !== 'undefined' && options?.body instanceof FormData;
const mergedHeaders = {
...(isFormDataBody ? {} : { 'Content-Type': 'application/json' }),
...(options.headers || {})
};
const response = await fetch(`${API_BASE}${path}`, {
headers: {
'Content-Type': 'application/json',
...(options.headers || {})
},
headers: mergedHeaders,
...options
});
@@ -301,6 +303,24 @@ export const api = {
afterMutationInvalidate(['/history', '/pipeline/queue']);
return result;
},
async uploadAudiobook(file, payload = {}) {
const formData = new FormData();
if (file) {
formData.append('file', file);
}
if (payload?.format) {
formData.append('format', String(payload.format));
}
if (payload?.startImmediately !== undefined) {
formData.append('startImmediately', String(payload.startImmediately));
}
const result = await request('/pipeline/audiobook/upload', {
method: 'POST',
body: formData
});
afterMutationInvalidate(['/history', '/pipeline/queue']);
return result;
},
async selectMetadata(payload) {
const result = await request('/pipeline/select-metadata', {
method: 'POST',