@dxos/plugin-transcription 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +401 -0
- package/README.md +1 -1
- package/dist/lib/neutral/TranscriptionArticle-L6XANBH5.mjs +54 -0
- package/dist/lib/neutral/TranscriptionArticle-L6XANBH5.mjs.map +7 -0
- package/dist/lib/neutral/TranscriptionPlugin.mjs +46 -0
- package/dist/lib/neutral/TranscriptionPlugin.mjs.map +7 -0
- package/dist/lib/neutral/TranscriptionPlugin.node.mjs +25 -0
- package/dist/lib/neutral/TranscriptionPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/TranscriptionPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/TranscriptionPlugin.workerd.mjs.map +7 -0
- package/dist/lib/{browser/blueprint-definition-C6XA2SVZ.mjs → neutral/blueprint-definition-HOXDG5QP.mjs} +4 -7
- package/dist/lib/neutral/blueprint-definition-HOXDG5QP.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +1 -2
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2O3ONPRZ.mjs +298 -0
- package/dist/lib/neutral/chunk-2O3ONPRZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FHNI26QW.mjs +45 -0
- package/dist/lib/neutral/chunk-FHNI26QW.mjs.map +7 -0
- package/dist/lib/{browser/chunk-EV5ZYKET.mjs → neutral/chunk-ILSA3DU7.mjs} +87 -112
- package/dist/lib/neutral/chunk-ILSA3DU7.mjs.map +7 -0
- package/dist/lib/{browser/chunk-HOOPZ7EM.mjs → neutral/chunk-KAEXRX3Y.mjs} +1 -1
- package/dist/lib/neutral/chunk-KVUT2KYT.mjs +124 -0
- package/dist/lib/neutral/chunk-KVUT2KYT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MLRJWAQH.mjs +179 -0
- package/dist/lib/neutral/chunk-MLRJWAQH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-Y4YI44ZD.mjs +8 -0
- package/dist/lib/neutral/chunk-Y4YI44ZD.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs +30 -0
- package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +273 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-VWFMMAUY.mjs +21 -0
- package/dist/lib/neutral/create-VWFMMAUY.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +19 -0
- package/dist/lib/neutral/index.mjs +44 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/open-V772IQYW.mjs +27 -0
- package/dist/lib/neutral/open-V772IQYW.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs +13 -0
- package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-YMZRO242.mjs +26 -0
- package/dist/lib/neutral/react-surface-YMZRO242.mjs.map +7 -0
- package/dist/lib/neutral/summarize-6PDRGTKE.mjs +78 -0
- package/dist/lib/neutral/summarize-6PDRGTKE.mjs.map +7 -0
- package/dist/lib/neutral/text-content-KBB37HSM.mjs +30 -0
- package/dist/lib/neutral/text-content-KBB37HSM.mjs.map +7 -0
- package/dist/lib/{browser/transcriber-WCPHHJYY.mjs → neutral/transcriber-ABHATBVH.mjs} +8 -10
- package/dist/lib/neutral/transcriber-ABHATBVH.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +24 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +10 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/TranscriptionPlugin.d.ts +1 -0
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/TranscriptionPlugin.node.d.ts +4 -0
- package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts +2 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts.map +1 -0
- package/dist/types/src/TranscriptionPlugin.workerd.d.ts +4 -0
- package/dist/types/src/TranscriptionPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +10 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/text-content.d.ts +8 -0
- package/dist/types/src/capabilities/text-content.d.ts.map +1 -0
- package/dist/types/src/capabilities/{transcriber/transcriber.d.ts → transcriber.d.ts} +1 -1
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -0
- package/dist/types/src/components/Oracle/Oracle.d.ts +24 -0
- package/dist/types/src/components/Oracle/Oracle.d.ts.map +1 -0
- package/dist/types/src/components/Oracle/Oracle.stories.d.ts +32 -0
- package/dist/types/src/components/Oracle/Oracle.stories.d.ts.map +1 -0
- package/dist/types/src/components/Oracle/index.d.ts +2 -0
- package/dist/types/src/components/Oracle/index.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts +5 -9
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +21 -24
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.d.ts +6 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts +28 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionArticle/index.d.ts +2 -0
- package/dist/types/src/containers/TranscriptionArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/enrichment/conversation.test.d.ts +2 -0
- package/dist/types/src/enrichment/conversation.test.d.ts.map +1 -0
- package/dist/types/src/enrichment/operations.d.ts +200 -0
- package/dist/types/src/enrichment/operations.d.ts.map +1 -0
- package/dist/types/src/enrichment/parser.d.ts +26 -0
- package/dist/types/src/enrichment/parser.d.ts.map +1 -0
- package/dist/types/src/enrichment/stream-simulator.d.ts +38 -0
- package/dist/types/src/enrichment/stream-simulator.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
- package/dist/types/src/hooks/useFeedModelAdapter.d.ts +12 -0
- package/dist/types/src/hooks/useFeedModelAdapter.d.ts.map +1 -0
- package/dist/types/src/hooks/useTranscriber.d.ts +2 -2
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriptionRecording.d.ts +12 -0
- package/dist/types/src/hooks/useTranscriptionRecording.d.ts.map +1 -0
- package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/model.d.ts +2 -2
- package/dist/types/src/model/model.d.ts.map +1 -1
- package/dist/types/src/{segments-normalization → normalization}/index.d.ts +1 -1
- package/dist/types/src/normalization/index.d.ts.map +1 -0
- package/dist/types/src/{segments-normalization → normalization}/message-normalizer.d.ts +7 -5
- package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.d.ts +834 -0
- package/dist/types/src/normalization/normalization.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.test.d.ts.map +1 -0
- package/dist/types/src/normalization/utils.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/summarize.d.ts +8 -0
- package/dist/types/src/operations/summarize.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/stories/FileTranscription.stories.d.ts +20 -0
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories → stories}/KeyWordRecognition.stories.d.ts +2 -2
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories/MicrophoneTranscription.stories.d.ts → stories/LiveTranscription.stories.d.ts} +7 -7
- package/dist/types/src/stories/LiveTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts +21 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
- package/dist/types/src/stories/common.d.ts +248 -0
- package/dist/types/src/stories/common.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +5 -6
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/index.d.ts +1 -1
- package/dist/types/src/transcriber/index.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +58 -3
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
- package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
- package/dist/types/src/transcriber/transcription-manager.d.ts +6 -4
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +9 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptOperation.d.ts +1670 -0
- package/dist/types/src/types/TranscriptOperation.d.ts.map +1 -0
- package/dist/types/src/types/TranscriptionCapabilities.d.ts +17 -0
- package/dist/types/src/types/TranscriptionCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -4
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/array.d.ts.map +1 -1
- package/dist/types/src/util/get-time-str.d.ts.map +1 -1
- package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +140 -86
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +14 -29
- package/src/TranscriptionPlugin.workerd.ts +18 -0
- package/src/blueprints/transcription-blueprint.ts +5 -9
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/index.ts +12 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +31 -0
- package/src/capabilities/text-content.ts +33 -0
- package/src/capabilities/{transcriber/transcriber.ts → transcriber.ts} +5 -2
- package/src/components/Oracle/Oracle.stories.tsx +147 -0
- package/src/components/Oracle/Oracle.tsx +142 -0
- package/src/components/Oracle/index.ts +5 -0
- package/src/components/Transcription/Transcription.stories.tsx +125 -158
- package/src/components/Transcription/Transcription.tsx +33 -38
- package/src/components/index.ts +1 -0
- package/src/containers/TranscriptionArticle/TranscriptionArticle.stories.tsx +61 -0
- package/src/containers/TranscriptionArticle/TranscriptionArticle.tsx +62 -0
- package/src/containers/TranscriptionArticle/index.ts +5 -0
- package/src/containers/index.ts +1 -1
- package/src/enrichment/conversation.test.ts +162 -0
- package/src/enrichment/conversation.txt +23 -0
- package/src/enrichment/operations.ts +271 -0
- package/src/enrichment/parser.ts +101 -0
- package/src/enrichment/stream-simulator.ts +125 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useFeedModelAdapter.ts +46 -0
- package/src/hooks/useTranscriber.ts +5 -2
- package/src/hooks/useTranscriptionRecording.ts +87 -0
- package/src/hooks/useVoiceInput.ts +0 -1
- package/src/index.ts +4 -5
- package/src/meta.ts +28 -6
- package/src/model/model.test.ts +8 -8
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +25 -17
- package/src/{segments-normalization → normalization}/normalization.test.ts +3 -37
- package/src/normalization/normalization.ts +76 -0
- package/src/operations/create.ts +24 -0
- package/src/operations/index.ts +11 -0
- package/src/operations/open.ts +28 -0
- package/src/operations/summarize.ts +101 -0
- package/src/plugin.ts +11 -0
- package/src/stories/FileTranscription.stories.tsx +143 -0
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +38 -38
- package/src/stories/LiveTranscription.stories.tsx +153 -0
- package/src/stories/TranscriptionStory.tsx +101 -0
- package/src/stories/common.ts +233 -0
- package/src/testing/testing.ts +29 -51
- package/src/transcriber/index.ts +1 -1
- package/src/transcriber/transcriber.browser.test.ts +0 -1
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +100 -55
- package/src/transcriber/transcription-manager.ts +14 -9
- package/src/translations.ts +10 -7
- package/src/types/TranscriptOperation.ts +106 -0
- package/src/types/TranscriptionCapabilities.ts +39 -0
- package/src/types/index.ts +2 -4
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/TranscriptionContainer-RBFHP2AV.mjs +0 -41
- package/dist/lib/browser/TranscriptionContainer-RBFHP2AV.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-C6XA2SVZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-2B74LZZD.mjs +0 -22
- package/dist/lib/browser/chunk-2B74LZZD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EV5ZYKET.mjs.map +0 -7
- package/dist/lib/browser/chunk-GH4IIQ6C.mjs +0 -54
- package/dist/lib/browser/chunk-GH4IIQ6C.mjs.map +0 -7
- package/dist/lib/browser/chunk-O7ILGNBZ.mjs +0 -148
- package/dist/lib/browser/chunk-O7ILGNBZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XLMRCOQN.mjs +0 -668
- package/dist/lib/browser/chunk-XLMRCOQN.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -114
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-5BLRH4XE.mjs +0 -23
- package/dist/lib/browser/operation-resolver-5BLRH4XE.mjs.map +0 -7
- package/dist/lib/browser/react-surface-U2SI74JK.mjs +0 -36
- package/dist/lib/browser/react-surface-U2SI74JK.mjs.map +0 -7
- package/dist/lib/browser/transcriber-WCPHHJYY.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -15
- package/dist/lib/node-esm/TranscriptionContainer-3OOID5KH.mjs +0 -42
- package/dist/lib/node-esm/TranscriptionContainer-3OOID5KH.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-TLXDUXIQ.mjs +0 -19
- package/dist/lib/node-esm/blueprint-definition-TLXDUXIQ.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -10
- package/dist/lib/node-esm/chunk-6GW5NZYG.mjs +0 -55
- package/dist/lib/node-esm/chunk-6GW5NZYG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7UE7G6DE.mjs +0 -461
- package/dist/lib/node-esm/chunk-7UE7G6DE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DYUGYQCB.mjs +0 -669
- package/dist/lib/node-esm/chunk-DYUGYQCB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F47HK7GT.mjs +0 -24
- package/dist/lib/node-esm/chunk-F47HK7GT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H3MXHMQL.mjs +0 -149
- package/dist/lib/node-esm/chunk-H3MXHMQL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +0 -37
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -115
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-CVZB7BF4.mjs +0 -24
- package/dist/lib/node-esm/operation-resolver-CVZB7BF4.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-2ICJPBPX.mjs +0 -37
- package/dist/lib/node-esm/react-surface-2ICJPBPX.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-2RIHUEX4.mjs +0 -62
- package/dist/lib/node-esm/transcriber-2RIHUEX4.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -16
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +0 -5
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber/index.d.ts +0 -3
- package/dist/types/src/capabilities/transcriber/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +0 -18
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -12
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +0 -1
- package/dist/types/src/components/stories/useIsSpeaking.d.ts +0 -3
- package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +0 -6
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +0 -1
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts +0 -3
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -18
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts +0 -11
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/summarize.d.ts +0 -11
- package/dist/types/src/functions/summarize.d.ts.map +0 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +0 -8
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/index.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +0 -534
- package/dist/types/src/segments-normalization/normalization.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
- package/dist/types/src/types/TranscriptAction.d.ts +0 -25
- package/dist/types/src/types/TranscriptAction.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -18
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -5
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/operation-handler/index.ts +0 -7
- package/src/capabilities/operation-handler/operation-handler.ts +0 -25
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -25
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -28
- package/src/capabilities/transcriber/index.ts +0 -7
- package/src/components/stories/FileTranscription.stories.tsx +0 -252
- package/src/components/stories/MicrophoneTranscription.stories.tsx +0 -282
- package/src/components/stories/TranscriptionStory.tsx +0 -41
- package/src/components/stories/useIsSpeaking.tsx +0 -40
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +0 -33
- package/src/containers/TranscriptionContainer/index.ts +0 -7
- package/src/functions/index.ts +0 -11
- package/src/functions/open.ts +0 -37
- package/src/functions/summarize.ts +0 -103
- package/src/hooks/useQueueModelAdapter.ts +0 -66
- package/src/segments-normalization/normalization.ts +0 -115
- package/src/types/TranscriptAction.ts +0 -32
- package/src/types/capabilities.ts +0 -33
- package/src/types/types.ts +0 -9
- package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- package/dist/lib/{browser/chunk-HOOPZ7EM.mjs.map → neutral/chunk-KAEXRX3Y.mjs.map} +0 -0
- package/dist/lib/{browser/types → neutral/hooks}/index.mjs.map +0 -0
- package/dist/lib/{node-esm/blueprints → neutral}/index.mjs.map +0 -0
- package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
- package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
- package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/dist/types/src/{segments-normalization → normalization}/utils.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
- /package/src/{segments-normalization → normalization}/utils.ts +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useAudioFile } from '#hooks';
|
|
9
|
+
|
|
10
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../transcriber';
|
|
11
|
+
import {
|
|
12
|
+
useIsSpeaking,
|
|
13
|
+
createStoryDecorators,
|
|
14
|
+
useStoryAppendSegments,
|
|
15
|
+
useStoryMessageModel,
|
|
16
|
+
useStoryTranscriber,
|
|
17
|
+
} from './common';
|
|
18
|
+
import { TranscriptionStory } from './TranscriptionStory';
|
|
19
|
+
|
|
20
|
+
const DEFAULT_TRANSCRIBER_CONFIG = {
|
|
21
|
+
transcribeAfterChunksAmount: 100,
|
|
22
|
+
prefixBufferChunksAmount: 50,
|
|
23
|
+
normalizeSentences: true,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const DEFAULT_RECORDER_CONFIG = {
|
|
27
|
+
interval: 200,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type DefaultStoryProps = {
|
|
31
|
+
detectSpeaking?: boolean;
|
|
32
|
+
normalizeSentences?: boolean;
|
|
33
|
+
audioUrl: string;
|
|
34
|
+
transcriberConfig?: TranscriberProps['config'];
|
|
35
|
+
recorderConfig?: MediaStreamRecorderProps['config'];
|
|
36
|
+
audioConstraints?: MediaTrackConstraints;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const DefaultStory = ({
|
|
40
|
+
detectSpeaking,
|
|
41
|
+
audioUrl,
|
|
42
|
+
normalizeSentences,
|
|
43
|
+
transcriberConfig = DEFAULT_TRANSCRIBER_CONFIG,
|
|
44
|
+
recorderConfig = DEFAULT_RECORDER_CONFIG,
|
|
45
|
+
audioConstraints,
|
|
46
|
+
}: DefaultStoryProps) => {
|
|
47
|
+
const [running, setRunning] = useState(false);
|
|
48
|
+
|
|
49
|
+
// Optional uploaded file overrides the default URL; revoke the previous URL on change/unmount.
|
|
50
|
+
const [uploadedUrl, setUploadedUrl] = useState<string>();
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
return () => {
|
|
53
|
+
if (uploadedUrl) {
|
|
54
|
+
URL.revokeObjectURL(uploadedUrl);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, [uploadedUrl]);
|
|
58
|
+
|
|
59
|
+
const handleUpload = useCallback((file: File) => {
|
|
60
|
+
setRunning(false);
|
|
61
|
+
setUploadedUrl(URL.createObjectURL(file));
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
const sourceUrl = uploadedUrl ?? audioUrl;
|
|
65
|
+
const { audio, track, stream } = useAudioFile(sourceUrl, audioConstraints);
|
|
66
|
+
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
67
|
+
|
|
68
|
+
// Pipe the decoded stream into the <audio> element so the user hears playback.
|
|
69
|
+
const ref = useRef<HTMLAudioElement>(null);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (ref.current && stream) {
|
|
72
|
+
ref.current.srcObject = stream;
|
|
73
|
+
}
|
|
74
|
+
}, [stream]);
|
|
75
|
+
|
|
76
|
+
// Mirror the toolbar's running flag to the underlying HTMLAudioElement.
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!audio) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (running) {
|
|
83
|
+
void audio.play();
|
|
84
|
+
} else {
|
|
85
|
+
void audio.pause();
|
|
86
|
+
}
|
|
87
|
+
}, [audio, running]);
|
|
88
|
+
|
|
89
|
+
const { model, appendMessage } = useStoryMessageModel();
|
|
90
|
+
const handleSegments = useStoryAppendSegments(appendMessage);
|
|
91
|
+
|
|
92
|
+
useStoryTranscriber({
|
|
93
|
+
audioStreamTrack: track,
|
|
94
|
+
running,
|
|
95
|
+
isSpeaking,
|
|
96
|
+
transcriberConfig,
|
|
97
|
+
recorderConfig,
|
|
98
|
+
onSegments: handleSegments,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// TODO(burdon): Sentence normalization moved to require a real space-backed Feed + FeedService runtime.
|
|
102
|
+
// Re-enable here once the story has access to one.
|
|
103
|
+
void normalizeSentences;
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<TranscriptionStory
|
|
107
|
+
audioRef={ref}
|
|
108
|
+
disabled={!stream}
|
|
109
|
+
model={model}
|
|
110
|
+
running={running}
|
|
111
|
+
onRunningChange={setRunning}
|
|
112
|
+
onUpload={handleUpload}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const meta = {
|
|
118
|
+
title: 'plugins/plugin-transcription/stories/FileTranscription',
|
|
119
|
+
render: DefaultStory,
|
|
120
|
+
decorators: createStoryDecorators(),
|
|
121
|
+
} satisfies Meta<DefaultStoryProps>;
|
|
122
|
+
|
|
123
|
+
export default meta;
|
|
124
|
+
|
|
125
|
+
type Story = StoryObj<typeof meta>;
|
|
126
|
+
|
|
127
|
+
export const Default: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
detectSpeaking: true,
|
|
130
|
+
// https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
|
|
131
|
+
audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
132
|
+
// textUrl: 'https://dxos.network/audio-london.txt',
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// TODO(mykola): Fix sentence normalization.
|
|
137
|
+
// export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
|
|
138
|
+
// args: {
|
|
139
|
+
// detectSpeaking: true,
|
|
140
|
+
// normalizeSentences: true,
|
|
141
|
+
// audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
142
|
+
// },
|
|
143
|
+
// };
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
|
-
import { Toolbar } from '@dxos/react-ui';
|
|
9
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
10
10
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
11
|
import { mx } from '@dxos/ui-theme';
|
|
12
12
|
|
|
@@ -15,15 +15,14 @@ type Word = {
|
|
|
15
15
|
matched: boolean;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type DefaultStoryProps = {
|
|
19
19
|
keywords: string[];
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const DefaultStory = ({ keywords }:
|
|
22
|
+
const DefaultStory = ({ keywords }: DefaultStoryProps) => {
|
|
23
23
|
const [running, setRunning] = useState(false);
|
|
24
24
|
const [matchingWords, setMatchingWords] = useState<Word[]>(keywords.map((word) => ({ text: word, matched: false })));
|
|
25
25
|
|
|
26
|
-
const [transcript, setTranscript] = useState('');
|
|
27
26
|
const recognition = useMemo(() => {
|
|
28
27
|
// TODO(mykola): Fix types
|
|
29
28
|
const SpeechRecognition = (window as any).SpeechRecognition || (window as any).webkitSpeechRecognition;
|
|
@@ -38,16 +37,16 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
38
37
|
recognition.interimResults = true;
|
|
39
38
|
recognition.lang = 'en-US';
|
|
40
39
|
recognition.maxAlternatives = 1;
|
|
41
|
-
// Add this line to enable punctuation
|
|
40
|
+
// Add this line to enable punctuation.
|
|
42
41
|
recognition.grammars = new SpeechGrammarList();
|
|
43
42
|
|
|
44
|
-
// TODO(mykola): Fix types
|
|
43
|
+
// TODO(mykola): Fix types.
|
|
45
44
|
recognition.onresult = (event: any) => {
|
|
46
45
|
log.info('recognition result', { event });
|
|
47
46
|
const current = event.resultIndex;
|
|
48
47
|
const transcript = event.results[current][0].transcript;
|
|
49
48
|
|
|
50
|
-
// Remove punctuation and normalize whitespace for comparison
|
|
49
|
+
// Remove punctuation and normalize whitespace for comparison.
|
|
51
50
|
const normalizeText = (text: string) =>
|
|
52
51
|
text
|
|
53
52
|
.toLowerCase()
|
|
@@ -57,7 +56,7 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
57
56
|
|
|
58
57
|
const normalizedTranscript = normalizeText(transcript);
|
|
59
58
|
|
|
60
|
-
// Check each keyword and update matching words
|
|
59
|
+
// Check each keyword and update matching words.
|
|
61
60
|
const updatedWords = matchingWords.map((word) => {
|
|
62
61
|
const normalizedKeyword = normalizeText(word.text);
|
|
63
62
|
const matched = normalizedTranscript.includes(normalizedKeyword);
|
|
@@ -65,10 +64,9 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
setMatchingWords(updatedWords);
|
|
68
|
-
setTranscript(transcript);
|
|
69
67
|
};
|
|
70
68
|
|
|
71
|
-
// TODO(mykola): Fix types
|
|
69
|
+
// TODO(mykola): Fix types.
|
|
72
70
|
recognition.onerror = (event: any) => {
|
|
73
71
|
log.error('Speech recognition error:', { error: event.error });
|
|
74
72
|
setRunning(false);
|
|
@@ -86,37 +84,39 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
86
84
|
}, [running, recognition]);
|
|
87
85
|
|
|
88
86
|
return (
|
|
89
|
-
<
|
|
90
|
-
<Toolbar
|
|
91
|
-
<Toolbar.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
87
|
+
<Panel.Root>
|
|
88
|
+
<Panel.Toolbar asChild>
|
|
89
|
+
<Toolbar.Root>
|
|
90
|
+
<Toolbar.IconButton
|
|
91
|
+
iconOnly
|
|
92
|
+
icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
|
|
93
|
+
label={running ? 'Pause' : 'Play'}
|
|
94
|
+
onClick={() => setRunning((running) => !running)}
|
|
95
|
+
/>
|
|
96
|
+
</Toolbar.Root>
|
|
97
|
+
</Panel.Toolbar>
|
|
98
|
+
|
|
99
|
+
<Panel.Content>
|
|
100
|
+
<div className='p-2 grid grid-cols-[repeat(auto-fill,minmax(6rem,1fr))] gap-2'>
|
|
101
|
+
{matchingWords.map((word, index) => (
|
|
102
|
+
<span
|
|
103
|
+
key={index}
|
|
104
|
+
className={mx(
|
|
105
|
+
'grid place-items-center p-2 aspect-square rounded-sm border border-separator',
|
|
106
|
+
word.matched && 'border-red-300',
|
|
107
|
+
)}
|
|
108
|
+
>
|
|
109
|
+
{word.text}
|
|
110
|
+
</span>
|
|
111
|
+
))}
|
|
112
|
+
</div>
|
|
113
|
+
</Panel.Content>
|
|
114
|
+
</Panel.Root>
|
|
115
115
|
);
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
const meta = {
|
|
119
|
-
title: 'plugins/plugin-transcription/
|
|
119
|
+
title: 'plugins/plugin-transcription/stories/KeyWordDetection',
|
|
120
120
|
render: DefaultStory,
|
|
121
121
|
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
122
122
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -127,6 +127,6 @@ type Story = StoryObj<typeof meta>;
|
|
|
127
127
|
|
|
128
128
|
export const SpeechRecognitionAPI: Story = {
|
|
129
129
|
args: {
|
|
130
|
-
keywords: ['kai', 'computer', 'hello'],
|
|
130
|
+
keywords: ['kai', 'computer', 'hello', 'dxos'],
|
|
131
131
|
},
|
|
132
132
|
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
type ExtractionFunction,
|
|
10
|
+
extractionAnthropicFunction,
|
|
11
|
+
extractionNerFunction,
|
|
12
|
+
getNer,
|
|
13
|
+
processTranscriptMessage,
|
|
14
|
+
} from '@dxos/assistant/extraction';
|
|
15
|
+
import { Filter, type Obj } from '@dxos/echo';
|
|
16
|
+
import { invariant } from '@dxos/invariant';
|
|
17
|
+
import { useSpaces } from '@dxos/react-client/echo';
|
|
18
|
+
import { Message, Organization, Person } from '@dxos/types';
|
|
19
|
+
|
|
20
|
+
import { useAudioTrack } from '#hooks';
|
|
21
|
+
|
|
22
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../transcriber';
|
|
23
|
+
import { useIsSpeaking, createStoryDecorators, useStoryMessageModel, useStoryTranscriber } from './common';
|
|
24
|
+
import { TranscriptionStory } from './TranscriptionStory';
|
|
25
|
+
|
|
26
|
+
const DEFAULT_TRANSCRIBER_CONFIG = {
|
|
27
|
+
transcribeAfterChunksAmount: 50,
|
|
28
|
+
prefixBufferChunksAmount: 10,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const DEFAULT_RECORDER_CONFIG = {
|
|
32
|
+
interval: 200,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type DefaultStoryProps = {
|
|
36
|
+
detectSpeaking?: boolean;
|
|
37
|
+
transcriberConfig?: TranscriberProps['config'];
|
|
38
|
+
recorderConfig?: MediaStreamRecorderProps['config'];
|
|
39
|
+
audioConstraints?: MediaTrackConstraints;
|
|
40
|
+
entityExtraction?: 'ner' | 'llm';
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const DefaultStory = ({
|
|
44
|
+
detectSpeaking,
|
|
45
|
+
entityExtraction,
|
|
46
|
+
transcriberConfig = DEFAULT_TRANSCRIBER_CONFIG,
|
|
47
|
+
recorderConfig = DEFAULT_RECORDER_CONFIG,
|
|
48
|
+
audioConstraints,
|
|
49
|
+
}: DefaultStoryProps) => {
|
|
50
|
+
const [running, setRunning] = useState(false);
|
|
51
|
+
const track = useAudioTrack(running, audioConstraints);
|
|
52
|
+
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
53
|
+
const { model, appendMessage } = useStoryMessageModel();
|
|
54
|
+
const [space] = useSpaces();
|
|
55
|
+
|
|
56
|
+
// Resolve the entity-extraction function + nearby objects once per `entityExtraction` toggle.
|
|
57
|
+
const { extractionFunction, objects } = useMemo(() => {
|
|
58
|
+
if (!space || !entityExtraction) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let extractionFunction: ExtractionFunction | undefined;
|
|
63
|
+
let objects: Promise<Obj.Unknown[]> | undefined;
|
|
64
|
+
if (entityExtraction === 'ner') {
|
|
65
|
+
void getNer(); // Init model loading. Takes time.
|
|
66
|
+
extractionFunction = extractionNerFunction;
|
|
67
|
+
} else if (entityExtraction === 'llm') {
|
|
68
|
+
extractionFunction = extractionAnthropicFunction;
|
|
69
|
+
objects = space.db.query(Filter.or(Filter.type(Person.Person), Filter.type(Organization.Organization))).run();
|
|
70
|
+
}
|
|
71
|
+
return { extractionFunction, objects };
|
|
72
|
+
}, [entityExtraction, space]);
|
|
73
|
+
|
|
74
|
+
// Build a Message from each transcribed batch; optionally enrich via entity extraction.
|
|
75
|
+
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
76
|
+
async (blocks) => {
|
|
77
|
+
const message = Message.make({
|
|
78
|
+
sender: { name: 'You' },
|
|
79
|
+
created: new Date().toISOString(),
|
|
80
|
+
blocks,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
if (entityExtraction && space) {
|
|
84
|
+
invariant(extractionFunction, 'extractionFunction is required');
|
|
85
|
+
const result = await processTranscriptMessage({
|
|
86
|
+
function: extractionFunction,
|
|
87
|
+
input: { message, objects: await objects },
|
|
88
|
+
options: { fallbackToRaw: true, timeout: 30_000 },
|
|
89
|
+
});
|
|
90
|
+
appendMessage(result.message);
|
|
91
|
+
} else {
|
|
92
|
+
appendMessage(message);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
[appendMessage, space, entityExtraction, extractionFunction, objects],
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
useStoryTranscriber({
|
|
99
|
+
audioStreamTrack: track,
|
|
100
|
+
running,
|
|
101
|
+
isSpeaking,
|
|
102
|
+
transcriberConfig,
|
|
103
|
+
recorderConfig,
|
|
104
|
+
onSegments: handleSegments,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return <TranscriptionStory model={model} running={running} onRunningChange={setRunning} />;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const meta = {
|
|
111
|
+
title: 'plugins/plugin-transcription/stories/LiveTranscription',
|
|
112
|
+
render: DefaultStory,
|
|
113
|
+
decorators: createStoryDecorators({ enableVectorIndex: true }),
|
|
114
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
115
|
+
|
|
116
|
+
export default meta;
|
|
117
|
+
|
|
118
|
+
type Story = StoryObj<typeof meta>;
|
|
119
|
+
|
|
120
|
+
export const Default: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
detectSpeaking: false,
|
|
123
|
+
audioConstraints: {
|
|
124
|
+
echoCancellation: false,
|
|
125
|
+
noiseSuppression: false,
|
|
126
|
+
autoGainControl: false,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const SpeechDetection: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
detectSpeaking: true,
|
|
134
|
+
audioConstraints: {
|
|
135
|
+
echoCancellation: true,
|
|
136
|
+
noiseSuppression: true,
|
|
137
|
+
autoGainControl: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// TODO(mykola): Fix hugging face quota issues.
|
|
143
|
+
// export const EntityExtraction: Story = {
|
|
144
|
+
// args: {
|
|
145
|
+
// detectSpeaking: true,
|
|
146
|
+
// entityExtraction: 'ner',
|
|
147
|
+
// audioConstraints: {
|
|
148
|
+
// echoCancellation: true,
|
|
149
|
+
// noiseSuppression: true,
|
|
150
|
+
// autoGainControl: true,
|
|
151
|
+
// },
|
|
152
|
+
// },
|
|
153
|
+
// };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, {
|
|
6
|
+
type ChangeEvent,
|
|
7
|
+
type Dispatch,
|
|
8
|
+
type RefObject,
|
|
9
|
+
type SetStateAction,
|
|
10
|
+
useCallback,
|
|
11
|
+
useRef,
|
|
12
|
+
} from 'react';
|
|
13
|
+
|
|
14
|
+
import { IconButton, ScrollContainer, Toolbar } from '@dxos/react-ui';
|
|
15
|
+
import { type Message } from '@dxos/types';
|
|
16
|
+
|
|
17
|
+
import { Transcription } from '../components';
|
|
18
|
+
import { type SerializationModel } from '../model';
|
|
19
|
+
|
|
20
|
+
export type TranscriptionStoryProps = {
|
|
21
|
+
audioRef?: RefObject<HTMLAudioElement | null>;
|
|
22
|
+
model: SerializationModel<Message.Message>;
|
|
23
|
+
running: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
uploadAccept?: string;
|
|
26
|
+
onRunningChange: Dispatch<SetStateAction<boolean>>;
|
|
27
|
+
onUpload?: (file: File) => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Story wrapper that renders a transcript with playback controls, an optional audio file
|
|
32
|
+
* upload affordance, and a toolbar slot for additional controls.
|
|
33
|
+
*
|
|
34
|
+
* @param onUpload - Callback fired when the user picks a local audio file via the upload button.
|
|
35
|
+
* @param uploadAccept - HTML `accept` filter for the hidden file input. Defaults to `audio/*`.
|
|
36
|
+
*/
|
|
37
|
+
export const TranscriptionStory = ({
|
|
38
|
+
audioRef,
|
|
39
|
+
model,
|
|
40
|
+
running,
|
|
41
|
+
disabled,
|
|
42
|
+
uploadAccept = 'audio/*',
|
|
43
|
+
onRunningChange,
|
|
44
|
+
onUpload,
|
|
45
|
+
}: TranscriptionStoryProps) => {
|
|
46
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
47
|
+
|
|
48
|
+
const handleFileChange = useCallback(
|
|
49
|
+
(event: ChangeEvent<HTMLInputElement>) => {
|
|
50
|
+
const file = event.target.files?.[0];
|
|
51
|
+
if (file && onUpload) {
|
|
52
|
+
onUpload(file);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Reset so the same file can be re-selected.
|
|
56
|
+
event.target.value = '';
|
|
57
|
+
},
|
|
58
|
+
[onUpload],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
{audioRef && <audio ref={audioRef} autoPlay />}
|
|
64
|
+
<Toolbar.Root>
|
|
65
|
+
<IconButton
|
|
66
|
+
iconOnly
|
|
67
|
+
disabled={disabled}
|
|
68
|
+
icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
|
|
69
|
+
label={running ? 'Pause' : 'Play'}
|
|
70
|
+
onClick={() => onRunningChange((running) => !running)}
|
|
71
|
+
/>
|
|
72
|
+
{onUpload && (
|
|
73
|
+
<>
|
|
74
|
+
<input
|
|
75
|
+
ref={fileInputRef}
|
|
76
|
+
type='file'
|
|
77
|
+
accept={uploadAccept}
|
|
78
|
+
disabled={disabled}
|
|
79
|
+
className='hidden'
|
|
80
|
+
onChange={handleFileChange}
|
|
81
|
+
/>
|
|
82
|
+
<IconButton
|
|
83
|
+
iconOnly
|
|
84
|
+
disabled={disabled}
|
|
85
|
+
icon='ph--upload--regular'
|
|
86
|
+
label='Upload audio'
|
|
87
|
+
onClick={() => fileInputRef.current?.click()}
|
|
88
|
+
/>
|
|
89
|
+
</>
|
|
90
|
+
)}
|
|
91
|
+
</Toolbar.Root>
|
|
92
|
+
<ScrollContainer.Root pin>
|
|
93
|
+
<ScrollContainer.Content>
|
|
94
|
+
<ScrollContainer.Viewport>
|
|
95
|
+
<Transcription model={model} />
|
|
96
|
+
</ScrollContainer.Viewport>
|
|
97
|
+
</ScrollContainer.Content>
|
|
98
|
+
</ScrollContainer.Root>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
};
|