优化批量转写的显示效果

This commit is contained in:
xuncha
2026-02-06 23:11:03 +08:00
parent 63ac715792
commit c988e4accf
3 changed files with 12 additions and 6 deletions

View File

@@ -15,6 +15,7 @@ export const BatchTranscribeGlobal: React.FC = () => {
showToast, showToast,
showResult, showResult,
result, result,
sessionName,
setShowToast, setShowToast,
setShowResult setShowResult
} = useBatchTranscribeStore() } = useBatchTranscribeStore()
@@ -27,7 +28,7 @@ export const BatchTranscribeGlobal: React.FC = () => {
<div className="batch-progress-toast-header"> <div className="batch-progress-toast-header">
<div className="batch-progress-toast-title"> <div className="batch-progress-toast-title">
<Loader2 size={14} className="spin" /> <Loader2 size={14} className="spin" />
<span></span> <span>{sessionName ? `${sessionName}` : ''}</span>
</div> </div>
<button className="batch-progress-toast-close" onClick={() => setShowToast(false)} title="最小化"> <button className="batch-progress-toast-close" onClick={() => setShowToast(false)} title="最小化">
<X size={14} /> <X size={14} />

View File

@@ -1277,7 +1277,7 @@ function ChatPage(_props: ChatPageProps) {
const session = sessions.find(s => s.username === currentSessionId) const session = sessions.find(s => s.username === currentSessionId)
if (!session) return if (!session) return
startTranscribe(voiceMessages.length) startTranscribe(voiceMessages.length, session.displayName || session.username)
// 检查模型状态 // 检查模型状态
const modelStatus = await window.electronAPI.whisper.getModelStatus() const modelStatus = await window.electronAPI.whisper.getModelStatus()

View File

@@ -11,9 +11,11 @@ export interface BatchTranscribeState {
showResult: boolean showResult: boolean
/** 转写结果 */ /** 转写结果 */
result: { success: number; fail: number } result: { success: number; fail: number }
/** 当前转写的会话名 */
sessionName: string
// Actions // Actions
startTranscribe: (total: number) => void startTranscribe: (total: number, sessionName: string) => void
updateProgress: (current: number, total: number) => void updateProgress: (current: number, total: number) => void
finishTranscribe: (success: number, fail: number) => void finishTranscribe: (success: number, fail: number) => void
setShowToast: (show: boolean) => void setShowToast: (show: boolean) => void
@@ -27,13 +29,15 @@ export const useBatchTranscribeStore = create<BatchTranscribeState>((set) => ({
showToast: false, showToast: false,
showResult: false, showResult: false,
result: { success: 0, fail: 0 }, result: { success: 0, fail: 0 },
sessionName: '',
startTranscribe: (total) => set({ startTranscribe: (total, sessionName) => set({
isBatchTranscribing: true, isBatchTranscribing: true,
showToast: true, showToast: true,
progress: { current: 0, total }, progress: { current: 0, total },
showResult: false, showResult: false,
result: { success: 0, fail: 0 } result: { success: 0, fail: 0 },
sessionName
}), }),
updateProgress: (current, total) => set({ updateProgress: (current, total) => set({
@@ -55,6 +59,7 @@ export const useBatchTranscribeStore = create<BatchTranscribeState>((set) => ({
progress: { current: 0, total: 0 }, progress: { current: 0, total: 0 },
showToast: false, showToast: false,
showResult: false, showResult: false,
result: { success: 0, fail: 0 } result: { success: 0, fail: 0 },
sessionName: ''
}) })
})) }))