feat: Implement segment update and regeneration features in Audiobook API and frontend

This commit is contained in:
2026-03-12 15:48:35 +08:00
parent a1ee476e0f
commit bb6ad9b0a3
13 changed files with 485 additions and 31 deletions

View File

@@ -138,6 +138,25 @@ export const audiobookApi = {
return `/audiobook/projects/${id}/download${chapterParam}`
},
updateSegment: async (
projectId: number,
segmentId: number,
data: { text: string; emo_text?: string | null; emo_alpha?: number | null }
): Promise<AudiobookSegment> => {
const response = await apiClient.put<AudiobookSegment>(
`/audiobook/projects/${projectId}/segments/${segmentId}`,
data
)
return response.data
},
regenerateSegment: async (projectId: number, segmentId: number): Promise<AudiobookSegment> => {
const response = await apiClient.post<AudiobookSegment>(
`/audiobook/projects/${projectId}/segments/${segmentId}/regenerate`
)
return response.data
},
getSegmentAudioUrl: (projectId: number, segmentId: number): string => {
return `/audiobook/projects/${projectId}/segments/${segmentId}/audio`
},