feat: enhance parseAllChapters API to support force parsing and update Audiobook component for AI mode handling

This commit is contained in:
2026-03-15 01:12:33 +08:00
parent c8dd762aad
commit 1193d63e68
4 changed files with 85 additions and 7 deletions

View File

@@ -249,9 +249,12 @@ export const audiobookApi = {
await apiClient.post(`/audiobook/projects/${projectId}/characters/${charId}/regenerate-preview`)
},
parseAllChapters: async (projectId: number, onlyErrors?: boolean): Promise<void> => {
const params = onlyErrors ? '?only_errors=true' : ''
await apiClient.post(`/audiobook/projects/${projectId}/parse-all${params}`)
parseAllChapters: async (projectId: number, onlyErrors?: boolean, force?: boolean): Promise<void> => {
const params = new URLSearchParams()
if (onlyErrors) params.set('only_errors', 'true')
if (force) params.set('force', 'true')
const qs = params.toString() ? `?${params.toString()}` : ''
await apiClient.post(`/audiobook/projects/${projectId}/parse-all${qs}`)
},
processAll: async (projectId: number): Promise<void> => {

View File

@@ -2085,7 +2085,8 @@ export default function Audiobook() {
setLoadingAction(true)
setIsPolling(true)
try {
await audiobookApi.parseAllChapters(selectedProject.id)
const isAI = selectedProject.source_type === 'ai_generated'
await audiobookApi.parseAllChapters(selectedProject.id, false, isAI)
toast.success(t('projectCard.chapters.parseAllStarted'))
fetchProjects()
fetchDetail()