mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-06 08:04:37 +00:00
feat(video): add video transcripts (#559)
* feat(video): generate transcripts with the local embedding server * feat(video): show saved transcripts in the player * fix(video): preserve transcript seek timestamps * fix(video): refine transcript viewing and generation * feat(video): resize transcripts and follow playback earlier * fix(video): animate transcript playback scrolling * fix(video): transcribe from the smallest full proxy * fix(video): refine the sync to playback button * feat(video): edit transcript segment text inline * fix(video): keep transcript segment highlighted over edit button * docs(video): note embedding server version for transcripts
This commit is contained in:
@@ -30,6 +30,7 @@ import { FilePreviewDialog } from '../file-preview-dialog'
|
||||
import { ShareLinkCreatedDialog } from '../share-link-created-dialog'
|
||||
import { FileBrowserContentSkeleton } from '../loading-skeletons'
|
||||
import { FileBrowserContextMenu } from './context-menu'
|
||||
import { GenerateTranscriptsDialog } from './generate-transcripts-dialog'
|
||||
import { getItemInAppUrl } from './copy-options'
|
||||
import { FindSimilarDialog } from '../search/find-similar-dialog'
|
||||
import { useSemanticSearchEnabled } from '../search/use-semantic-search-enabled'
|
||||
@@ -63,6 +64,7 @@ import { FileBrowserToolbar } from './toolbar'
|
||||
import { useFileActions } from './use-file-actions'
|
||||
import { useBatchFileStatus } from '@/ui/hooks/use-batch-file-status'
|
||||
import { useArchiveConfig } from '@/ui/hooks/use-archive-config'
|
||||
import { useServerFeatures } from '@/ui/hooks/use-server-features'
|
||||
import { ArchiveConfirmDialog } from '../archive-confirm-dialog'
|
||||
|
||||
interface FileBrowserProps {
|
||||
@@ -161,6 +163,9 @@ export function FileBrowser({
|
||||
}: FileBrowserProps) {
|
||||
const [contextMenuItem, setContextMenuItem] = useState<AssetInfo | null>(null)
|
||||
const [similarImage, setSimilarImage] = useState<AssetInfo | null>(null)
|
||||
const [transcriptVideo, setTranscriptVideo] = useState<{ id: string; name: string } | null>(null)
|
||||
const closeTranscriptDialog = useCallback(() => setTranscriptVideo(null), [])
|
||||
const transcriptionEnabled = useServerFeatures().data?.transcriptionEnabled
|
||||
const semanticSearchEnabled = useSemanticSearchEnabled(
|
||||
teamId,
|
||||
Boolean(
|
||||
@@ -1122,6 +1127,11 @@ export function FileBrowser({
|
||||
onDownload={handleDownload}
|
||||
onCopy={handleCopy}
|
||||
onFindSimilar={semanticSearchEnabled && rootFolderId ? setSimilarImage : undefined}
|
||||
onGenerateTranscripts={
|
||||
transcriptionEnabled && !isShareView && !isPublic
|
||||
? (id, name) => setTranscriptVideo({ id, name })
|
||||
: undefined
|
||||
}
|
||||
onNewFolder={handleNewFolder}
|
||||
onUploadFile={handleUploadFilesClick}
|
||||
onUploadFolder={handleUploadFolderClick}
|
||||
@@ -1182,6 +1192,15 @@ export function FileBrowser({
|
||||
)}
|
||||
{renderContent()}
|
||||
|
||||
{transcriptVideo && (
|
||||
<GenerateTranscriptsDialog
|
||||
key={transcriptVideo.id}
|
||||
assetId={transcriptVideo.id}
|
||||
name={transcriptVideo.name}
|
||||
onClose={closeTranscriptDialog}
|
||||
/>
|
||||
)}
|
||||
|
||||
{semanticSearchEnabled && similarImage && rootFolderId && (
|
||||
<FindSimilarDialog
|
||||
image={similarImage}
|
||||
|
||||
Reference in New Issue
Block a user