Skip to content

feat(transcripts): read and request transcripts via the EnrichmentObject APIs - #9

Merged
pallakartheekreddy merged 16 commits into
v1.1.2from
feat/transcript-v2
Nov 9, 2026
Merged

pallakartheekreddy merged 16 commits into
v1.1.2from
feat/transcript-v2

Conversation

@chethann007

@chethann007 chethann007 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Moves the editor's transcript support onto the generic EnrichmentObject model. The creator now only requests transcripts at upload time; the AI pipeline generates and auto-approves them after publish, and the editor reads them through the new list API. Review, edit, approve and reject are gone from the editor.

Related PRs (the same feature across the stack):

What changed

Removed (legacy flow)

  • The old TranscriptsDrawer (edit segments, approve, reject) and the matching ContentEditorService methods (createTranscript, updateTranscript, approveTranscript, rejectTranscript, readTranscripts).
  • The 20s transcript polling in useEditor, the ?enrich=all read, and the video-only constants (VIDEO_EXTENSIONS, isVideoMimeType).

Added

  • Enrichment registry (services/enrichment/): one entry per enrichmentObjectType holding its mime types, upload-time checkbox, header and drawer labels, and how its objects apply to the player. Adding another type (for example Summary) is one registry entry plus a panel. Transcript is the first entry.
  • listEnrichmentObjects in ContentEditorService: POST {portalSlug}/object/enrichment/v4/list, one call per type. A failing type no longer discards the others.
  • Upload-time request: for mp4/webm the upload step shows a "Generate transcripts" checkbox. After upload the editor saves enrichmentTypes on the content using the fresh versionKey. Unticking, or replacing the content with a URL source or a file the type does not apply to, clears previously saved types.
  • Read-only drawer: a header button per enrichment type that has objects opens a generic EnrichmentsDrawer. The transcript panel lists languages (source first) with status, "View segments" and "Download captions".
  • Preview: Live transcripts are merged into the player so captions show in the editor preview. The preview waits for the first list check before mounting, and remounts when the set of Live objects or a caption URL changes.
  • The list is fetched once when a published content opens (only when it has a pkgVersion), with Retry on failure. No polling.

Also in this branch

  • Review fixes: a failed list load keeps the header button so the error and Retry are reachable; the segments fetch checks the response status and aborts on unmount; a reload no longer drops an open segments view.
  • Removed the "translations will appear" note, since the pipeline generates translations on its own.
  • Merged v1.1.2 (Dynamic Assess); conflicts in useEditor, ContentEditorService, Header, EditorPreview and the translation files are resolved, and the Dynamic Assess code is untouched.

How it fits together

  1. Creator uploads a video and leaves "Generate transcripts" ticked, so the editor saves enrichmentTypes: ["Transcript"] on the content.
  2. On publish, knowlg-publish emits a content-published event.
  3. The ai-pipeline transcript workflow transcribes with Whisper, translates, writes one Transcript object per language, and approves them to Live.
  4. The editor lists the objects and shows them in the drawer and the preview.

Test plan

  • tsc is clean and the full suite passes: 21 files, 280 tests (npm run build not run).
  • Lint: 0 errors.
  • Upload an mp4 with the box ticked, then confirm enrichmentTypes is saved on the content.
  • Upload with the box unticked, then confirm nothing is saved. Replace a ticked video with a URL source and confirm the types are cleared.
  • Open a published video with transcripts: the header CC button opens the drawer, languages list with the source first, "View segments" and "Download captions" work.
  • Force the list call to fail: the CC button still appears and the drawer shows the error with Retry.
  • Confirm Live captions appear in the editor preview.

Notes

  • Needs the knowledge-platform EnrichmentObject APIs (#1329) deployed, and POST /object/enrichment/v4/list exposed through Kong under the portal slug.
  • Package version is unchanged (2.0.7). The portal needs a published editor build that includes this before it can pick the change up.
  • fr, pt, ar, hi and ta strings for the new UI need a native review.

…/poll flow

The transcript APIs under content/v4/enrichment/object/* and the
?enrich=all read are replaced by the generic EnrichmentObject APIs, and
phase 1 has no approve/reject/edit. Remove the old flow ahead of the new
implementation.

- ContentEditorService: drop createTranscript, updateTranscript,
  approveTranscript, rejectTranscript, readTranscripts and their endpoints
- useEditor: drop the post-upload createTranscript call and the 20s
  transcript polling; hasTranscripts/transcripts/transcriptsChecked are
  inert until the enrichment-object read is added
- TranscriptsDrawer: read-only, reads ed.transcripts; remove approve,
  reject, segment editing and status re-confirmation
- i18n: remove 16 unused keys in all locales, reword NO_TRANSCRIPTS_SUB
- editor.scss: remove styles for the removed UI
- tests: remove suites for the removed behaviour, delete useEditor.test.ts
…ect APIs

Replace the removed transcript flow with the generic EnrichmentObject
model. Phase 1 is read-only: no approve, reject or edit.

- Registry (services/enrichment) holds one entry per enrichmentObjectType
  (mimeTypes, upload prompt, labels, player mapping). Transcript is the
  first entry; everything else is type-agnostic.
- Upload: the prompt shows one checkbox per applicable type. Only ticked
  types that also match the detected mimeType are saved, via a content
  update of enrichmentTypes using the versionKey from the fresh read. A
  failed save is non-fatal (toast + telemetry).
- Read: listEnrichmentObjects calls POST /object/enrichment/v4/list once
  when a published content opens (pkgVersion set); no polling. Header
  buttons, the drawer and the preview captions read from that list.
- UI: EnrichmentsDrawer shell with a read-only TranscriptPanel and shared
  status badge; preview captions use Live objects with a captionsUrl.
- Types: EnrichmentObject, EnrichmentStatus, TranscriptObject;
  ContentData.enrichmentTypes; DrawerKind 'enrichments'.
- i18n: ERROR_ENRICHMENT_SAVE in all locales; README capability row.
- Upload telemetry/event payloads carry enrichmentTypes instead of
  generateTranscripts.
…g note

- Keep the header button after a failed list load so the drawer's error and
  Retry are reachable; a failed reload no longer wipes loaded objects.
- Clear saved enrichmentTypes when the creator unticks the box, or replaces
  the file with a URL source or a file the type does not apply to.
- Derive enrichmentsChecked from the content key so the preview iframe is not
  mounted before the first list check settles.
- Include captionsUrl in the preview iframe key so a replaced VTT reloads.
- Check the response status and abort the segments fetch on unmount.
- Keep the segments view open while a reload runs; show the spinner only when
  nothing is loaded yet.
- Use allSettled when listing several types so one failure keeps the rest.
- Label a missing status "Draft" to match its tone.
- Remove the "translations will appear" note; the pipeline generates
  translations on its own. Drops the string in all six languages, its style
  and its tests.

@pallakartheekreddy pallakartheekreddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff in three passes — the removal half, the new enrichment code, then the merge against both parents. Static read only; I didn't build or run anything.

The things most likely to go wrong here didn't. The removal is complete (no dangling references to any of the deleted methods, constants, types or SCSS, and ?enrich=all fed only the transcript list). The merge resolution is verifiably correct — the Dynamic Assess files are byte-identical to v1.1.2, and the only non-transcript change in the conflicted files is the readEnvelope extraction, which I diffed as pure extraction. All six locales carry exactly 218 keys with identical key sets, and no locale kept keys for the deleted approve/reject UI.

No blockers. The risk is where you flagged it — the clearing path and the failure path. Comments inline.

Small note: commit 3cf6e8e ("update package-lock.json") was fully reverted by the merge — git diff on package-lock.json is empty. Net dependency change is zero, which is right, but the commit message no longer describes anything.

Comment thread src/useEditor.ts Resolved
Comment thread src/useEditor.ts Resolved
Comment thread src/services/ContentEditorService.ts Resolved
Comment thread src/services/ContentEditorService.ts Resolved
Comment thread src/useEditor.ts Resolved
Comment thread src/components/EditorPreview.tsx Resolved
Comment thread src/editor.scss Resolved
Remove the hand-kept extensions list from the registry; the prompt now
checks the file extension's mimeType against the type's mimeTypes, the
same source the post-upload save uses.
Key the iframe on the transcripts passed to the player instead of every
Live object, so a Live object without a caption URL no longer restarts
playback.
parseSegments now returns an empty list for zero cues and null only for
an unrecognised shape, so a silent video no longer reads as a load error.
The list is fetched once when the content opens, so a Processing status
only changes on reload. Add a Refresh button that reuses
reloadEnrichments and is disabled while a reload is in flight.
Add an optional headerAction slot to Drawer and render Refresh as an
icon button beside Close, instead of a text row above the content.
@pallakartheekreddy
pallakartheekreddy merged commit 46fcbdf into v1.1.2 Nov 9, 2026
1 check passed
@pallakartheekreddy
pallakartheekreddy deleted the feat/transcript-v2 branch November 9, 2026 09:13
@Deeksha1502 Deeksha1502 mentioned this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants