feat(audiobook): implement chapter management with CRUD operations and enhance project detail responses

This commit is contained in:
2026-03-10 16:42:32 +08:00
parent 01b6f4633e
commit 3c30afc476
8 changed files with 393 additions and 156 deletions

View File

@@ -21,9 +21,18 @@ export interface AudiobookCharacter {
voice_design_id?: number
}
export interface AudiobookChapter {
id: number
project_id: number
chapter_index: number
title?: string
status: string
error_message?: string
}
export interface AudiobookProjectDetail extends AudiobookProject {
characters: AudiobookCharacter[]
chapter_count: number
chapters: AudiobookChapter[]
}
export interface AudiobookSegment {
@@ -96,6 +105,15 @@ export const audiobookApi = {
await apiClient.post(`/audiobook/projects/${id}/confirm`)
},
listChapters: async (id: number): Promise<AudiobookChapter[]> => {
const response = await apiClient.get<AudiobookChapter[]>(`/audiobook/projects/${id}/chapters`)
return response.data
},
parseChapter: async (projectId: number, chapterId: number): Promise<void> => {
await apiClient.post(`/audiobook/projects/${projectId}/chapters/${chapterId}/parse`)
},
generate: async (id: number, chapterIndex?: number): Promise<void> => {
await apiClient.post(`/audiobook/projects/${id}/generate`, {
chapter_index: chapterIndex ?? null,