@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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Feed, Ref } from '@dxos/echo';
|
|
9
|
+
import { Transcript } from '@dxos/types';
|
|
10
|
+
|
|
11
|
+
import { TranscriptOperation } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof TranscriptOperation.Create> = TranscriptOperation.Create.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fn(function* ({ space }) {
|
|
16
|
+
const feed = space.db.add(Feed.make());
|
|
17
|
+
return {
|
|
18
|
+
object: Transcript.make(Ref.make(feed)),
|
|
19
|
+
};
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default handler;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export const TranscriptionOperationHandlerSet = OperationHandlerSet.lazy(
|
|
8
|
+
() => import('./create'),
|
|
9
|
+
() => import('./open'),
|
|
10
|
+
() => import('./summarize'),
|
|
11
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Database, Feed, Filter } from '@dxos/echo';
|
|
9
|
+
import { Message } from '@dxos/types';
|
|
10
|
+
|
|
11
|
+
import { TranscriptOperation } from '../types';
|
|
12
|
+
import { renderByline } from '../util';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof TranscriptOperation.Open> = TranscriptOperation.Open.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fn(function* ({ transcript }) {
|
|
17
|
+
const transcriptObj = yield* Database.load(transcript);
|
|
18
|
+
const feed = yield* Database.load(transcriptObj.feed);
|
|
19
|
+
const messages = yield* Feed.runQuery(feed, Filter.type(Message.Message));
|
|
20
|
+
const content = messages
|
|
21
|
+
.flatMap((message: Message.Message, index: number) => renderByline([])(message, index))
|
|
22
|
+
.join('\n\n');
|
|
23
|
+
return { content };
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export default handler;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Function from 'effect/Function';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import * as Option from 'effect/Option';
|
|
10
|
+
|
|
11
|
+
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
12
|
+
import { AiRequest, GenerationObserver } from '@dxos/assistant';
|
|
13
|
+
import { Trace, Operation } from '@dxos/compute';
|
|
14
|
+
import { Database } from '@dxos/echo';
|
|
15
|
+
import { registryLayerNoop } from '@dxos/echo/testing';
|
|
16
|
+
import { trim } from '@dxos/util';
|
|
17
|
+
|
|
18
|
+
import { TranscriptOperation } from '../types';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Summarize a transcript of a meeting.
|
|
22
|
+
*/
|
|
23
|
+
const handler: Operation.WithHandler<typeof TranscriptOperation.Summarize> = TranscriptOperation.Summarize.pipe(
|
|
24
|
+
Operation.withHandler(
|
|
25
|
+
Effect.fnUntraced(
|
|
26
|
+
function* ({ transcript, notes }) {
|
|
27
|
+
const result = yield* new AiRequest.Request({
|
|
28
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
|
|
29
|
+
}).run({
|
|
30
|
+
prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
|
|
31
|
+
history: [],
|
|
32
|
+
system: systemPrompt,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const summary = Function.pipe(
|
|
36
|
+
result,
|
|
37
|
+
Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
|
|
38
|
+
Option.flatMap((msg) =>
|
|
39
|
+
Function.pipe(
|
|
40
|
+
msg.blocks,
|
|
41
|
+
Array.findLast((block) => block._tag === 'text'),
|
|
42
|
+
Option.map((block) => block.text),
|
|
43
|
+
),
|
|
44
|
+
),
|
|
45
|
+
Option.getOrThrowWith(() => new Error('No summary found')),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return { summary };
|
|
49
|
+
},
|
|
50
|
+
Effect.provide(
|
|
51
|
+
Layer.mergeAll(
|
|
52
|
+
AiService.model('ai.claude.model.claude-sonnet-4-0'),
|
|
53
|
+
ToolResolverService.layerEmpty,
|
|
54
|
+
ToolExecutionService.layerEmpty,
|
|
55
|
+
Trace.writerLayerNoop,
|
|
56
|
+
Database.notAvailable,
|
|
57
|
+
Layer.succeed(Operation.Service, {
|
|
58
|
+
invoke: () => Effect.die('Not available.'),
|
|
59
|
+
schedule: () => Effect.die('Not available.'),
|
|
60
|
+
invokePromise: async () => ({ error: new Error('Not available.') }),
|
|
61
|
+
} as any),
|
|
62
|
+
registryLayerNoop,
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
export default handler;
|
|
70
|
+
|
|
71
|
+
const systemPrompt = trim`
|
|
72
|
+
You are a helpful assistant that summarizes transcripts of meetings.
|
|
73
|
+
|
|
74
|
+
# Goal
|
|
75
|
+
Create a markdown summary of the meeting transcript with text notes provided.
|
|
76
|
+
Notes are very important so make sure to include them in the summary if they contain meaningful information.
|
|
77
|
+
|
|
78
|
+
# Formatting
|
|
79
|
+
- Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
|
|
80
|
+
- Use markdown formatting for headings and bullet points.
|
|
81
|
+
- Format the summary as a list of key points and takeaways.
|
|
82
|
+
- All names of people should be in bold.
|
|
83
|
+
|
|
84
|
+
# Note Taking
|
|
85
|
+
- Correlate items in the summary with the person of origin to build a coherent narrative.
|
|
86
|
+
- Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
|
|
87
|
+
|
|
88
|
+
# Tasks
|
|
89
|
+
At the end of the summary include tasks.
|
|
90
|
+
Extract only the tasks that are:
|
|
91
|
+
- Directly actionable.
|
|
92
|
+
- Clearly assigned to a person or team (or can easily be inferred).
|
|
93
|
+
- Strongly implied by the conversation and/or user note (no speculative tasks).
|
|
94
|
+
- Specific enough that someone reading them would know exactly what to do next.
|
|
95
|
+
|
|
96
|
+
Format all tasks as markdown checkboxes using the syntax:
|
|
97
|
+
- [ ] Task description.
|
|
98
|
+
|
|
99
|
+
Additional information can be included (indented).
|
|
100
|
+
|
|
101
|
+
If no actionable tasks are found, omit this tasks section.
|
|
102
|
+
`;
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const TranscriptionPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { TranscriptionOperationHandlerSet } from './operations';
|
|
@@ -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
|
+
// };
|
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { log } from '@dxos/log';
|
|
11
|
-
import { Toolbar } from '@dxos/react-ui';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
import { mx } from '@dxos/ui-theme';
|
|
14
12
|
|
|
15
13
|
type Word = {
|
|
16
14
|
text: string;
|
|
17
15
|
matched: boolean;
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
type DefaultStoryProps = {
|
|
19
|
+
keywords: string[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const DefaultStory = ({ keywords }: DefaultStoryProps) => {
|
|
21
23
|
const [running, setRunning] = useState(false);
|
|
22
24
|
const [matchingWords, setMatchingWords] = useState<Word[]>(keywords.map((word) => ({ text: word, matched: false })));
|
|
23
25
|
|
|
24
|
-
const [transcript, setTranscript] = useState('');
|
|
25
26
|
const recognition = useMemo(() => {
|
|
26
27
|
// TODO(mykola): Fix types
|
|
27
28
|
const SpeechRecognition = (window as any).SpeechRecognition || (window as any).webkitSpeechRecognition;
|
|
@@ -36,16 +37,16 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
|
|
|
36
37
|
recognition.interimResults = true;
|
|
37
38
|
recognition.lang = 'en-US';
|
|
38
39
|
recognition.maxAlternatives = 1;
|
|
39
|
-
// Add this line to enable punctuation
|
|
40
|
+
// Add this line to enable punctuation.
|
|
40
41
|
recognition.grammars = new SpeechGrammarList();
|
|
41
42
|
|
|
42
|
-
// TODO(mykola): Fix types
|
|
43
|
+
// TODO(mykola): Fix types.
|
|
43
44
|
recognition.onresult = (event: any) => {
|
|
44
45
|
log.info('recognition result', { event });
|
|
45
46
|
const current = event.resultIndex;
|
|
46
47
|
const transcript = event.results[current][0].transcript;
|
|
47
48
|
|
|
48
|
-
// Remove punctuation and normalize whitespace for comparison
|
|
49
|
+
// Remove punctuation and normalize whitespace for comparison.
|
|
49
50
|
const normalizeText = (text: string) =>
|
|
50
51
|
text
|
|
51
52
|
.toLowerCase()
|
|
@@ -55,7 +56,7 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
|
|
|
55
56
|
|
|
56
57
|
const normalizedTranscript = normalizeText(transcript);
|
|
57
58
|
|
|
58
|
-
// Check each keyword and update matching words
|
|
59
|
+
// Check each keyword and update matching words.
|
|
59
60
|
const updatedWords = matchingWords.map((word) => {
|
|
60
61
|
const normalizedKeyword = normalizeText(word.text);
|
|
61
62
|
const matched = normalizedTranscript.includes(normalizedKeyword);
|
|
@@ -63,10 +64,9 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
|
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
setMatchingWords(updatedWords);
|
|
66
|
-
setTranscript(transcript);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
// TODO(mykola): Fix types
|
|
69
|
+
// TODO(mykola): Fix types.
|
|
70
70
|
recognition.onerror = (event: any) => {
|
|
71
71
|
log.error('Speech recognition error:', { error: event.error });
|
|
72
72
|
setRunning(false);
|
|
@@ -84,45 +84,49 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
|
|
|
84
84
|
}, [running, recognition]);
|
|
85
85
|
|
|
86
86
|
return (
|
|
87
|
-
<
|
|
88
|
-
<Toolbar
|
|
89
|
-
<Toolbar.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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>
|
|
113
115
|
);
|
|
114
116
|
};
|
|
115
117
|
|
|
116
|
-
const meta
|
|
117
|
-
title: 'plugins/plugin-transcription/KeyWordDetection',
|
|
118
|
-
|
|
119
|
-
}
|
|
118
|
+
const meta = {
|
|
119
|
+
title: 'plugins/plugin-transcription/stories/KeyWordDetection',
|
|
120
|
+
render: DefaultStory,
|
|
121
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
122
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
120
123
|
|
|
121
124
|
export default meta;
|
|
122
125
|
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
type Story = StoryObj<typeof meta>;
|
|
127
|
+
|
|
128
|
+
export const SpeechRecognitionAPI: Story = {
|
|
125
129
|
args: {
|
|
126
|
-
keywords: ['kai', 'computer', 'hello'],
|
|
130
|
+
keywords: ['kai', 'computer', 'hello', 'dxos'],
|
|
127
131
|
},
|
|
128
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
|
+
// };
|