diff --git a/CHANGELOG.md b/CHANGELOG.md index 08c99198..2c97be34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - **sessions**: See total tokens and estimated cost in the session logs footer, with a breakdown of input, output, and cached tokens. - **projects**: Middle-click or Command/Ctrl-click a project to open it in a new tab. Use **Open in new tab** in a file or folder's context menu to keep your current view open. - **video**: Update your local embedding server to v0.1.3 to generate video transcripts. Choose a language or detect it automatically, then open the transcript in the video player to switch languages, follow playback, search the text, jump to a segment, or edit its text. -- **video**: Generate video transcripts in Simplified or Traditional Chinese. You can save and edit both versions on the same video. +- **video**: Search for languages when generating video transcripts. You can save and edit Simplified and Traditional Chinese versions on the same video. - **integrations**: Set and test an embedding server URL under **Team Settings → Integrations**. A URL set through environment variables appears read-only. Once the server is configured, enable the Transcript Agent to generate video transcripts and receive an internal comment if a job fails. The updated embedding and full Docker Compose files create and enable the agent automatically with a distinct avatar. For an existing deployment, create and enable the Transcript Agent under **Team Settings → Agents**, or add this line to the Shumai service’s `environment` block in your Compose file. diff --git a/apps/web/e2e/README.md b/apps/web/e2e/README.md index 760b1f8c..4b7ca15f 100644 --- a/apps/web/e2e/README.md +++ b/apps/web/e2e/README.md @@ -76,7 +76,7 @@ apps/web/e2e/ | Owner creates a project with a cover image | `tests/project/create-project.spec.ts` | | Owner opens project cards in new tabs with middle-click and modifier-click | `tests/project/open-in-new-tab.spec.ts` | | Owner opens a folder card and a file row in new tabs from the context menu | `tests/project/open-in-new-tab.spec.ts` | -| Owner sees the transcript action only when available, requests both Chinese scripts and English from an archived video's context menu, sees progress in card and list metadata across a refresh, and reuses the project status across folders | `tests/project/generate-transcripts.spec.ts` | +| Owner opens the transcript action when available, searches for both Chinese scripts and English without resizing the dialog, tracks progress across a refresh, and reuses the project status across folders | `tests/project/generate-transcripts.spec.ts` | | Owner uploads a file or an unsupported file via the "Upload File" context menu action | `tests/project/upload-file.spec.ts` | | Owner deletes a file, finds it in recently deleted, and restores it | `tests/project/delete-restore.spec.ts` | | Owner deletes a folder and still sees its contents preview and countdown in recently deleted | `tests/project/delete-restore.spec.ts` | diff --git a/apps/web/e2e/tests/project/generate-transcripts.spec.ts b/apps/web/e2e/tests/project/generate-transcripts.spec.ts index d3558863..e2a99086 100644 --- a/apps/web/e2e/tests/project/generate-transcripts.spec.ts +++ b/apps/web/e2e/tests/project/generate-transcripts.spec.ts @@ -93,23 +93,43 @@ test('starts a transcript for an archived video and tracks it in the file metada } await openDialog() const dialog = page.getByRole('dialog', { name: 'Generate Transcripts' }) - const language = dialog.getByRole('combobox', { name: 'Language' }) + const language = dialog.getByRole('combobox', { name: 'Language', exact: true }) const generate = dialog.getByRole('button', { name: 'Generate', exact: true }) const metadata = fileCard(page, fileName).getByTestId('file-card-metadata') + const searchBox = dialog.getByRole('combobox', { name: 'Search languages' }) + const dialogHeight = () => dialog.evaluate((element) => element.clientHeight) + + await expect(language).toBeEnabled() + const closedHeight = await dialogHeight() + await language.press('ArrowDown') + await expect(dialog.getByRole('option', { name: 'English' })).toBeVisible() + expect(await dialogHeight()).toBe(closedHeight) + await expect(searchBox).toBeFocused() + await searchBox.fill('unmatched query') + await expect(dialog.getByText('No matching languages.')).toBeVisible() + expect(await dialogHeight()).toBe(closedHeight) + await searchBox.press('Escape') + await expect(searchBox).toBeHidden() + await expect(language).toBeFocused() + await expect(language).toHaveText('Auto') + const selectLanguage = async (search: string, name: string) => { - await language.fill(search) + await language.click() + await expect(searchBox).toHaveValue('') + await searchBox.fill(search) + await expect(dialog.getByRole('option')).toHaveCount(1) await expect(dialog.getByRole('option', { name })).toBeVisible() - await language.press('ArrowDown') - await expect(language).toHaveAttribute('aria-activedescendant', /.+/) - await language.press('Enter') - await expect(language).toHaveValue(name) + await searchBox.press('ArrowDown') + await expect(searchBox).toHaveAttribute('aria-activedescendant', /.+/) + await searchBox.press('Enter') + await expect(searchBox).toBeHidden() + await expect(language).toHaveText(name) } - await expect(language).toHaveValue('Auto') await selectLanguage('Simplified', 'Chinese (Simplified)') await generate.click() await expect(dialog.getByRole('alert')).toBeVisible() - await expect(language).toHaveValue('Chinese (Simplified)') + await expect(language).toHaveText('Chinese (Simplified)') await generate.click() await expect(dialog).toBeHidden() await expect(metadata).toHaveText('Transcribing…') diff --git a/packages/webui/components/file-browser/generate-transcripts-dialog.tsx b/packages/webui/components/file-browser/generate-transcripts-dialog.tsx index 8d90fd6c..990dc935 100644 --- a/packages/webui/components/file-browser/generate-transcripts-dialog.tsx +++ b/packages/webui/components/file-browser/generate-transcripts-dialog.tsx @@ -13,6 +13,8 @@ import { ComboboxInput, ComboboxItem, ComboboxList, + ComboboxTrigger, + ComboboxValue, } from '@/ui/components/ui/combobox' import { Dialog, @@ -36,9 +38,11 @@ export function GenerateTranscriptsDialog({ onJobAccepted: (assetId: string) => Promise onClose: () => void }) { - const dialogRef = useRef(null) + const popupContainerRef = useRef(null) + const languageTriggerRef = useRef(null) const queryClient = useQueryClient() const [language, setLanguage] = useState('') + const [isLanguagePickerOpen, setLanguagePickerOpen] = useState(false) const param = { fileId: assetId } const languages = useQuery({ @@ -84,6 +88,7 @@ export function GenerateTranscriptsDialog({ })), ] const busy = generate.isPending || isTranscribing + const searchLabel = m.transcript_search_languages() return ( - + { + if (isLanguagePickerOpen) event.preventDefault() + }} + > {m.generate_transcripts()} {name} @@ -100,16 +110,24 @@ export function GenerateTranscriptsDialog({ { - const activeElement = dialogRef.current?.ownerDocument.activeElement - // WebKit can report focus-out after focus has already returned to the input. + open={isLanguagePickerOpen} + onOpenChange={(open, details) => { + const container = popupContainerRef.current + const activeElement = container?.ownerDocument.activeElement + // WebKit can report focus-out while focus is still within the language picker. if ( - !isOpen && + !open && details.reason === 'focus-out' && - activeElement === details.event.target + (activeElement === languageTriggerRef.current || + container?.contains(activeElement ?? null)) ) { details.cancel() + return } + if (!open && details.reason === 'escape-key') { + languageTriggerRef.current?.focus({ preventScroll: true }) + } + setLanguagePickerOpen(open) }} value={choices.find((choice) => choice.code === language)} onValueChange={(choice) => setLanguage(choice?.code ?? '')} @@ -117,20 +135,40 @@ export function GenerateTranscriptsDialog({ isItemEqualToValue={(choice, value) => choice.code === value.code} disabled={busy || languages.isPending || languages.isError} > - - - - {m.transcript_no_languages_found()} - - {(choice) => ( - - {choice.name} - - )} - - +
+ + } + > + + +
+ {/* Keep the popup inside the modal focus trap and outside the dialog grid. */} +
+ + + {m.transcript_no_languages_found()} + + {(choice) => ( + + {choice.name} + + )} + + +
{languages.isPending && ( diff --git a/packages/webui/messages/en.json b/packages/webui/messages/en.json index f27693fa..28abd952 100644 --- a/packages/webui/messages/en.json +++ b/packages/webui/messages/en.json @@ -1828,6 +1828,7 @@ "transcript_language_auto": "Auto", "transcript_language_chinese_simplified": "Chinese (Simplified)", "transcript_language_chinese_traditional": "Chinese (Traditional)", + "transcript_search_languages": "Search languages", "transcript_generating": "Transcribing…", "transcript_no_speech": "No speech detected.", "transcript_submit_failed": "Could not start transcript generation.", diff --git a/packages/webui/messages/ko.json b/packages/webui/messages/ko.json index fdc0afc8..b1186b99 100644 --- a/packages/webui/messages/ko.json +++ b/packages/webui/messages/ko.json @@ -1758,6 +1758,7 @@ "transcript_language_auto": "자동 감지", "transcript_language_chinese_simplified": "중국어(간체)", "transcript_language_chinese_traditional": "중국어(번체)", + "transcript_search_languages": "언어 검색", "transcript_generating": "전사 중…", "transcript_no_speech": "음성이 감지되지 않았습니다.", "transcript_submit_failed": "전사 생성을 시작할 수 없습니다.", diff --git a/packages/webui/messages/zh.json b/packages/webui/messages/zh.json index 46e17e21..73b50e7c 100644 --- a/packages/webui/messages/zh.json +++ b/packages/webui/messages/zh.json @@ -1828,6 +1828,7 @@ "transcript_language_auto": "自动检测", "transcript_language_chinese_simplified": "中文(简体)", "transcript_language_chinese_traditional": "中文(繁体)", + "transcript_search_languages": "搜索语言", "transcript_generating": "正在转录…", "transcript_no_speech": "未检测到语音。", "transcript_submit_failed": "无法启动转录生成。",