feat(audiobook): remove turbo mode from ProjectCard and simplify analyze button

This commit is contained in:
2026-03-10 19:13:37 +08:00
parent 4785ca4b36
commit addb152ce1

View File

@@ -336,7 +336,6 @@ function ProjectCard({ project, onRefresh }: { project: AudiobookProject; onRefr
const [editingCharId, setEditingCharId] = useState<number | null>(null) const [editingCharId, setEditingCharId] = useState<number | null>(null)
const [editFields, setEditFields] = useState({ name: '', description: '', instruct: '' }) const [editFields, setEditFields] = useState({ name: '', description: '', instruct: '' })
const [sequentialPlayingId, setSequentialPlayingId] = useState<number | null>(null) const [sequentialPlayingId, setSequentialPlayingId] = useState<number | null>(null)
const [turbo, setTurbo] = useState(false)
const [charsCollapsed, setCharsCollapsed] = useState(false) const [charsCollapsed, setCharsCollapsed] = useState(false)
const [chaptersCollapsed, setChaptersCollapsed] = useState(false) const [chaptersCollapsed, setChaptersCollapsed] = useState(false)
const [expandedChapters, setExpandedChapters] = useState<Set<number>>(new Set()) const [expandedChapters, setExpandedChapters] = useState<Set<number>>(new Set())
@@ -412,8 +411,8 @@ function ProjectCard({ project, onRefresh }: { project: AudiobookProject; onRefr
setLoadingAction(true) setLoadingAction(true)
setIsPolling(true) setIsPolling(true)
try { try {
await audiobookApi.analyze(project.id, { turbo }) await audiobookApi.analyze(project.id, {})
toast.success(turbo ? '分析已开始(极速模式)' : '分析已开始') toast.success('分析已开始')
onRefresh() onRefresh()
} catch (e: any) { } catch (e: any) {
setIsPolling(false) setIsPolling(false)
@@ -586,16 +585,6 @@ function ProjectCard({ project, onRefresh }: { project: AudiobookProject; onRefr
<div className="flex items-center justify-between gap-2 pt-1 border-t"> <div className="flex items-center justify-between gap-2 pt-1 border-t">
<div className="flex items-center gap-1 flex-wrap"> <div className="flex items-center gap-1 flex-wrap">
{!isActive && ( {!isActive && (
<>
<label className="flex items-center gap-1 text-xs text-muted-foreground cursor-pointer select-none">
<input
type="checkbox"
className="h-3 w-3"
checked={turbo}
onChange={e => setTurbo(e.target.checked)}
/>
</label>
<Button <Button
size="sm" size="sm"
variant={status === 'pending' ? 'default' : 'outline'} variant={status === 'pending' ? 'default' : 'outline'}
@@ -605,7 +594,6 @@ function ProjectCard({ project, onRefresh }: { project: AudiobookProject; onRefr
> >
{status === 'pending' ? '分析' : '重新分析'} {status === 'pending' ? '分析' : '重新分析'}
</Button> </Button>
</>
)} )}
{status === 'ready' && ( {status === 'ready' && (
<Button size="sm" className="h-7 text-xs px-2" onClick={() => handleGenerate()} disabled={loadingAction}> <Button size="sm" className="h-7 text-xs px-2" onClick={() => handleGenerate()} disabled={loadingAction}>
@@ -634,34 +622,31 @@ function ProjectCard({ project, onRefresh }: { project: AudiobookProject; onRefr
{charsCollapsed ? <ChevronDown className="h-3 w-3" /> : <ChevronUp className="h-3 w-3" />} {charsCollapsed ? <ChevronDown className="h-3 w-3" /> : <ChevronUp className="h-3 w-3" />}
{detail.characters.length} {detail.characters.length}
</button> </button>
{!charsCollapsed && <div className="space-y-1.5 max-h-72 overflow-y-auto pr-1"> {!charsCollapsed && <div className={`space-y-1.5 pr-1 ${editingCharId ? '' : 'max-h-72 overflow-y-auto'}`}>
{detail.characters.map(char => ( {detail.characters.map(char => (
<div key={char.id} className="border rounded px-3 py-2"> <div key={char.id} className="border rounded px-3 py-2">
{editingCharId === char.id ? ( {editingCharId === char.id ? (
<div className="space-y-2"> <div className="space-y-2">
<Input <Input
className="h-7 text-sm"
value={editFields.name} value={editFields.name}
onChange={e => setEditFields(f => ({ ...f, name: e.target.value }))} onChange={e => setEditFields(f => ({ ...f, name: e.target.value }))}
placeholder="角色名" placeholder="角色名"
/> />
<Input <Input
className="h-7 text-sm"
value={editFields.instruct} value={editFields.instruct}
onChange={e => setEditFields(f => ({ ...f, instruct: e.target.value }))} onChange={e => setEditFields(f => ({ ...f, instruct: e.target.value }))}
placeholder="音色描述(用于 TTS" placeholder="音色描述(用于 TTS"
/> />
<Input <Input
className="h-7 text-sm"
value={editFields.description} value={editFields.description}
onChange={e => setEditFields(f => ({ ...f, description: e.target.value }))} onChange={e => setEditFields(f => ({ ...f, description: e.target.value }))}
placeholder="角色描述" placeholder="角色描述"
/> />
<div className="flex gap-1"> <div className="flex gap-2">
<Button size="sm" className="h-6 text-xs px-2" onClick={() => saveEditChar(char)}> <Button size="sm" onClick={() => saveEditChar(char)}>
<Check className="h-3 w-3 mr-1" /> <Check className="h-3 w-3 mr-1" />
</Button> </Button>
<Button size="sm" variant="ghost" className="h-6 text-xs px-2" onClick={() => setEditingCharId(null)}> <Button size="sm" variant="ghost" onClick={() => setEditingCharId(null)}>
<X className="h-3 w-3 mr-1" /> <X className="h-3 w-3 mr-1" />
</Button> </Button>
</div> </div>