@dxos/plugin-transcription 0.8.4-main.9735255 → 0.8.4-main.abd8ff62ef
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 +27 -5
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/chunk-3L623EVL.mjs +17 -0
- package/dist/lib/browser/chunk-3L623EVL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HOOPZ7EM.mjs → chunk-KAEXRX3Y.mjs} +1 -1
- 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 +439 -83
- 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 +1 -5
- package/dist/lib/node-esm/blueprints/index.mjs +27 -5
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- 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-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-NVM2QUMX.mjs → chunk-O533NBMK.mjs} +1 -1
- 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/index.mjs +439 -83
- 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 +1 -5
- package/dist/types/src/TranscriptionPlugin.d.ts +1 -0
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/TranscriptionPlugin.node.d.ts +4 -0
- package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts +2 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -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 +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber.d.ts +9 -0
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -0
- package/dist/types/src/components/{Transcript/Transcript.d.ts → Transcription/Transcription.d.ts} +6 -5
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
- package/dist/types/src/components/{Transcript/Transcript.stories.d.ts → Transcription/Transcription.stories.d.ts} +13 -13
- 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/{Transcript/transcript-extension.d.ts → Transcription/transcription-extension.d.ts} +3 -3
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -3
- 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.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 +3 -3
- package/dist/types/src/index.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/normalization/message-normalizer.d.ts.map +1 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.d.ts +182 -339
- package/dist/types/src/normalization/normalization.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.test.d.ts.map +1 -0
- package/dist/types/src/normalization/utils.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/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/{components/stories → stories}/FileTranscription.stories.d.ts +3 -3
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories → stories}/KeyWordRecognition.stories.d.ts +2 -2
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories → stories}/MicrophoneTranscription.stories.d.ts +3 -3
- 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.map +1 -1
- package/dist/types/src/transcriber/index.d.ts +1 -1
- package/dist/types/src/transcriber/index.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +57 -2
- 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.map +1 -1
- package/dist/types/src/translations.d.ts +7 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +2 -1
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/{types.d.ts → defs.d.ts} +1 -1
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/array.d.ts.map +1 -1
- package/dist/types/src/util/get-time-str.d.ts.map +1 -1
- package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +105 -75
- package/src/TranscriptionPlugin.node.ts +48 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +23 -15
- package/src/blueprints/index.ts +1 -1
- package/src/blueprints/transcription-blueprint.ts +13 -9
- package/src/capabilities/blueprint-definition.ts +19 -0
- package/src/capabilities/index.ts +11 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +31 -0
- package/src/capabilities/{transcriber/transcriber.ts → transcriber.ts} +9 -6
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +27 -26
- 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} +4 -4
- 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/useTranscriber.ts +6 -3
- package/src/hooks/useVoiceInput.ts +0 -1
- package/src/index.ts +9 -4
- package/src/meta.ts +1 -1
- package/src/model/model.test.ts +6 -6
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +1 -5
- package/src/{segments-normalization → normalization}/normalization.test.ts +2 -2
- package/src/normalization/normalization.ts +77 -0
- 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/{functions → operations}/summarize.ts +46 -48
- package/src/{components/stories → stories}/FileTranscription.stories.tsx +34 -17
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +34 -32
- package/src/{components/stories → stories}/MicrophoneTranscription.stories.tsx +19 -37
- package/src/stories/TranscriptionStory.tsx +93 -0
- package/src/testing/testing.ts +8 -18
- package/src/transcriber/index.ts +1 -1
- package/src/transcriber/transcriber.browser.test.ts +0 -1
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +94 -53
- package/src/translations.ts +7 -7
- package/src/types/capabilities.ts +9 -3
- package/src/types/index.ts +1 -3
- package/dist/lib/browser/TranscriptContainer-6EHKWVS4.mjs +0 -12
- package/dist/lib/browser/blueprint-definition-FTRNMLJZ.mjs +0 -18
- package/dist/lib/browser/blueprint-definition-FTRNMLJZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-ICM7JRCO.mjs +0 -698
- package/dist/lib/browser/chunk-ICM7JRCO.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q5OC3WVG.mjs +0 -72
- package/dist/lib/browser/chunk-Q5OC3WVG.mjs.map +0 -7
- package/dist/lib/browser/chunk-SYGEFDWO.mjs +0 -8
- package/dist/lib/browser/chunk-SYGEFDWO.mjs.map +0 -7
- package/dist/lib/browser/chunk-TKFU53OZ.mjs +0 -460
- package/dist/lib/browser/chunk-TKFU53OZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZZF7ICVM.mjs +0 -150
- package/dist/lib/browser/chunk-ZZF7ICVM.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-ZUWTU7C5.mjs +0 -22
- package/dist/lib/browser/operation-resolver-ZUWTU7C5.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ZXH5267I.mjs +0 -34
- package/dist/lib/browser/react-surface-ZXH5267I.mjs.map +0 -7
- package/dist/lib/browser/transcriber-EZZTUCPE.mjs +0 -60
- package/dist/lib/browser/transcriber-EZZTUCPE.mjs.map +0 -7
- package/dist/lib/node-esm/TranscriptContainer-5YT5W73I.mjs +0 -13
- package/dist/lib/node-esm/blueprint-definition-IOX35YUX.mjs +0 -19
- package/dist/lib/node-esm/blueprint-definition-IOX35YUX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4BFY6P2D.mjs +0 -73
- package/dist/lib/node-esm/chunk-4BFY6P2D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BX2AB7S7.mjs +0 -699
- package/dist/lib/node-esm/chunk-BX2AB7S7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CWP22IHV.mjs +0 -151
- package/dist/lib/node-esm/chunk-CWP22IHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EPC27WWV.mjs +0 -461
- package/dist/lib/node-esm/chunk-EPC27WWV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GVAVEVZ6.mjs +0 -10
- package/dist/lib/node-esm/chunk-GVAVEVZ6.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-Z72B4H2Q.mjs +0 -23
- package/dist/lib/node-esm/operation-resolver-Z72B4H2Q.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-6GUBZX2V.mjs +0 -35
- package/dist/lib/node-esm/react-surface-6GUBZX2V.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-RGW3YYT4.mjs +0 -61
- package/dist/lib/node-esm/transcriber-RGW3YYT4.mjs.map +0 -7
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -9
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +0 -5
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber/index.d.ts +0 -3
- package/dist/types/src/capabilities/transcriber/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts +0 -9
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +0 -7
- package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -12
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +0 -1
- package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -3
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts +0 -7
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/summarize.d.ts +0 -11
- package/dist/types/src/functions/summarize.d.ts.map +0 -1
- package/dist/types/src/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.map +0 -1
- package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
- package/dist/types/src/types/TranscriptAction.d.ts +0 -25
- package/dist/types/src/types/TranscriptAction.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -23
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/operation-handler/index.ts +0 -7
- package/src/capabilities/operation-handler/operation-handler.ts +0 -25
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -25
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -27
- package/src/capabilities/transcriber/index.ts +0 -7
- package/src/components/Transcript/Transcript.tsx +0 -66
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -34
- package/src/components/stories/TranscriptionStory.tsx +0 -41
- package/src/functions/index.ts +0 -6
- package/src/functions/open.ts +0 -39
- package/src/segments-normalization/normalization.ts +0 -115
- package/src/types/TranscriptAction.ts +0 -32
- package/dist/lib/browser/{chunk-HOOPZ7EM.mjs.map → chunk-KAEXRX3Y.mjs.map} +0 -0
- package/dist/lib/browser/{TranscriptContainer-6EHKWVS4.mjs.map → hooks/index.mjs.map} +0 -0
- package/dist/lib/node-esm/{chunk-NVM2QUMX.mjs.map → chunk-O533NBMK.mjs.map} +0 -0
- package/dist/lib/node-esm/{TranscriptContainer-5YT5W73I.mjs.map → hooks/index.mjs.map} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/message-normalizer.d.ts +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/dist/types/src/{segments-normalization → normalization}/utils.d.ts +0 -0
- package/dist/types/src/{components/stories → stories}/useIsSpeaking.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
- /package/src/{segments-normalization → normalization}/utils.ts +0 -0
- /package/src/{components/stories → stories}/useIsSpeaking.tsx +0 -0
- /package/src/types/{types.ts → defs.ts} +0 -0
|
@@ -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;
|
|
@@ -7,67 +7,65 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import * as Function from 'effect/Function';
|
|
8
8
|
import * as Layer from 'effect/Layer';
|
|
9
9
|
import * as Option from 'effect/Option';
|
|
10
|
-
import * as Schema from 'effect/Schema';
|
|
11
10
|
|
|
12
11
|
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { AiRequest, GenerationObserver } from '@dxos/assistant';
|
|
13
|
+
import { Trace, Operation, OperationRegistry } from '@dxos/compute';
|
|
14
|
+
import { Database } from '@dxos/echo';
|
|
15
15
|
import { trim } from '@dxos/util';
|
|
16
16
|
|
|
17
|
+
import { Summarize } from './definitions';
|
|
18
|
+
|
|
17
19
|
/**
|
|
18
20
|
* Summarize a transcript of a meeting.
|
|
19
21
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}),
|
|
32
|
-
outputSchema: Schema.Struct({
|
|
33
|
-
summary: Schema.String.annotations({
|
|
34
|
-
description: 'The summary of the transcript.',
|
|
35
|
-
}),
|
|
36
|
-
}),
|
|
37
|
-
handler: Effect.fnUntraced(
|
|
38
|
-
function* ({ data: { transcript, notes } }) {
|
|
39
|
-
const result = yield* new AiSession().run({
|
|
40
|
-
prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
|
|
41
|
-
history: [],
|
|
42
|
-
system: systemPrompt,
|
|
43
|
-
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
|
|
44
|
-
});
|
|
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
|
+
});
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
),
|
|
54
43
|
),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
);
|
|
44
|
+
Option.getOrThrowWith(() => new Error('No summary found')),
|
|
45
|
+
);
|
|
58
46
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
+
),
|
|
67
63
|
),
|
|
68
64
|
),
|
|
69
65
|
),
|
|
70
|
-
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export default handler;
|
|
71
69
|
|
|
72
70
|
const systemPrompt = trim`
|
|
73
71
|
You are a helpful assistant that summarizes transcripts of meetings.
|
|
@@ -6,30 +6,31 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Common } from '@dxos/app-framework';
|
|
10
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
11
|
import { scheduleTask } from '@dxos/async';
|
|
12
12
|
import { Context } from '@dxos/context';
|
|
13
13
|
import { Obj } from '@dxos/echo';
|
|
14
|
-
import { createQueueDXN } from '@dxos/echo/internal';
|
|
15
14
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
15
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
16
16
|
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
17
17
|
import { log } from '@dxos/log';
|
|
18
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
19
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
19
20
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
20
21
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
21
|
-
import { withLayout
|
|
22
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
22
23
|
import { TestSchema } from '@dxos/schema/testing';
|
|
23
24
|
import { type Actor, Message, Organization, Person } from '@dxos/types';
|
|
24
25
|
import { seedTestData } from '@dxos/types/testing';
|
|
25
26
|
|
|
26
|
-
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '
|
|
27
|
-
import {
|
|
28
|
-
import { TestItem } from '../../testing';
|
|
29
|
-
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
30
|
-
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
31
|
-
import { renderByline } from '../../util';
|
|
27
|
+
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '#hooks';
|
|
28
|
+
import { TestItem } from '#testing';
|
|
32
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';
|
|
33
34
|
import { TranscriptionStory } from './TranscriptionStory';
|
|
34
35
|
import { useIsSpeaking } from './useIsSpeaking';
|
|
35
36
|
|
|
@@ -51,8 +52,26 @@ const AudioFile = ({
|
|
|
51
52
|
const [running, setRunning] = useState(false);
|
|
52
53
|
const actor: Actor.Actor = useMemo(() => ({ name: 'You' }), []);
|
|
53
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;
|
|
72
|
+
|
|
54
73
|
// Audio.
|
|
55
|
-
const { audio, track, stream } = useAudioFile(
|
|
74
|
+
const { audio, track, stream } = useAudioFile(sourceUrl, audioConstraints);
|
|
56
75
|
|
|
57
76
|
// Speaking.
|
|
58
77
|
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
@@ -179,14 +198,14 @@ const AudioFile = ({
|
|
|
179
198
|
running={running}
|
|
180
199
|
onRunningChange={setRunning}
|
|
181
200
|
audioRef={ref}
|
|
201
|
+
onUpload={handleUpload}
|
|
182
202
|
/>
|
|
183
203
|
);
|
|
184
204
|
};
|
|
185
205
|
|
|
186
206
|
const meta = {
|
|
187
|
-
title: 'plugins/plugin-transcription/FileTranscription',
|
|
207
|
+
title: 'plugins/plugin-transcription/components/FileTranscription',
|
|
188
208
|
decorators: [
|
|
189
|
-
withTheme,
|
|
190
209
|
withLayout({ layout: 'column' }),
|
|
191
210
|
withPluginManager({
|
|
192
211
|
plugins: [
|
|
@@ -196,17 +215,15 @@ const meta = {
|
|
|
196
215
|
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
197
216
|
onClientInitialized: ({ client }) =>
|
|
198
217
|
Effect.gen(function* () {
|
|
199
|
-
yield*
|
|
200
|
-
yield* Effect.promise(() =>
|
|
201
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
202
|
-
yield* Effect.promise(() => seedTestData(client.spaces.default));
|
|
218
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
219
|
+
yield* Effect.promise(() => seedTestData(personalSpace));
|
|
203
220
|
}),
|
|
204
221
|
}),
|
|
205
222
|
|
|
206
223
|
PreviewPlugin(),
|
|
207
224
|
TranscriptionPlugin(),
|
|
208
225
|
],
|
|
209
|
-
fireEvents: [
|
|
226
|
+
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
210
227
|
}),
|
|
211
228
|
],
|
|
212
229
|
} satisfies Meta;
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
|
-
import { Toolbar } from '@dxos/react-ui';
|
|
9
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
10
10
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
11
|
import { mx } from '@dxos/ui-theme';
|
|
12
12
|
|
|
@@ -15,11 +15,11 @@ type Word = {
|
|
|
15
15
|
matched: boolean;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type DefaultStoryProps = {
|
|
19
19
|
keywords: string[];
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const DefaultStory = ({ keywords }:
|
|
22
|
+
const DefaultStory = ({ keywords }: DefaultStoryProps) => {
|
|
23
23
|
const [running, setRunning] = useState(false);
|
|
24
24
|
const [matchingWords, setMatchingWords] = useState<Word[]>(keywords.map((word) => ({ text: word, matched: false })));
|
|
25
25
|
|
|
@@ -86,39 +86,41 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
86
86
|
}, [running, recognition]);
|
|
87
87
|
|
|
88
88
|
return (
|
|
89
|
-
<
|
|
90
|
-
<Toolbar
|
|
91
|
-
<Toolbar.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
89
|
+
<Panel.Root>
|
|
90
|
+
<Panel.Toolbar asChild>
|
|
91
|
+
<Toolbar.Root>
|
|
92
|
+
<Toolbar.IconButton
|
|
93
|
+
iconOnly
|
|
94
|
+
icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
|
|
95
|
+
label={running ? 'Pause' : 'Play'}
|
|
96
|
+
onClick={() => setRunning((running) => !running)}
|
|
97
|
+
/>
|
|
98
|
+
</Toolbar.Root>
|
|
99
|
+
</Panel.Toolbar>
|
|
100
|
+
|
|
101
|
+
<Panel.Content>
|
|
102
|
+
<div className='p-4 grid grid-cols-[repeat(auto-fill,minmax(6rem,1fr))] gap-2'>
|
|
103
|
+
{matchingWords.map((word, index) => (
|
|
104
|
+
<span
|
|
105
|
+
key={index}
|
|
106
|
+
className={mx(
|
|
107
|
+
'grid place-items-center p-2 aspect-square rounded-sm border border-separator',
|
|
108
|
+
word.matched && 'border-red-300',
|
|
109
|
+
)}
|
|
110
|
+
>
|
|
111
|
+
{word.text}
|
|
112
|
+
</span>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
</Panel.Content>
|
|
116
|
+
</Panel.Root>
|
|
115
117
|
);
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
const meta = {
|
|
119
|
-
title: 'plugins/plugin-transcription/KeyWordDetection',
|
|
121
|
+
title: 'plugins/plugin-transcription/components/KeyWordDetection',
|
|
120
122
|
render: DefaultStory,
|
|
121
|
-
decorators: [withTheme, withLayout({ layout: 'column' })],
|
|
123
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
122
124
|
} satisfies Meta<typeof DefaultStory>;
|
|
123
125
|
|
|
124
126
|
export default meta;
|
|
@@ -127,6 +129,6 @@ type Story = StoryObj<typeof meta>;
|
|
|
127
129
|
|
|
128
130
|
export const SpeechRecognitionAPI: Story = {
|
|
129
131
|
args: {
|
|
130
|
-
keywords: ['kai', 'computer', 'hello'],
|
|
132
|
+
keywords: ['kai', 'computer', 'hello', 'dxos'],
|
|
131
133
|
},
|
|
132
134
|
};
|
|
@@ -6,8 +6,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Common } from '@dxos/app-framework';
|
|
10
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
11
|
import {
|
|
12
12
|
type ExtractionFunction,
|
|
13
13
|
extractionAnthropicFunction,
|
|
@@ -16,26 +16,26 @@ import {
|
|
|
16
16
|
processTranscriptMessage,
|
|
17
17
|
} from '@dxos/assistant/extraction';
|
|
18
18
|
import { Filter, type Obj } from '@dxos/echo';
|
|
19
|
-
import { createQueueDXN } from '@dxos/echo/internal';
|
|
20
19
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
21
|
-
import {
|
|
20
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
22
21
|
import { invariant } from '@dxos/invariant';
|
|
23
22
|
import { log } from '@dxos/log';
|
|
24
23
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
24
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
25
25
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
26
26
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
27
|
-
import { IndexKind,
|
|
28
|
-
import { withLayout
|
|
27
|
+
import { IndexKind, useSpaces } from '@dxos/react-client/echo';
|
|
28
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
29
29
|
import { TestSchema } from '@dxos/schema/testing';
|
|
30
30
|
import { Message, Organization, Person } from '@dxos/types';
|
|
31
31
|
import { seedTestData } from '@dxos/types/testing';
|
|
32
32
|
|
|
33
|
-
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '
|
|
34
|
-
import { TestItem } from '
|
|
35
|
-
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
36
|
-
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
37
|
-
import { renderByline } from '../../util';
|
|
33
|
+
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '#hooks';
|
|
34
|
+
import { TestItem } from '#testing';
|
|
38
35
|
|
|
36
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../transcriber';
|
|
37
|
+
import { TranscriptionPlugin } from '../TranscriptionPlugin';
|
|
38
|
+
import { renderByline } from '../util';
|
|
39
39
|
import { TranscriptionStory } from './TranscriptionStory';
|
|
40
40
|
import { useIsSpeaking } from './useIsSpeaking';
|
|
41
41
|
|
|
@@ -48,7 +48,7 @@ const RECORDER_CONFIG = {
|
|
|
48
48
|
interval: 200,
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
type
|
|
51
|
+
type DefaultStoryProps = {
|
|
52
52
|
detectSpeaking?: boolean;
|
|
53
53
|
transcriberConfig: TranscriberProps['config'];
|
|
54
54
|
recorderConfig: MediaStreamRecorderProps['config'];
|
|
@@ -62,7 +62,7 @@ const DefaultStory = ({
|
|
|
62
62
|
transcriberConfig,
|
|
63
63
|
recorderConfig,
|
|
64
64
|
audioConstraints,
|
|
65
|
-
}:
|
|
65
|
+
}: DefaultStoryProps) => {
|
|
66
66
|
const [running, setRunning] = useState(false);
|
|
67
67
|
|
|
68
68
|
// Audio.
|
|
@@ -76,7 +76,7 @@ const DefaultStory = ({
|
|
|
76
76
|
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
77
77
|
const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
|
|
78
78
|
const model = useQueueModelAdapter(renderByline([]), queue);
|
|
79
|
-
const space =
|
|
79
|
+
const [space] = useSpaces();
|
|
80
80
|
|
|
81
81
|
useEffect(() => {
|
|
82
82
|
if (!space) {
|
|
@@ -85,13 +85,12 @@ const DefaultStory = ({
|
|
|
85
85
|
}, [space]);
|
|
86
86
|
|
|
87
87
|
// Entity extraction.
|
|
88
|
-
const { extractionFunction,
|
|
88
|
+
const { extractionFunction, objects } = useMemo(() => {
|
|
89
89
|
if (!space) {
|
|
90
90
|
log.warn('no space');
|
|
91
91
|
return {};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
let executor: FunctionExecutor | undefined;
|
|
95
94
|
let extractionFunction: ExtractionFunction | undefined;
|
|
96
95
|
let objects: Promise<Obj.Unknown[]> | undefined;
|
|
97
96
|
|
|
@@ -111,20 +110,8 @@ const DefaultStory = ({
|
|
|
111
110
|
)
|
|
112
111
|
.run();
|
|
113
112
|
}
|
|
114
|
-
if (entityExtraction !== 'none') {
|
|
115
|
-
executor = new FunctionExecutor(
|
|
116
|
-
new ServiceContainer().setServices({
|
|
117
|
-
// ai: {
|
|
118
|
-
// client: new Edge AiServiceClient({
|
|
119
|
-
// endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
120
|
-
// }),
|
|
121
|
-
// },
|
|
122
|
-
// database: { db: space!.db },
|
|
123
|
-
}),
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
113
|
|
|
127
|
-
return { extractionFunction,
|
|
114
|
+
return { extractionFunction, objects };
|
|
128
115
|
}, [entityExtraction, space]);
|
|
129
116
|
|
|
130
117
|
// Transcriber.
|
|
@@ -142,9 +129,7 @@ const DefaultStory = ({
|
|
|
142
129
|
|
|
143
130
|
if (entityExtraction !== 'none') {
|
|
144
131
|
invariant(extractionFunction, 'extractionFunction is required');
|
|
145
|
-
invariant(executor, 'executor is required');
|
|
146
132
|
const result = await processTranscriptMessage({
|
|
147
|
-
executor,
|
|
148
133
|
function: extractionFunction,
|
|
149
134
|
input: {
|
|
150
135
|
message,
|
|
@@ -190,10 +175,9 @@ const DefaultStory = ({
|
|
|
190
175
|
};
|
|
191
176
|
|
|
192
177
|
const meta = {
|
|
193
|
-
title: 'plugins/plugin-transcription/MicrophoneTranscription',
|
|
178
|
+
title: 'plugins/plugin-transcription/components/MicrophoneTranscription',
|
|
194
179
|
render: DefaultStory,
|
|
195
180
|
decorators: [
|
|
196
|
-
withTheme,
|
|
197
181
|
withLayout({ layout: 'column' }),
|
|
198
182
|
withPluginManager({
|
|
199
183
|
plugins: [
|
|
@@ -203,9 +187,7 @@ const meta = {
|
|
|
203
187
|
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
204
188
|
onClientInitialized: ({ client }) =>
|
|
205
189
|
Effect.gen(function* () {
|
|
206
|
-
yield*
|
|
207
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
208
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
190
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
209
191
|
// TODO(mykola): Make API easier to use.
|
|
210
192
|
// TODO(mykola): Delete after enabling vector indexing by default.
|
|
211
193
|
// Enable vector indexing.
|
|
@@ -221,14 +203,14 @@ const meta = {
|
|
|
221
203
|
}),
|
|
222
204
|
);
|
|
223
205
|
yield* Effect.promise(() => client.services.services.QueryService!.reindex());
|
|
224
|
-
yield* Effect.promise(() => seedTestData(
|
|
206
|
+
yield* Effect.promise(() => seedTestData(personalSpace));
|
|
225
207
|
}),
|
|
226
208
|
}),
|
|
227
209
|
|
|
228
210
|
PreviewPlugin(),
|
|
229
211
|
TranscriptionPlugin(),
|
|
230
212
|
],
|
|
231
|
-
fireEvents: [
|
|
213
|
+
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
232
214
|
}),
|
|
233
215
|
],
|
|
234
216
|
} satisfies Meta<typeof DefaultStory>;
|