@dxos/plugin-transcription 0.8.3 → 0.8.4-main.1c7ec43d41
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/dist/lib/browser/blueprints/index.mjs +31 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-3L623EVL.mjs +17 -0
- package/dist/lib/browser/chunk-3L623EVL.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-KAEXRX3Y.mjs +35 -0
- package/dist/lib/browser/chunk-KAEXRX3Y.mjs.map +7 -0
- package/dist/lib/browser/chunk-L4HW35L6.mjs +111 -0
- package/dist/lib/browser/chunk-L4HW35L6.mjs.map +7 -0
- package/dist/lib/browser/chunk-MLRJWAQH.mjs +179 -0
- package/dist/lib/browser/chunk-MLRJWAQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-NQQK7UZQ.mjs +244 -0
- package/dist/lib/browser/chunk-NQQK7UZQ.mjs.map +7 -0
- package/dist/lib/browser/components/index.mjs +207 -0
- package/dist/lib/browser/components/index.mjs.map +7 -0
- package/dist/lib/browser/create-ULR5DPJZ.mjs +21 -0
- package/dist/lib/browser/create-ULR5DPJZ.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +17 -0
- package/dist/lib/browser/index.mjs +442 -94
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-SFMPLZVW.mjs +27 -0
- package/dist/lib/browser/open-SFMPLZVW.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/summarize-BDFX4APN.mjs +78 -0
- package/dist/lib/browser/summarize-BDFX4APN.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -8
- package/dist/lib/node-esm/blueprints/index.mjs +32 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7UIZWCD4.mjs +112 -0
- package/dist/lib/node-esm/chunk-7UIZWCD4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs +181 -0
- package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KO3IOD2O.mjs +19 -0
- package/dist/lib/node-esm/chunk-KO3IOD2O.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MQK4R6GT.mjs +245 -0
- package/dist/lib/node-esm/chunk-MQK4R6GT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-O533NBMK.mjs +37 -0
- package/dist/lib/node-esm/chunk-O533NBMK.mjs.map +7 -0
- package/dist/lib/node-esm/components/index.mjs +208 -0
- package/dist/lib/node-esm/components/index.mjs.map +7 -0
- package/dist/lib/node-esm/create-A5QHNWRF.mjs +22 -0
- package/dist/lib/node-esm/create-A5QHNWRF.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +18 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +442 -94
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-OI24QNTO.mjs +28 -0
- package/dist/lib/node-esm/open-OI24QNTO.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/summarize-3UNN24I2.mjs +79 -0
- package/dist/lib/node-esm/summarize-3UNN24I2.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -8
- 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/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 +10 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +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/Transcription/Transcription.d.ts +18 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +40 -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 +1 -6
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +6 -0
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts +2 -0
- package/dist/types/src/containers/TranscriptionContainer/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/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
- 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/useVoiceInput.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +4 -4
- 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 +5 -5
- package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.d.ts +364 -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/definitions.d.ts +917 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -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/stories/FileTranscription.stories.d.ts +18 -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/MicrophoneTranscription.stories.d.ts +20 -0
- package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts +23 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
- package/dist/types/src/stories/useIsSpeaking.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +10 -10
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +3 -3
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +60 -5
- 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 +12 -13
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +19 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +5 -0
- package/dist/types/src/types/defs.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 +127 -82
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +22 -61
- 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 +11 -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 -42
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +78 -73
- package/src/components/Transcription/Transcription.tsx +64 -0
- package/src/components/{Transcript → Transcription}/index.ts +1 -1
- package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +15 -48
- package/src/components/index.ts +1 -6
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +35 -0
- package/src/containers/TranscriptionContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useAudioFile.ts +49 -53
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +15 -7
- package/src/hooks/useVoiceInput.ts +3 -3
- package/src/index.ts +10 -5
- package/src/meta.ts +9 -6
- package/src/model/model.test.ts +27 -21
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +20 -19
- package/src/{segments-normalization → normalization}/normalization.test.ts +26 -33
- package/src/normalization/normalization.ts +77 -0
- package/src/{segments-normalization → normalization}/utils.ts +2 -2
- package/src/operations/create.ts +24 -0
- package/src/operations/definitions.ts +101 -0
- package/src/operations/index.ts +13 -0
- package/src/operations/open.ts +28 -0
- package/src/operations/summarize.ts +101 -0
- package/src/{components/stories → stories}/FileTranscription.stories.tsx +99 -72
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +46 -40
- package/src/{components/stories → stories}/MicrophoneTranscription.stories.tsx +85 -101
- package/src/stories/TranscriptionStory.tsx +93 -0
- package/src/testing/testing.ts +41 -41
- package/src/transcriber/media-stream-recorder.ts +4 -4
- package/src/transcriber/transcriber.browser.test.ts +5 -5
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +101 -62
- package/src/transcriber/transcription-manager.ts +37 -52
- package/src/translations.ts +12 -10
- package/src/types/capabilities.ts +39 -0
- package/src/types/defs.ts +9 -0
- package/src/types/index.ts +2 -2
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-H3AZQ4CQ.mjs +0 -11
- package/dist/lib/browser/chunk-53AXUEIQ.mjs +0 -764
- package/dist/lib/browser/chunk-53AXUEIQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-GOF7MJNV.mjs +0 -19
- package/dist/lib/browser/chunk-GOF7MJNV.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs +0 -495
- package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-OSISJM2F.mjs +0 -55
- package/dist/lib/browser/chunk-OSISJM2F.mjs.map +0 -7
- package/dist/lib/browser/chunk-UDCCT32F.mjs +0 -8
- package/dist/lib/browser/chunk-UDCCT32F.mjs.map +0 -7
- package/dist/lib/browser/chunk-W2KNYJD6.mjs +0 -16
- package/dist/lib/browser/chunk-W2KNYJD6.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BGADCHVM.mjs +0 -30
- package/dist/lib/browser/intent-resolver-BGADCHVM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HMJS5FSS.mjs +0 -34
- package/dist/lib/browser/react-surface-HMJS5FSS.mjs.map +0 -7
- package/dist/lib/browser/transcriber-OYPLZFG5.mjs +0 -56
- package/dist/lib/browser/transcriber-OYPLZFG5.mjs.map +0 -7
- package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs +0 -32
- package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs.map +0 -7
- package/dist/lib/node/chunk-3PYT3BDM.cjs +0 -40
- package/dist/lib/node/chunk-3PYT3BDM.cjs.map +0 -7
- package/dist/lib/node/chunk-6LW5RA3K.cjs +0 -75
- package/dist/lib/node/chunk-6LW5RA3K.cjs.map +0 -7
- package/dist/lib/node/chunk-AFUZI63A.cjs +0 -42
- package/dist/lib/node/chunk-AFUZI63A.cjs.map +0 -7
- package/dist/lib/node/chunk-CVUN3UO7.cjs +0 -778
- package/dist/lib/node/chunk-CVUN3UO7.cjs.map +0 -7
- package/dist/lib/node/chunk-FKDJNJ57.cjs +0 -35
- package/dist/lib/node/chunk-FKDJNJ57.cjs.map +0 -7
- package/dist/lib/node/chunk-ZFAUMZXE.cjs +0 -518
- package/dist/lib/node/chunk-ZFAUMZXE.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -133
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-LL3TTI4H.cjs +0 -45
- package/dist/lib/node/intent-resolver-LL3TTI4H.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-N25TBBG4.cjs +0 -56
- package/dist/lib/node/react-surface-N25TBBG4.cjs.map +0 -7
- package/dist/lib/node/transcriber-6J4FVFSZ.cjs +0 -68
- package/dist/lib/node/transcriber-6J4FVFSZ.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -36
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/TranscriptContainer-G75LDEO5.mjs +0 -12
- package/dist/lib/node-esm/chunk-56QHOX4A.mjs +0 -765
- package/dist/lib/node-esm/chunk-56QHOX4A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FH75X4JC.mjs +0 -56
- package/dist/lib/node-esm/chunk-FH75X4JC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MFJO7EKD.mjs +0 -10
- package/dist/lib/node-esm/chunk-MFJO7EKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs +0 -17
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PRL64SRU.mjs +0 -496
- package/dist/lib/node-esm/chunk-PRL64SRU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TXMDLLBR.mjs +0 -21
- package/dist/lib/node-esm/chunk-TXMDLLBR.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs +0 -35
- package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs +0 -57
- package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs.map +0 -7
- 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 -8
- 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.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 -329
- 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.tsx +0 -100
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -30
- package/src/components/stories/TranscriptionStory.tsx +0 -41
- package/src/segments-normalization/normalization.ts +0 -105
- package/src/types/schema.ts +0 -41
- package/src/types/types.ts +0 -32
- package/dist/lib/browser/{TranscriptContainer-H3AZQ4CQ.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- package/dist/lib/{node-esm/TranscriptContainer-G75LDEO5.mjs.map → browser/hooks/index.mjs.map} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/dist/types/src/{components/stories → stories}/useIsSpeaking.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
- /package/src/{components/stories → stories}/useIsSpeaking.tsx +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { trim } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
SentenceNormalization,
|
|
14
|
+
SentenceNormalizationOutput,
|
|
15
|
+
type MessageWithRangeIdType,
|
|
16
|
+
type SentenceNormalizationInputType,
|
|
17
|
+
} from '../operations/definitions';
|
|
18
|
+
|
|
19
|
+
export type MessageWithRangeId = MessageWithRangeIdType;
|
|
20
|
+
|
|
21
|
+
/** @deprecated Use SentenceNormalizationInputType */
|
|
22
|
+
export type NormalizationInput = SentenceNormalizationInputType;
|
|
23
|
+
|
|
24
|
+
/** @deprecated Use SentenceNormalizationOutput */
|
|
25
|
+
export type NormalizationOutput = Schema.Schema.Type<typeof SentenceNormalizationOutput>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Sentence normalization for transcription.
|
|
29
|
+
* TODO(dmaretskyi): Reimplement using AiRequest.run or LanguageModel.generateObject - runStructured was removed.
|
|
30
|
+
*/
|
|
31
|
+
export const sentenceNormalization = SentenceNormalization.pipe(
|
|
32
|
+
Operation.withHandler(
|
|
33
|
+
Effect.fn(function* ({ messages }) {
|
|
34
|
+
log.info('input', { messages });
|
|
35
|
+
// TODO(dmaretskyi): runStructured was removed from AiRequest. Reimplement using new API.
|
|
36
|
+
return yield* Effect.die(
|
|
37
|
+
new Error(
|
|
38
|
+
'Sentence normalization needs to be reimplemented - runStructured was removed from AiRequest. Use AiRequest.run or LanguageModel.generateObject.',
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const _unused = trim`
|
|
46
|
+
You are observing a real-time transcript of a single person speaking.
|
|
47
|
+
The transcription is delivered in chunks of 10 seconds or less. As a result, individual sentences may be split across multiple messages, or multiple sentences may appear within a single message. Additionally, because this is real-time transcription, punctuation and capitalization may be incorrect or missing.
|
|
48
|
+
|
|
49
|
+
# Task Description:
|
|
50
|
+
- Your task is to detect and reconstruct broken or incomplete sentences by merging segments into coherent, grammatically correct sentences where appropriate.
|
|
51
|
+
|
|
52
|
+
# Input Format:
|
|
53
|
+
- The input is an array of messages that contain transcription blocks.
|
|
54
|
+
- Each message is a Message.Message, as described in the output format.
|
|
55
|
+
|
|
56
|
+
# Output Format:
|
|
57
|
+
- You have been provided with the tool that defines the output format; make sure to query it.
|
|
58
|
+
- Do not output anything other than the expected format.
|
|
59
|
+
|
|
60
|
+
# Segment Handling Rules:
|
|
61
|
+
- Sort messages by timestamp.
|
|
62
|
+
- Leave ID of the first message in a sentence.
|
|
63
|
+
- Each divided sentence should be added to the output as a separate message or block within existing messages, preserving the original order.
|
|
64
|
+
- If one message contains multiple sentences, you should not split them.
|
|
65
|
+
- The last sentence may be incomplete; it should still be output as a separate block or message.
|
|
66
|
+
- Keep track of the original timestamps of the messages and blocks and, use the timestamp of the first message/block of a sentence as the 'started' field of the merged message.
|
|
67
|
+
- The 'rangeId' field of the merged message should include 'messageId'-s and 'rangeId'-s of all messages that have been used to construct this message.
|
|
68
|
+
|
|
69
|
+
# Punctuation and Capitalization:
|
|
70
|
+
- Do not rely on the original punctuation and capitalization—they may be incorrect.
|
|
71
|
+
- Use logical reasoning to apply appropriate punctuation (e.g., period, comma, question mark, exclamation mark) and capitalization.
|
|
72
|
+
|
|
73
|
+
# Restrictions:
|
|
74
|
+
- Do not alter the order of the original messages; maintain the natural flow of speech.
|
|
75
|
+
- Do not interpret or infer meaning beyond reconstructing sentences.
|
|
76
|
+
- Do not add or remove any words or phrases.
|
|
77
|
+
`;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Actor } from '@dxos/types';
|
|
6
6
|
|
|
7
|
-
export const getActorId = (actor:
|
|
7
|
+
export const getActorId = (actor: Actor.Actor) => {
|
|
8
8
|
return actor.identityDid || actor.identityKey || actor.email || actor.name || '';
|
|
9
9
|
};
|
|
@@ -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 { Create } from './definitions';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof Create> = 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,101 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { AiService } from '@dxos/ai';
|
|
8
|
+
import { SpaceSchema } from '@dxos/client/echo';
|
|
9
|
+
import { Operation } from '@dxos/compute';
|
|
10
|
+
import { Database, Feed, Ref } from '@dxos/echo';
|
|
11
|
+
import { Message, Transcript } from '@dxos/types';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
const TRANSCRIPT_OPERATION = `${meta.id}.operation`;
|
|
16
|
+
|
|
17
|
+
export const Create = Operation.make({
|
|
18
|
+
meta: { key: `${TRANSCRIPT_OPERATION}.create`, name: 'Create Transcript' },
|
|
19
|
+
input: Schema.Struct({
|
|
20
|
+
name: Schema.optional(Schema.String),
|
|
21
|
+
space: SpaceSchema,
|
|
22
|
+
}),
|
|
23
|
+
output: Schema.Struct({
|
|
24
|
+
object: Transcript.Transcript,
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const MessageWithRangeId = Schema.extend(
|
|
29
|
+
Message.Message,
|
|
30
|
+
Schema.Struct({
|
|
31
|
+
rangeId: Schema.optional(Schema.Array(Schema.String)).annotations({
|
|
32
|
+
description: 'The IDs of the messages that contain the sentences.',
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export type MessageWithRangeIdType = Schema.Schema.Type<typeof MessageWithRangeId>;
|
|
38
|
+
|
|
39
|
+
export const Open = Operation.make({
|
|
40
|
+
meta: {
|
|
41
|
+
key: 'org.dxos.function.transcription.open',
|
|
42
|
+
name: 'Open',
|
|
43
|
+
description: 'Opens and reads the contents of a transcription object.',
|
|
44
|
+
},
|
|
45
|
+
input: Schema.Struct({
|
|
46
|
+
transcript: Ref.Ref(Transcript.Transcript).annotations({
|
|
47
|
+
description: 'The ID of the transcription object.',
|
|
48
|
+
}),
|
|
49
|
+
}),
|
|
50
|
+
output: Schema.Struct({
|
|
51
|
+
content: Schema.String,
|
|
52
|
+
}),
|
|
53
|
+
services: [Database.Service, Feed.FeedService],
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const Summarize = Operation.make({
|
|
57
|
+
meta: {
|
|
58
|
+
key: 'org.dxos.function.transcription.summarize',
|
|
59
|
+
name: 'Summarize',
|
|
60
|
+
description: 'Summarize a transcript of a meeting.',
|
|
61
|
+
},
|
|
62
|
+
input: Schema.Struct({
|
|
63
|
+
transcript: Schema.String.annotations({
|
|
64
|
+
description: 'The transcript of the meeting.',
|
|
65
|
+
}),
|
|
66
|
+
notes: Schema.optional(Schema.String).annotations({
|
|
67
|
+
description: 'Additional notes from the participants.',
|
|
68
|
+
}),
|
|
69
|
+
}),
|
|
70
|
+
output: Schema.Struct({
|
|
71
|
+
summary: Schema.String.annotations({
|
|
72
|
+
description: 'The summary of the transcript.',
|
|
73
|
+
}),
|
|
74
|
+
}),
|
|
75
|
+
services: [AiService.AiService],
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const SentenceNormalizationInput = Schema.Struct({
|
|
79
|
+
messages: Schema.Array(MessageWithRangeId).annotations({
|
|
80
|
+
description: 'Messages to normalize into sentences.',
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export type SentenceNormalizationInputType = Schema.Schema.Type<typeof SentenceNormalizationInput>;
|
|
85
|
+
|
|
86
|
+
export const SentenceNormalizationOutput = Schema.Struct({
|
|
87
|
+
sentences: Schema.Array(MessageWithRangeId.pipe(Schema.mutable)).pipe(Schema.mutable).annotations({
|
|
88
|
+
description: 'The sentences of the transcript.',
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const SentenceNormalization = Operation.make({
|
|
93
|
+
meta: {
|
|
94
|
+
key: 'org.dxos.function.transcription.sentence-normalization',
|
|
95
|
+
name: 'Sentence Normalization',
|
|
96
|
+
description: 'Post process of transcription for sentence normalization',
|
|
97
|
+
},
|
|
98
|
+
input: SentenceNormalizationInput,
|
|
99
|
+
output: SentenceNormalizationOutput,
|
|
100
|
+
services: [],
|
|
101
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export * as TranscriptOperation from './definitions';
|
|
8
|
+
|
|
9
|
+
export const TranscriptionOperationHandlerSet = OperationHandlerSet.lazy(
|
|
10
|
+
() => import('./create'),
|
|
11
|
+
() => import('./open'),
|
|
12
|
+
() => import('./summarize'),
|
|
13
|
+
);
|
|
@@ -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 { renderByline } from '../util';
|
|
12
|
+
import { Open } from './definitions';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof Open> = 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,101 @@
|
|
|
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, OperationRegistry } from '@dxos/compute';
|
|
14
|
+
import { Database } from '@dxos/echo';
|
|
15
|
+
import { trim } from '@dxos/util';
|
|
16
|
+
|
|
17
|
+
import { Summarize } from './definitions';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Summarize a transcript of a meeting.
|
|
21
|
+
*/
|
|
22
|
+
const handler: Operation.WithHandler<typeof Summarize> = Summarize.pipe(
|
|
23
|
+
Operation.withHandler(
|
|
24
|
+
Effect.fnUntraced(
|
|
25
|
+
function* ({ transcript, notes }) {
|
|
26
|
+
const result = yield* new AiRequest({
|
|
27
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
|
|
28
|
+
}).run({
|
|
29
|
+
prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
|
|
30
|
+
history: [],
|
|
31
|
+
system: systemPrompt,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const summary = Function.pipe(
|
|
35
|
+
result,
|
|
36
|
+
Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
|
|
37
|
+
Option.flatMap((msg) =>
|
|
38
|
+
Function.pipe(
|
|
39
|
+
msg.blocks,
|
|
40
|
+
Array.findLast((block) => block._tag === 'text'),
|
|
41
|
+
Option.map((block) => block.text),
|
|
42
|
+
),
|
|
43
|
+
),
|
|
44
|
+
Option.getOrThrowWith(() => new Error('No summary found')),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return { summary };
|
|
48
|
+
},
|
|
49
|
+
Effect.provide(
|
|
50
|
+
Layer.mergeAll(
|
|
51
|
+
AiService.model('@anthropic/claude-sonnet-4-0'),
|
|
52
|
+
ToolResolverService.layerEmpty,
|
|
53
|
+
ToolExecutionService.layerEmpty,
|
|
54
|
+
Trace.writerLayerNoop,
|
|
55
|
+
Database.notAvailable,
|
|
56
|
+
Layer.succeed(Operation.Service, {
|
|
57
|
+
invoke: () => Effect.die('Not available.'),
|
|
58
|
+
schedule: () => Effect.die('Not available.'),
|
|
59
|
+
invokePromise: async () => ({ error: new Error('Not available.') }),
|
|
60
|
+
} as any),
|
|
61
|
+
Layer.succeed(OperationRegistry.Service, { resolve: () => Effect.succeed(undefined) } as any),
|
|
62
|
+
),
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export default handler;
|
|
69
|
+
|
|
70
|
+
const systemPrompt = trim`
|
|
71
|
+
You are a helpful assistant that summarizes transcripts of meetings.
|
|
72
|
+
|
|
73
|
+
# Goal
|
|
74
|
+
Create a markdown summary of the meeting transcript with text notes provided.
|
|
75
|
+
Notes are very important so make sure to include them in the summary if they contain meaningful information.
|
|
76
|
+
|
|
77
|
+
# Formatting
|
|
78
|
+
- Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
|
|
79
|
+
- Use markdown formatting for headings and bullet points.
|
|
80
|
+
- Format the summary as a list of key points and takeaways.
|
|
81
|
+
- All names of people should be in bold.
|
|
82
|
+
|
|
83
|
+
# Note Taking
|
|
84
|
+
- Correlate items in the summary with the person of origin to build a coherent narrative.
|
|
85
|
+
- Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
|
|
86
|
+
|
|
87
|
+
# Tasks
|
|
88
|
+
At the end of the summary include tasks.
|
|
89
|
+
Extract only the tasks that are:
|
|
90
|
+
- Directly actionable.
|
|
91
|
+
- Clearly assigned to a person or team (or can easily be inferred).
|
|
92
|
+
- Strongly implied by the conversation and/or user note (no speculative tasks).
|
|
93
|
+
- Specific enough that someone reading them would know exactly what to do next.
|
|
94
|
+
|
|
95
|
+
Format all tasks as markdown checkboxes using the syntax:
|
|
96
|
+
- [ ] Task description.
|
|
97
|
+
|
|
98
|
+
Additional information can be included (indented).
|
|
99
|
+
|
|
100
|
+
If no actionable tasks are found, omit this tasks section.
|
|
101
|
+
`;
|
|
@@ -2,40 +2,37 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
8
7
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
8
|
|
|
10
|
-
import { EdgeAiServiceClient } from '@dxos/ai';
|
|
11
|
-
import { AI_SERVICE_ENDPOINT } from '@dxos/ai/testing';
|
|
12
|
-
import { Events, IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
13
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit/events';
|
|
14
11
|
import { scheduleTask } from '@dxos/async';
|
|
15
12
|
import { Context } from '@dxos/context';
|
|
16
13
|
import { Obj } from '@dxos/echo';
|
|
17
14
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
18
|
-
import { createQueueDXN } from '@dxos/echo
|
|
19
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
15
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
16
|
+
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
20
17
|
import { log } from '@dxos/log';
|
|
21
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
19
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
22
20
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
import {
|
|
21
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
22
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
23
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
24
|
+
import { type Actor, Message, Organization, Person } from '@dxos/types';
|
|
25
|
+
import { seedTestData } from '@dxos/types/testing';
|
|
26
|
+
|
|
27
|
+
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '#hooks';
|
|
28
|
+
import { TestItem } from '#testing';
|
|
30
29
|
|
|
30
|
+
import { MessageNormalizer, getActorId } from '../normalization';
|
|
31
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../transcriber';
|
|
32
|
+
import { TranscriptionPlugin } from '../TranscriptionPlugin';
|
|
33
|
+
import { renderByline } from '../util';
|
|
31
34
|
import { TranscriptionStory } from './TranscriptionStory';
|
|
32
35
|
import { useIsSpeaking } from './useIsSpeaking';
|
|
33
|
-
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
34
|
-
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '../../hooks';
|
|
35
|
-
import { getActorId, MessageNormalizer } from '../../segments-normalization';
|
|
36
|
-
import { TestItem } from '../../testing';
|
|
37
|
-
import { type MediaStreamRecorderParams, type TranscriberParams } from '../../transcriber';
|
|
38
|
-
import { renderMarkdown } from '../Transcript';
|
|
39
36
|
|
|
40
37
|
const AudioFile = ({
|
|
41
38
|
detectSpeaking,
|
|
@@ -48,15 +45,33 @@ const AudioFile = ({
|
|
|
48
45
|
detectSpeaking?: boolean;
|
|
49
46
|
normalizeSentences?: boolean;
|
|
50
47
|
audioUrl: string;
|
|
51
|
-
transcriberConfig?:
|
|
52
|
-
recorderConfig?:
|
|
48
|
+
transcriberConfig?: TranscriberProps['config'];
|
|
49
|
+
recorderConfig?: MediaStreamRecorderProps['config'];
|
|
53
50
|
audioConstraints?: MediaTrackConstraints;
|
|
54
51
|
}) => {
|
|
55
52
|
const [running, setRunning] = useState(false);
|
|
56
|
-
const actor:
|
|
53
|
+
const actor: Actor.Actor = useMemo(() => ({ name: 'You' }), []);
|
|
54
|
+
|
|
55
|
+
// Optional uploaded file overrides the default URL.
|
|
56
|
+
// The useEffect below revokes the previous URL whenever it changes (and on unmount).
|
|
57
|
+
const [uploadedUrl, setUploadedUrl] = useState<string>();
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
return () => {
|
|
60
|
+
if (uploadedUrl) {
|
|
61
|
+
URL.revokeObjectURL(uploadedUrl);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}, [uploadedUrl]);
|
|
65
|
+
|
|
66
|
+
const handleUpload = useCallback((file: File) => {
|
|
67
|
+
setRunning(false);
|
|
68
|
+
setUploadedUrl(URL.createObjectURL(file));
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
const sourceUrl = uploadedUrl ?? audioUrl;
|
|
57
72
|
|
|
58
73
|
// Audio.
|
|
59
|
-
const { audio, track, stream } = useAudioFile(
|
|
74
|
+
const { audio, track, stream } = useAudioFile(sourceUrl, audioConstraints);
|
|
60
75
|
|
|
61
76
|
// Speaking.
|
|
62
77
|
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
@@ -69,7 +84,6 @@ const AudioFile = ({
|
|
|
69
84
|
|
|
70
85
|
useEffect(() => {
|
|
71
86
|
if (!audio) {
|
|
72
|
-
log.warn('no audio');
|
|
73
87
|
return;
|
|
74
88
|
}
|
|
75
89
|
|
|
@@ -83,13 +97,18 @@ const AudioFile = ({
|
|
|
83
97
|
// Transcriber.
|
|
84
98
|
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
85
99
|
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
86
|
-
const queue = useMemo(() => new MemoryQueue<
|
|
100
|
+
const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
|
|
87
101
|
|
|
88
|
-
const model = useQueueModelAdapter(
|
|
89
|
-
const handleSegments = useCallback<
|
|
102
|
+
const model = useQueueModelAdapter(renderByline([]), queue);
|
|
103
|
+
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
90
104
|
async (blocks) => {
|
|
91
|
-
|
|
92
|
-
|
|
105
|
+
void queue?.append([
|
|
106
|
+
Obj.make(Message.Message, {
|
|
107
|
+
created: new Date().toISOString(),
|
|
108
|
+
sender: actor,
|
|
109
|
+
blocks,
|
|
110
|
+
}),
|
|
111
|
+
]);
|
|
93
112
|
},
|
|
94
113
|
[queue],
|
|
95
114
|
);
|
|
@@ -108,14 +127,14 @@ const AudioFile = ({
|
|
|
108
127
|
}
|
|
109
128
|
const executor = new FunctionExecutor(
|
|
110
129
|
new ServiceContainer().setServices({
|
|
111
|
-
ai: {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
},
|
|
130
|
+
// ai: {
|
|
131
|
+
// client: new Edge AiServiceClient({
|
|
132
|
+
// endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
133
|
+
// defaultGenerationOptions: {
|
|
134
|
+
// model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
135
|
+
// },
|
|
136
|
+
// }),
|
|
137
|
+
// },
|
|
119
138
|
}),
|
|
120
139
|
);
|
|
121
140
|
|
|
@@ -143,10 +162,10 @@ const AudioFile = ({
|
|
|
143
162
|
}, [normalizer]);
|
|
144
163
|
|
|
145
164
|
const manageChunkRecording = () => {
|
|
146
|
-
if (running && isSpeaking) {
|
|
165
|
+
if (running && isSpeaking && transcriber) {
|
|
147
166
|
log.info('starting transcription');
|
|
148
167
|
transcriber?.startChunksRecording();
|
|
149
|
-
} else if (!isSpeaking || !running) {
|
|
168
|
+
} else if ((!isSpeaking || !running) && transcriber) {
|
|
150
169
|
log.info('stopping transcription');
|
|
151
170
|
transcriber?.stopChunksRecording();
|
|
152
171
|
}
|
|
@@ -172,40 +191,47 @@ const AudioFile = ({
|
|
|
172
191
|
manageChunkRecording();
|
|
173
192
|
}, [isSpeaking, stream]);
|
|
174
193
|
|
|
175
|
-
return
|
|
194
|
+
return (
|
|
195
|
+
<TranscriptionStory
|
|
196
|
+
disabled={!stream}
|
|
197
|
+
model={model}
|
|
198
|
+
running={running}
|
|
199
|
+
onRunningChange={setRunning}
|
|
200
|
+
audioRef={ref}
|
|
201
|
+
onUpload={handleUpload}
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
176
204
|
};
|
|
177
205
|
|
|
178
|
-
const meta
|
|
179
|
-
title: 'plugins/plugin-transcription/FileTranscription',
|
|
206
|
+
const meta = {
|
|
207
|
+
title: 'plugins/plugin-transcription/components/FileTranscription',
|
|
180
208
|
decorators: [
|
|
209
|
+
withLayout({ layout: 'column' }),
|
|
181
210
|
withPluginManager({
|
|
182
211
|
plugins: [
|
|
183
|
-
|
|
184
|
-
|
|
212
|
+
...corePlugins(),
|
|
213
|
+
StorybookPlugin({}),
|
|
185
214
|
ClientPlugin({
|
|
186
|
-
types: [TestItem,
|
|
187
|
-
onClientInitialized:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
},
|
|
215
|
+
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
216
|
+
onClientInitialized: ({ client }) =>
|
|
217
|
+
Effect.gen(function* () {
|
|
218
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
219
|
+
yield* Effect.promise(() => seedTestData(personalSpace));
|
|
220
|
+
}),
|
|
193
221
|
}),
|
|
194
|
-
|
|
195
|
-
SettingsPlugin(),
|
|
222
|
+
|
|
196
223
|
PreviewPlugin(),
|
|
197
|
-
IntentPlugin(),
|
|
198
224
|
TranscriptionPlugin(),
|
|
199
225
|
],
|
|
200
|
-
fireEvents: [
|
|
226
|
+
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
201
227
|
}),
|
|
202
|
-
withTheme,
|
|
203
|
-
withLayout({ fullscreen: true, classNames: 'justify-center' }),
|
|
204
228
|
],
|
|
205
|
-
};
|
|
229
|
+
} satisfies Meta;
|
|
206
230
|
|
|
207
231
|
export default meta;
|
|
208
232
|
|
|
233
|
+
type Story = StoryObj<typeof meta>;
|
|
234
|
+
|
|
209
235
|
const TRANSCRIBER_CONFIG = {
|
|
210
236
|
transcribeAfterChunksAmount: 100,
|
|
211
237
|
prefixBufferChunksAmount: 50,
|
|
@@ -228,15 +254,16 @@ export const Default: StoryObj<typeof AudioFile> = {
|
|
|
228
254
|
},
|
|
229
255
|
};
|
|
230
256
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
257
|
+
// TODO(mykola): Fix sentence normalization.
|
|
258
|
+
// export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
|
|
259
|
+
// render: AudioFile,
|
|
260
|
+
// args: {
|
|
261
|
+
// detectSpeaking: true,
|
|
262
|
+
// normalizeSentences: true,
|
|
263
|
+
// // https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
|
|
264
|
+
// audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
265
|
+
// // textUrl: 'https://dxos.network/audio-london.txt',
|
|
266
|
+
// transcriberConfig: TRANSCRIBER_CONFIG,
|
|
267
|
+
// recorderConfig: RECORDER_CONFIG,
|
|
268
|
+
// },
|
|
269
|
+
// };
|