mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 22:14:50 +00:00
feat(video): generate transcripts with the local embedding server
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
Copy,
|
||||
Layers,
|
||||
ScanSearch,
|
||||
Captions,
|
||||
} from 'lucide-react'
|
||||
import { CopyContextMenuSub } from './copy-submenu'
|
||||
import { isImageItem, type CopyKind } from './copy-options'
|
||||
@@ -40,6 +41,7 @@ interface FileBrowserContextMenuProps {
|
||||
onDownload: (items: AssetInfo[]) => void
|
||||
onCopy?: (kind: CopyKind, items: AssetInfo[]) => void
|
||||
onFindSimilar?: (item: AssetInfo) => void
|
||||
onGenerateTranscripts?: (assetId: string, name: string) => void
|
||||
onRestore: (items: AssetInfo[]) => void
|
||||
onArchive?: (items: AssetInfo[]) => void
|
||||
onRestoreArchive?: (items: AssetInfo[]) => void
|
||||
@@ -75,6 +77,7 @@ export function FileBrowserContextMenu({
|
||||
onDownload,
|
||||
onCopy,
|
||||
onFindSimilar,
|
||||
onGenerateTranscripts,
|
||||
onRestore,
|
||||
onArchive,
|
||||
onRestoreArchive,
|
||||
@@ -237,6 +240,12 @@ export function FileBrowserContextMenu({
|
||||
</ContextMenuItem>
|
||||
)
|
||||
|
||||
const videoVersion =
|
||||
item.type === 'version_stack'
|
||||
? item.versionStack?.versions.find((version) => version.current)
|
||||
: undefined
|
||||
const transcriptAssetId = item.type === 'file' ? item.id : videoVersion?.id
|
||||
|
||||
const contextMenuContent =
|
||||
isItemSelected && selectedIds.size > 1 ? (
|
||||
<ContextMenuContent
|
||||
@@ -360,6 +369,20 @@ export function FileBrowserContextMenu({
|
||||
<span>{m.download()}</span>
|
||||
</ContextMenuItem>
|
||||
{findSimilarItem}
|
||||
{canEdit &&
|
||||
onGenerateTranscripts &&
|
||||
transcriptAssetId &&
|
||||
item.status === 'processed' &&
|
||||
item.proxyType === 'video' && (
|
||||
<ContextMenuItem
|
||||
onSelect={() =>
|
||||
onGenerateTranscripts(transcriptAssetId, videoVersion?.name || item.name)
|
||||
}
|
||||
>
|
||||
<Captions className="mr-2 h-4 w-4" />
|
||||
<span>{m.generate_transcripts()}</span>
|
||||
</ContextMenuItem>
|
||||
)}
|
||||
<CopyContextMenuSub
|
||||
items={itemsToModify}
|
||||
context={{
|
||||
|
||||
Reference in New Issue
Block a user