@dxos/plugin-transcription 0.8.4-main.fd6878d → 0.9.0
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/neutral/blueprint-definition-DA4QFRYJ.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-DA4QFRYJ.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.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/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KAEXRX3Y.mjs +35 -0
- package/dist/lib/neutral/chunk-KAEXRX3Y.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KMT3BMMQ.mjs +124 -0
- package/dist/lib/neutral/chunk-KMT3BMMQ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KXJZEYS7.mjs +8 -0
- package/dist/lib/neutral/chunk-KXJZEYS7.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-TO77KAQK.mjs +298 -0
- package/dist/lib/neutral/chunk-TO77KAQK.mjs.map +7 -0
- package/dist/lib/{browser/chunk-KJIQQHJB.mjs → neutral/chunk-TX3NQISZ.mjs} +115 -186
- package/dist/lib/neutral/chunk-TX3NQISZ.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 +269 -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-RVR7VC33.mjs +21 -0
- package/dist/lib/neutral/create-RVR7VC33.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/meta.mjs.map +7 -0
- package/dist/lib/neutral/open-A5KXKRH4.mjs +27 -0
- package/dist/lib/neutral/open-A5KXKRH4.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/operations/index.mjs.map +7 -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-5XPPMVTE.mjs +77 -0
- package/dist/lib/neutral/summarize-5XPPMVTE.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/neutral/transcriber-OGSF3XO5.mjs +59 -0
- package/dist/lib/neutral/transcriber-OGSF3XO5.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 +3 -1
- 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/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
- 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 +11 -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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- 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.d.ts +4 -3
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
- 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 +11 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +37 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/index.d.ts +2 -0
- package/dist/types/src/components/Transcription/index.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts +15 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -3
- 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 +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- 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 +2 -3
- 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 +9 -7
- 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 +3 -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/stories/KeyWordRecognition.stories.d.ts +14 -0
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/stories/LiveTranscription.stories.d.ts +20 -0
- 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 +14 -15
- 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 +2 -2
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +61 -6
- 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 +17 -16
- 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 -2
- 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/index.d.ts +1 -0
- package/dist/types/src/util/index.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 +4 -0
- package/dist/types/src/util/render-byline.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +153 -85
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +28 -61
- package/src/TranscriptionPlugin.workerd.ts +18 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +29 -0
- package/src/capabilities/blueprint-definition.ts +19 -0
- package/src/capabilities/index.ts +16 -6
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +23 -14
- package/src/capabilities/text-content.ts +33 -0
- package/src/capabilities/transcriber.ts +54 -41
- 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 +213 -0
- package/src/components/Transcription/Transcription.tsx +55 -0
- package/src/components/{Transcript → Transcription}/index.ts +1 -1
- package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +13 -46
- package/src/components/index.ts +2 -6
- 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 +7 -0
- 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/useAudioFile.ts +49 -53
- package/src/hooks/useAudioTrack.ts +1 -1
- package/src/hooks/useFeedModelAdapter.ts +46 -0
- package/src/hooks/useTranscriber.ts +15 -7
- package/src/hooks/useTranscriptionRecording.ts +87 -0
- package/src/hooks/useVoiceInput.ts +3 -4
- package/src/index.ts +4 -5
- package/src/meta.ts +32 -7
- package/src/model/model.test.ts +22 -16
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +37 -24
- package/src/{segments-normalization → normalization}/normalization.test.ts +9 -48
- package/src/normalization/normalization.ts +76 -0
- package/src/{segments-normalization → normalization}/utils.ts +2 -2
- 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 +102 -0
- package/src/plugin.ts +11 -0
- package/src/stories/FileTranscription.stories.tsx +143 -0
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +50 -46
- 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 +53 -65
- package/src/transcriber/index.ts +1 -1
- package/src/transcriber/media-stream-recorder.ts +3 -3
- package/src/transcriber/transcriber.browser.test.ts +4 -5
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +105 -60
- package/src/transcriber/transcription-manager.ts +49 -59
- 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 -2
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/TranscriptContainer-FH7VAWYA.mjs +0 -11
- package/dist/lib/browser/chunk-5WH45KBY.mjs +0 -19
- package/dist/lib/browser/chunk-5WH45KBY.mjs.map +0 -7
- package/dist/lib/browser/chunk-BJWYA2BU.mjs +0 -782
- package/dist/lib/browser/chunk-BJWYA2BU.mjs.map +0 -7
- package/dist/lib/browser/chunk-KJIQQHJB.mjs.map +0 -7
- package/dist/lib/browser/chunk-KWOOVS5G.mjs +0 -55
- package/dist/lib/browser/chunk-KWOOVS5G.mjs.map +0 -7
- package/dist/lib/browser/chunk-SREIAQSP.mjs +0 -16
- package/dist/lib/browser/chunk-SREIAQSP.mjs.map +0 -7
- package/dist/lib/browser/chunk-UKUSJTQW.mjs +0 -8
- package/dist/lib/browser/chunk-UKUSJTQW.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -125
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs +0 -30
- package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-4MEJMKYQ.mjs +0 -34
- package/dist/lib/browser/react-surface-4MEJMKYQ.mjs.map +0 -7
- package/dist/lib/browser/transcriber-V77CN7XX.mjs +0 -56
- package/dist/lib/browser/transcriber-V77CN7XX.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node-esm/TranscriptContainer-GEUOOYHX.mjs +0 -12
- package/dist/lib/node-esm/chunk-A33GNR44.mjs +0 -507
- package/dist/lib/node-esm/chunk-A33GNR44.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IKQMDRY6.mjs +0 -56
- package/dist/lib/node-esm/chunk-IKQMDRY6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PHP7MCAY.mjs +0 -10
- package/dist/lib/node-esm/chunk-PHP7MCAY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TM2ASOZA.mjs +0 -17
- package/dist/lib/node-esm/chunk-TM2ASOZA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XMUCZBP3.mjs +0 -21
- package/dist/lib/node-esm/chunk-XMUCZBP3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y7PCJ34K.mjs +0 -783
- package/dist/lib/node-esm/chunk-Y7PCJ34K.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -126
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-EZUPNHUC.mjs +0 -35
- package/dist/lib/node-esm/react-surface-EZUPNHUC.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-3SX3DNLV.mjs +0 -57
- package/dist/lib/node-esm/transcriber-3SX3DNLV.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -15
- package/dist/types/src/capabilities/capabilities.d.ts +0 -17
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -24
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/index.d.ts +0 -2
- package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -19
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +0 -9
- package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +0 -17
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +0 -10
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +0 -19
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -11
- 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/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 -422
- 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 +0 -3
- package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -41
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -31
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -24
- package/src/components/Transcript/Transcript.stories.tsx +0 -243
- package/src/components/Transcript/Transcript.tsx +0 -101
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -36
- package/src/components/stories/FileTranscription.stories.tsx +0 -246
- package/src/components/stories/MicrophoneTranscription.stories.tsx +0 -283
- package/src/components/stories/TranscriptionStory.tsx +0 -41
- package/src/components/stories/useIsSpeaking.tsx +0 -40
- package/src/hooks/useQueueModelAdapter.ts +0 -66
- package/src/segments-normalization/normalization.ts +0 -115
- package/src/types/schema.ts +0 -41
- package/src/types/types.ts +0 -33
- package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- package/dist/lib/{browser/TranscriptContainer-FH7VAWYA.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- package/dist/lib/{node-esm/types → neutral/hooks}/index.mjs.map +0 -0
- package/dist/lib/{node-esm/TranscriptContainer-GEUOOYHX.mjs.map → neutral/index.mjs.map} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Events, IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { scheduleTask } from '@dxos/async';
|
|
13
|
-
import { Context } from '@dxos/context';
|
|
14
|
-
import { Obj } from '@dxos/echo';
|
|
15
|
-
import { MemoryQueue } from '@dxos/echo-db';
|
|
16
|
-
import { createQueueDXN } from '@dxos/echo-schema';
|
|
17
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
18
|
-
import { log } from '@dxos/log';
|
|
19
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
20
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
21
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
22
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
23
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
24
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
25
|
-
import { DataType } from '@dxos/schema';
|
|
26
|
-
import { Testing, seedTestData } from '@dxos/schema/testing';
|
|
27
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
28
|
-
|
|
29
|
-
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '../../hooks';
|
|
30
|
-
import { MessageNormalizer, getActorId } from '../../segments-normalization';
|
|
31
|
-
import { TestItem } from '../../testing';
|
|
32
|
-
import { type MediaStreamRecorderParams, type TranscriberParams } from '../../transcriber';
|
|
33
|
-
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
34
|
-
import { renderMarkdown } from '../Transcript';
|
|
35
|
-
|
|
36
|
-
import { TranscriptionStory } from './TranscriptionStory';
|
|
37
|
-
import { useIsSpeaking } from './useIsSpeaking';
|
|
38
|
-
|
|
39
|
-
const AudioFile = ({
|
|
40
|
-
detectSpeaking,
|
|
41
|
-
audioUrl,
|
|
42
|
-
normalizeSentences,
|
|
43
|
-
transcriberConfig,
|
|
44
|
-
recorderConfig,
|
|
45
|
-
audioConstraints,
|
|
46
|
-
}: {
|
|
47
|
-
detectSpeaking?: boolean;
|
|
48
|
-
normalizeSentences?: boolean;
|
|
49
|
-
audioUrl: string;
|
|
50
|
-
transcriberConfig?: TranscriberParams['config'];
|
|
51
|
-
recorderConfig?: MediaStreamRecorderParams['config'];
|
|
52
|
-
audioConstraints?: MediaTrackConstraints;
|
|
53
|
-
}) => {
|
|
54
|
-
const [running, setRunning] = useState(false);
|
|
55
|
-
const actor: DataType.Actor = useMemo(() => ({ name: 'You' }), []);
|
|
56
|
-
|
|
57
|
-
// Audio.
|
|
58
|
-
const { audio, track, stream } = useAudioFile(audioUrl, audioConstraints);
|
|
59
|
-
|
|
60
|
-
// Speaking.
|
|
61
|
-
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
62
|
-
const ref = useRef<HTMLAudioElement>(null);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (ref.current && stream) {
|
|
65
|
-
ref.current.srcObject = stream;
|
|
66
|
-
}
|
|
67
|
-
}, [stream]);
|
|
68
|
-
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (!audio) {
|
|
71
|
-
log.warn('no audio');
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (running) {
|
|
76
|
-
void audio.play();
|
|
77
|
-
} else {
|
|
78
|
-
void audio.pause();
|
|
79
|
-
}
|
|
80
|
-
}, [audio, running]);
|
|
81
|
-
|
|
82
|
-
// Transcriber.
|
|
83
|
-
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
84
|
-
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
85
|
-
const queue = useMemo(() => new MemoryQueue<DataType.Message>(queueDxn), [queueDxn]);
|
|
86
|
-
|
|
87
|
-
const model = useQueueModelAdapter(renderMarkdown([]), queue);
|
|
88
|
-
const handleSegments = useCallback<TranscriberParams['onSegments']>(
|
|
89
|
-
async (blocks) => {
|
|
90
|
-
void queue?.append([
|
|
91
|
-
Obj.make(DataType.Message, {
|
|
92
|
-
created: new Date().toISOString(),
|
|
93
|
-
sender: actor,
|
|
94
|
-
blocks,
|
|
95
|
-
}),
|
|
96
|
-
]);
|
|
97
|
-
},
|
|
98
|
-
[queue],
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const transcriber = useTranscriber({
|
|
102
|
-
audioStreamTrack: track,
|
|
103
|
-
onSegments: handleSegments,
|
|
104
|
-
transcriberConfig,
|
|
105
|
-
recorderConfig,
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// Normalize sentences.
|
|
109
|
-
const normalizer = useMemo(() => {
|
|
110
|
-
if (!normalizeSentences) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const executor = new FunctionExecutor(
|
|
114
|
-
new ServiceContainer().setServices({
|
|
115
|
-
// ai: {
|
|
116
|
-
// client: new Edge AiServiceClient({
|
|
117
|
-
// endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
118
|
-
// defaultGenerationOptions: {
|
|
119
|
-
// model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
120
|
-
// },
|
|
121
|
-
// }),
|
|
122
|
-
// },
|
|
123
|
-
}),
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
return new MessageNormalizer({
|
|
127
|
-
functionExecutor: executor,
|
|
128
|
-
queue,
|
|
129
|
-
startingCursor: { actorId: getActorId(actor), timestamp: new Date().toISOString() },
|
|
130
|
-
});
|
|
131
|
-
}, [normalizeSentences, queue, actor]);
|
|
132
|
-
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (!normalizer) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const ctx = new Context();
|
|
138
|
-
scheduleTask(ctx, async () => {
|
|
139
|
-
await normalizer.open();
|
|
140
|
-
ctx.onDispose(async () => {
|
|
141
|
-
await normalizer.close();
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
return () => {
|
|
145
|
-
void ctx.dispose();
|
|
146
|
-
};
|
|
147
|
-
}, [normalizer]);
|
|
148
|
-
|
|
149
|
-
const manageChunkRecording = () => {
|
|
150
|
-
if (running && isSpeaking) {
|
|
151
|
-
log.info('starting transcription');
|
|
152
|
-
transcriber?.startChunksRecording();
|
|
153
|
-
} else if (!isSpeaking || !running) {
|
|
154
|
-
log.info('stopping transcription');
|
|
155
|
-
transcriber?.stopChunksRecording();
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
const ctx = new Context();
|
|
161
|
-
scheduleTask(ctx, async () => {
|
|
162
|
-
if (transcriber && running) {
|
|
163
|
-
await transcriber.open();
|
|
164
|
-
} else if (!running) {
|
|
165
|
-
await transcriber?.close();
|
|
166
|
-
}
|
|
167
|
-
manageChunkRecording();
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
return () => {
|
|
171
|
-
void ctx.dispose();
|
|
172
|
-
};
|
|
173
|
-
}, [transcriber, running]);
|
|
174
|
-
|
|
175
|
-
useEffect(() => {
|
|
176
|
-
manageChunkRecording();
|
|
177
|
-
}, [isSpeaking, stream]);
|
|
178
|
-
|
|
179
|
-
return <TranscriptionStory model={model} running={running} onRunningChange={setRunning} audioRef={ref} />;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const meta: Meta<typeof AudioFile> = {
|
|
183
|
-
title: 'plugins/plugin-transcription/FileTranscription',
|
|
184
|
-
decorators: [
|
|
185
|
-
withPluginManager({
|
|
186
|
-
plugins: [
|
|
187
|
-
ThemePlugin({ tx: defaultTx }),
|
|
188
|
-
StorybookLayoutPlugin(),
|
|
189
|
-
ClientPlugin({
|
|
190
|
-
types: [TestItem, DataType.Person, DataType.Organization, Testing.DocumentType],
|
|
191
|
-
onClientInitialized: async ({ client }) => {
|
|
192
|
-
await client.halo.createIdentity();
|
|
193
|
-
await client.spaces.waitUntilReady();
|
|
194
|
-
await client.spaces.default.waitUntilReady();
|
|
195
|
-
await seedTestData(client.spaces.default);
|
|
196
|
-
},
|
|
197
|
-
}),
|
|
198
|
-
SpacePlugin(),
|
|
199
|
-
SettingsPlugin(),
|
|
200
|
-
PreviewPlugin(),
|
|
201
|
-
IntentPlugin(),
|
|
202
|
-
TranscriptionPlugin(),
|
|
203
|
-
],
|
|
204
|
-
fireEvents: [Events.SetupAppGraph],
|
|
205
|
-
}),
|
|
206
|
-
withTheme,
|
|
207
|
-
withLayout({ fullscreen: true, classNames: 'justify-center' }),
|
|
208
|
-
],
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export default meta;
|
|
212
|
-
|
|
213
|
-
const TRANSCRIBER_CONFIG = {
|
|
214
|
-
transcribeAfterChunksAmount: 100,
|
|
215
|
-
prefixBufferChunksAmount: 50,
|
|
216
|
-
normalizeSentences: true,
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const RECORDER_CONFIG = {
|
|
220
|
-
interval: 200,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
export const Default: StoryObj<typeof AudioFile> = {
|
|
224
|
-
render: AudioFile,
|
|
225
|
-
args: {
|
|
226
|
-
detectSpeaking: true,
|
|
227
|
-
// https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
|
|
228
|
-
audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
229
|
-
// textUrl: 'https://dxos.network/audio-london.txt',
|
|
230
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
231
|
-
recorderConfig: RECORDER_CONFIG,
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
|
|
236
|
-
render: AudioFile,
|
|
237
|
-
args: {
|
|
238
|
-
detectSpeaking: true,
|
|
239
|
-
normalizeSentences: true,
|
|
240
|
-
// https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
|
|
241
|
-
audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
242
|
-
// textUrl: 'https://dxos.network/audio-london.txt',
|
|
243
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
244
|
-
recorderConfig: RECORDER_CONFIG,
|
|
245
|
-
},
|
|
246
|
-
};
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Events, IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import {
|
|
13
|
-
type ExtractionFunction,
|
|
14
|
-
extractionAnthropicFn,
|
|
15
|
-
extractionNerFn,
|
|
16
|
-
getNer,
|
|
17
|
-
processTranscriptMessage,
|
|
18
|
-
} from '@dxos/assistant/extraction';
|
|
19
|
-
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
20
|
-
import { MemoryQueue } from '@dxos/echo-db';
|
|
21
|
-
import { createQueueDXN } from '@dxos/echo-schema';
|
|
22
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
23
|
-
import { invariant } from '@dxos/invariant';
|
|
24
|
-
import { log } from '@dxos/log';
|
|
25
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
26
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
27
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
28
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
29
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
30
|
-
import { IndexKind, useSpace } from '@dxos/react-client/echo';
|
|
31
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
32
|
-
import { DataType } from '@dxos/schema';
|
|
33
|
-
import { Testing, seedTestData } from '@dxos/schema/testing';
|
|
34
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
35
|
-
|
|
36
|
-
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '../../hooks';
|
|
37
|
-
import { TestItem } from '../../testing';
|
|
38
|
-
import { type MediaStreamRecorderParams, type TranscriberParams } from '../../transcriber';
|
|
39
|
-
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
40
|
-
import { renderMarkdown } from '../Transcript';
|
|
41
|
-
|
|
42
|
-
import { TranscriptionStory } from './TranscriptionStory';
|
|
43
|
-
import { useIsSpeaking } from './useIsSpeaking';
|
|
44
|
-
|
|
45
|
-
const TRANSCRIBER_CONFIG = {
|
|
46
|
-
transcribeAfterChunksAmount: 50,
|
|
47
|
-
prefixBufferChunksAmount: 10,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const RECORDER_CONFIG = {
|
|
51
|
-
interval: 200,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
type StoryProps = {
|
|
55
|
-
detectSpeaking?: boolean;
|
|
56
|
-
transcriberConfig: TranscriberParams['config'];
|
|
57
|
-
recorderConfig: MediaStreamRecorderParams['config'];
|
|
58
|
-
audioConstraints?: MediaTrackConstraints;
|
|
59
|
-
entityExtraction: 'none' | 'ner' | 'llm';
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const DefaultStory = ({
|
|
63
|
-
detectSpeaking,
|
|
64
|
-
entityExtraction = 'none',
|
|
65
|
-
transcriberConfig,
|
|
66
|
-
recorderConfig,
|
|
67
|
-
audioConstraints,
|
|
68
|
-
}: StoryProps) => {
|
|
69
|
-
const [running, setRunning] = useState(false);
|
|
70
|
-
|
|
71
|
-
// Audio.
|
|
72
|
-
const track = useAudioTrack(running, audioConstraints);
|
|
73
|
-
|
|
74
|
-
// Speaking.
|
|
75
|
-
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
76
|
-
|
|
77
|
-
// Queue.
|
|
78
|
-
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
79
|
-
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
80
|
-
const queue = useMemo(() => new MemoryQueue<DataType.Message>(queueDxn), [queueDxn]);
|
|
81
|
-
const model = useQueueModelAdapter(renderMarkdown([]), queue);
|
|
82
|
-
const space = useSpace();
|
|
83
|
-
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (!space) {
|
|
86
|
-
log.warn('no space');
|
|
87
|
-
}
|
|
88
|
-
}, [space]);
|
|
89
|
-
|
|
90
|
-
// Entity extraction.
|
|
91
|
-
const { extractionFunction, executor, objects } = useMemo(() => {
|
|
92
|
-
if (!space) {
|
|
93
|
-
log.warn('no space');
|
|
94
|
-
return {};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
let executor: FunctionExecutor | undefined;
|
|
98
|
-
let extractionFunction: ExtractionFunction | undefined;
|
|
99
|
-
let objects: Promise<Type.Expando[]> | undefined;
|
|
100
|
-
|
|
101
|
-
if (entityExtraction === 'ner') {
|
|
102
|
-
// Init model loading. Takes time.
|
|
103
|
-
void getNer();
|
|
104
|
-
extractionFunction = extractionNerFn;
|
|
105
|
-
} else if (entityExtraction === 'llm') {
|
|
106
|
-
extractionFunction = extractionAnthropicFn;
|
|
107
|
-
objects = space.db
|
|
108
|
-
.query(
|
|
109
|
-
Filter.or(
|
|
110
|
-
Filter.type(DataType.Person),
|
|
111
|
-
Filter.type(DataType.Organization),
|
|
112
|
-
Filter.type(Testing.DocumentType),
|
|
113
|
-
),
|
|
114
|
-
)
|
|
115
|
-
.run()
|
|
116
|
-
.then((result) => result.objects);
|
|
117
|
-
}
|
|
118
|
-
if (entityExtraction !== 'none') {
|
|
119
|
-
executor = new FunctionExecutor(
|
|
120
|
-
new ServiceContainer().setServices({
|
|
121
|
-
// ai: {
|
|
122
|
-
// client: new Edge AiServiceClient({
|
|
123
|
-
// endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
124
|
-
// }),
|
|
125
|
-
// },
|
|
126
|
-
// database: { db: space!.db },
|
|
127
|
-
}),
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return { extractionFunction, executor, objects };
|
|
132
|
-
}, [entityExtraction, space]);
|
|
133
|
-
|
|
134
|
-
// Transcriber.
|
|
135
|
-
const handleSegments = useCallback<TranscriberParams['onSegments']>(
|
|
136
|
-
async (blocks) => {
|
|
137
|
-
const message = Obj.make(DataType.Message, {
|
|
138
|
-
sender: { name: 'You' },
|
|
139
|
-
created: new Date().toISOString(),
|
|
140
|
-
blocks,
|
|
141
|
-
});
|
|
142
|
-
if (!space) {
|
|
143
|
-
void queue.append([message]);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (entityExtraction !== 'none') {
|
|
148
|
-
invariant(extractionFunction, 'extractionFunction is required');
|
|
149
|
-
invariant(executor, 'executor is required');
|
|
150
|
-
const result = await processTranscriptMessage({
|
|
151
|
-
executor,
|
|
152
|
-
function: extractionFunction,
|
|
153
|
-
input: {
|
|
154
|
-
message,
|
|
155
|
-
objects: await objects,
|
|
156
|
-
},
|
|
157
|
-
options: {
|
|
158
|
-
fallbackToRaw: true,
|
|
159
|
-
timeout: 30_000,
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
void queue.append([result.message]);
|
|
163
|
-
} else {
|
|
164
|
-
void queue.append([message]);
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
[queue, space],
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const transcriber = useTranscriber({
|
|
171
|
-
audioStreamTrack: track,
|
|
172
|
-
onSegments: handleSegments,
|
|
173
|
-
transcriberConfig,
|
|
174
|
-
recorderConfig,
|
|
175
|
-
});
|
|
176
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
void transcriber?.open().then(() => setIsOpen(true));
|
|
179
|
-
return () => {
|
|
180
|
-
void transcriber?.close().then(() => setIsOpen(false));
|
|
181
|
-
};
|
|
182
|
-
}, [transcriber]);
|
|
183
|
-
|
|
184
|
-
// Manage transcription state.
|
|
185
|
-
useEffect(() => {
|
|
186
|
-
if (running && transcriber?.isOpen && isSpeaking) {
|
|
187
|
-
transcriber?.startChunksRecording();
|
|
188
|
-
} else if (!running || !isSpeaking) {
|
|
189
|
-
transcriber?.stopChunksRecording();
|
|
190
|
-
}
|
|
191
|
-
}, [transcriber, running, isOpen, isSpeaking]);
|
|
192
|
-
|
|
193
|
-
return <TranscriptionStory model={model} running={running} onRunningChange={setRunning} />;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
const meta: Meta<typeof DefaultStory> = {
|
|
197
|
-
title: 'plugins/plugin-transcription/MicrophoneTranscription',
|
|
198
|
-
render: DefaultStory,
|
|
199
|
-
decorators: [
|
|
200
|
-
withPluginManager({
|
|
201
|
-
plugins: [
|
|
202
|
-
ThemePlugin({ tx: defaultTx }),
|
|
203
|
-
StorybookLayoutPlugin(),
|
|
204
|
-
ClientPlugin({
|
|
205
|
-
types: [TestItem, DataType.Person, DataType.Organization, Testing.DocumentType],
|
|
206
|
-
onClientInitialized: async ({ client }) => {
|
|
207
|
-
await client.halo.createIdentity();
|
|
208
|
-
await client.spaces.waitUntilReady();
|
|
209
|
-
await client.spaces.default.waitUntilReady();
|
|
210
|
-
// TODO(mykola): Make API easier to use.
|
|
211
|
-
// TODO(mykola): Delete after enabling vector indexing by default.
|
|
212
|
-
// Enable vector indexing.
|
|
213
|
-
await client.services.services.QueryService!.setConfig({
|
|
214
|
-
enabled: true,
|
|
215
|
-
indexes: [
|
|
216
|
-
//
|
|
217
|
-
{ kind: IndexKind.Kind.SCHEMA_MATCH },
|
|
218
|
-
{ kind: IndexKind.Kind.GRAPH },
|
|
219
|
-
{ kind: IndexKind.Kind.VECTOR },
|
|
220
|
-
],
|
|
221
|
-
});
|
|
222
|
-
await client.services.services.QueryService!.reindex();
|
|
223
|
-
await seedTestData(client.spaces.default);
|
|
224
|
-
},
|
|
225
|
-
}),
|
|
226
|
-
SpacePlugin(),
|
|
227
|
-
SettingsPlugin(),
|
|
228
|
-
PreviewPlugin(),
|
|
229
|
-
IntentPlugin(),
|
|
230
|
-
TranscriptionPlugin(),
|
|
231
|
-
],
|
|
232
|
-
fireEvents: [Events.SetupAppGraph],
|
|
233
|
-
}),
|
|
234
|
-
withTheme,
|
|
235
|
-
withLayout({ fullscreen: true, classNames: 'justify-center' }),
|
|
236
|
-
],
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
export default meta;
|
|
240
|
-
|
|
241
|
-
type Story = StoryObj<typeof DefaultStory>;
|
|
242
|
-
|
|
243
|
-
export const Default: Story = {
|
|
244
|
-
args: {
|
|
245
|
-
detectSpeaking: false,
|
|
246
|
-
entityExtraction: 'none',
|
|
247
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
248
|
-
recorderConfig: RECORDER_CONFIG,
|
|
249
|
-
audioConstraints: {
|
|
250
|
-
echoCancellation: false,
|
|
251
|
-
noiseSuppression: false,
|
|
252
|
-
autoGainControl: false,
|
|
253
|
-
},
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
export const EntityExtraction: Story = {
|
|
258
|
-
args: {
|
|
259
|
-
detectSpeaking: true,
|
|
260
|
-
entityExtraction: 'ner',
|
|
261
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
262
|
-
recorderConfig: RECORDER_CONFIG,
|
|
263
|
-
audioConstraints: {
|
|
264
|
-
echoCancellation: true,
|
|
265
|
-
noiseSuppression: true,
|
|
266
|
-
autoGainControl: true,
|
|
267
|
-
},
|
|
268
|
-
},
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
export const SpeechDetection: Story = {
|
|
272
|
-
args: {
|
|
273
|
-
detectSpeaking: true,
|
|
274
|
-
entityExtraction: 'none',
|
|
275
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
276
|
-
recorderConfig: RECORDER_CONFIG,
|
|
277
|
-
audioConstraints: {
|
|
278
|
-
echoCancellation: true,
|
|
279
|
-
noiseSuppression: true,
|
|
280
|
-
autoGainControl: true,
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import React, { type Dispatch, type FC, type RefObject, type SetStateAction } from 'react';
|
|
8
|
-
|
|
9
|
-
import { useSpace } from '@dxos/react-client/echo';
|
|
10
|
-
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
11
|
-
import { ScrollContainer } from '@dxos/react-ui-components';
|
|
12
|
-
import { type DataType } from '@dxos/schema';
|
|
13
|
-
|
|
14
|
-
import { type SerializationModel } from '../../model';
|
|
15
|
-
import { Transcript } from '../Transcript';
|
|
16
|
-
|
|
17
|
-
export const TranscriptionStory: FC<{
|
|
18
|
-
model: SerializationModel<DataType.Message>;
|
|
19
|
-
running: boolean;
|
|
20
|
-
onRunningChange: Dispatch<SetStateAction<boolean>>;
|
|
21
|
-
audioRef?: RefObject<HTMLAudioElement>;
|
|
22
|
-
}> = ({ model, running, onRunningChange, audioRef }) => {
|
|
23
|
-
const space = useSpace();
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div className='flex flex-col w-[30rem]'>
|
|
27
|
-
{audioRef && <audio ref={audioRef} autoPlay />}
|
|
28
|
-
<Toolbar.Root>
|
|
29
|
-
<IconButton
|
|
30
|
-
iconOnly
|
|
31
|
-
icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
|
|
32
|
-
label={running ? 'Pause' : 'Play'}
|
|
33
|
-
onClick={() => onRunningChange((running) => !running)}
|
|
34
|
-
/>
|
|
35
|
-
</Toolbar.Root>
|
|
36
|
-
<ScrollContainer>
|
|
37
|
-
<Transcript space={space} model={model} attendableId='story' />
|
|
38
|
-
</ScrollContainer>
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import { scheduleTask } from '@dxos/async';
|
|
10
|
-
import { Context } from '@dxos/context';
|
|
11
|
-
import { SpeakingMonitor } from '@dxos/plugin-thread';
|
|
12
|
-
|
|
13
|
-
export const useIsSpeaking = (track?: MediaStreamTrack) => {
|
|
14
|
-
const [isSpeaking, setIsSpeaking] = useState(false);
|
|
15
|
-
const speakingMonitor = useMemo(() => {
|
|
16
|
-
if (!track) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
return new SpeakingMonitor(track);
|
|
20
|
-
}, [track]);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (!speakingMonitor) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const ctx = new Context();
|
|
28
|
-
scheduleTask(ctx, async () => {
|
|
29
|
-
speakingMonitor.speakingChanged.on(ctx, () => setIsSpeaking(speakingMonitor.isSpeaking));
|
|
30
|
-
await speakingMonitor.open();
|
|
31
|
-
ctx.onDispose(() => speakingMonitor.close());
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return () => {
|
|
35
|
-
void ctx.dispose();
|
|
36
|
-
};
|
|
37
|
-
}, [speakingMonitor]);
|
|
38
|
-
|
|
39
|
-
return isSpeaking;
|
|
40
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import type { Obj } from '@dxos/echo';
|
|
8
|
-
import { type Queue } from '@dxos/react-client/echo';
|
|
9
|
-
|
|
10
|
-
import { type ChunkRenderer, SerializationModel } from '../model';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Model adapter for a queue.
|
|
14
|
-
*/
|
|
15
|
-
export const useQueueModelAdapter = <T extends Obj.Any>(
|
|
16
|
-
renderer: ChunkRenderer<T>,
|
|
17
|
-
queue: Queue<T> | undefined,
|
|
18
|
-
initialChunks: T[] = [],
|
|
19
|
-
): SerializationModel<T> => {
|
|
20
|
-
const model = useMemo(() => new SerializationModel<T>(renderer, initialChunks), [queue]);
|
|
21
|
-
const [loaded, setLoaded] = useState(false);
|
|
22
|
-
|
|
23
|
-
// Set initial blocks.
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (!queue) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const update = () => {
|
|
30
|
-
for (const block of queue?.objects ?? []) {
|
|
31
|
-
model.appendChunk(block);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
setLoaded(true);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// TODO(burdon): This is a hack to ensure the queue is loaded.
|
|
38
|
-
let i: NodeJS.Timeout | undefined;
|
|
39
|
-
if (queue.isLoading) {
|
|
40
|
-
i = setInterval(() => {
|
|
41
|
-
if (!queue?.isLoading) {
|
|
42
|
-
clearInterval(i);
|
|
43
|
-
update();
|
|
44
|
-
}
|
|
45
|
-
}, 1_000);
|
|
46
|
-
} else {
|
|
47
|
-
update();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return () => clearTimeout(i);
|
|
51
|
-
}, [model, queue]);
|
|
52
|
-
|
|
53
|
-
// TODO(burdon): Can we listen for queue events?
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (!loaded || !queue || model.chunks.length === queue.objects.length) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const chunk = queue.objects.at(-1);
|
|
60
|
-
if (chunk) {
|
|
61
|
-
model.appendChunk(chunk);
|
|
62
|
-
}
|
|
63
|
-
}, [model, loaded, queue?.objects.length]);
|
|
64
|
-
|
|
65
|
-
return model;
|
|
66
|
-
};
|