@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
package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx}
RENAMED
|
@@ -10,36 +10,37 @@ import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
11
|
import { Key } from '@dxos/echo';
|
|
12
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
13
14
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
14
15
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
15
|
-
import {
|
|
16
|
-
import { useMembers,
|
|
16
|
+
import { random } from '@dxos/random';
|
|
17
|
+
import { useMembers, useSpaces } from '@dxos/react-client/echo';
|
|
17
18
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
20
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
20
21
|
import { TestSchema } from '@dxos/schema/testing';
|
|
21
22
|
import { type ContentBlock, type Message, Organization, Person } from '@dxos/types';
|
|
22
23
|
|
|
23
|
-
import { useQueueModelAdapter } from '
|
|
24
|
-
import { SerializationModel } from '../../model';
|
|
24
|
+
import { useQueueModelAdapter } from '#hooks';
|
|
25
25
|
import {
|
|
26
26
|
MessageBuilder,
|
|
27
27
|
TestItem,
|
|
28
28
|
useTestTranscriptionQueue,
|
|
29
29
|
useTestTranscriptionQueueWithEntityExtraction,
|
|
30
|
-
} from '
|
|
31
|
-
import { translations } from '
|
|
32
|
-
import { renderByline } from '../../util';
|
|
30
|
+
} from '#testing';
|
|
31
|
+
import { translations } from '#translations';
|
|
33
32
|
|
|
34
|
-
import {
|
|
33
|
+
import { SerializationModel } from '../../model';
|
|
34
|
+
import { renderByline } from '../../util';
|
|
35
|
+
import { Transcription, type TranscriptionProps } from './Transcription';
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
random.seed(1);
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* Story wrapper with test controls.
|
|
40
41
|
*/
|
|
41
42
|
const TranscriptContainer: FC<
|
|
42
|
-
|
|
43
|
+
TranscriptionProps & {
|
|
43
44
|
running: boolean;
|
|
44
45
|
onRunningChange: (running: boolean) => void;
|
|
45
46
|
onReset?: () => void;
|
|
@@ -47,12 +48,10 @@ const TranscriptContainer: FC<
|
|
|
47
48
|
> = ({ model, running, onRunningChange, onReset }) => {
|
|
48
49
|
return (
|
|
49
50
|
<div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
|
|
50
|
-
<
|
|
51
|
+
<Transcription model={model} />
|
|
51
52
|
<div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
|
|
52
53
|
<div className='flex items-center'>
|
|
53
|
-
<
|
|
54
|
-
{JSON.stringify(model.toJSON())}
|
|
55
|
-
</SyntaxHighlighter>
|
|
54
|
+
<JsonHighlighter data={model.toJSON()} indent={0} classNames='text-sm' />
|
|
56
55
|
</div>
|
|
57
56
|
<Toolbar.Root classNames='justify-end'>
|
|
58
57
|
<IconButton
|
|
@@ -67,12 +66,15 @@ const TranscriptContainer: FC<
|
|
|
67
66
|
);
|
|
68
67
|
};
|
|
69
68
|
|
|
70
|
-
type
|
|
69
|
+
type DefaultStoryProps = { messages?: Message.Message[] } & Pick<
|
|
70
|
+
TranscriptionProps,
|
|
71
|
+
'ignoreAttention' | 'attendableId'
|
|
72
|
+
>;
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
75
|
* Basic story mutates array of messages.
|
|
74
76
|
*/
|
|
75
|
-
const BasicStory = ({ messages: initialMessages = [], ...props }:
|
|
77
|
+
const BasicStory = ({ messages: initialMessages = [], ...props }: DefaultStoryProps) => {
|
|
76
78
|
const [reset, setReset] = useState({});
|
|
77
79
|
const builder = useMemo(() => new MessageBuilder(), []);
|
|
78
80
|
const model = useMemo(
|
|
@@ -134,9 +136,9 @@ const QueueStory = ({
|
|
|
134
136
|
queueId,
|
|
135
137
|
onReset,
|
|
136
138
|
...props
|
|
137
|
-
}:
|
|
139
|
+
}: DefaultStoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
|
|
138
140
|
const [running, setRunning] = useState(true);
|
|
139
|
-
const space =
|
|
141
|
+
const [space] = useSpaces();
|
|
140
142
|
const members = useMembers(space?.id).map((member) => member.identity);
|
|
141
143
|
const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
|
|
142
144
|
const model = useQueueModelAdapter(renderByline(members), queue, initialMessages);
|
|
@@ -149,7 +151,7 @@ const QueueStory = ({
|
|
|
149
151
|
// TODO(burdon): Reconcile with QueueStory.
|
|
150
152
|
const EntityExtractionQueueStory = () => {
|
|
151
153
|
const [running, setRunning] = useState(true);
|
|
152
|
-
const space =
|
|
154
|
+
const [space] = useSpaces();
|
|
153
155
|
const members = useMembers(space?.key).map((member) => member.identity);
|
|
154
156
|
const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
|
|
155
157
|
const model = useQueueModelAdapter(renderByline(members), queue, []);
|
|
@@ -171,9 +173,9 @@ const QueueStoryWrapper = () => {
|
|
|
171
173
|
};
|
|
172
174
|
|
|
173
175
|
const meta = {
|
|
174
|
-
title: 'plugins/plugin-transcription/
|
|
176
|
+
title: 'plugins/plugin-transcription/components/Transcription',
|
|
175
177
|
decorators: [
|
|
176
|
-
|
|
178
|
+
withLayout({ layout: 'fullscreen' }),
|
|
177
179
|
withPluginManager({
|
|
178
180
|
plugins: [
|
|
179
181
|
...corePlugins(),
|
|
@@ -182,7 +184,7 @@ const meta = {
|
|
|
182
184
|
types: [TestItem, TestSchema.DocumentType, Person.Person, Organization.Organization],
|
|
183
185
|
onClientInitialized: ({ client }) =>
|
|
184
186
|
Effect.gen(function* () {
|
|
185
|
-
yield*
|
|
187
|
+
yield* initializeIdentity(client);
|
|
186
188
|
}),
|
|
187
189
|
}),
|
|
188
190
|
|
|
@@ -198,8 +200,7 @@ const meta = {
|
|
|
198
200
|
|
|
199
201
|
export default meta;
|
|
200
202
|
|
|
201
|
-
|
|
202
|
-
const DefaultStory = (props: StoryProps) => {
|
|
203
|
+
const DefaultStory = (props: DefaultStoryProps) => {
|
|
203
204
|
const [messages, setMessages] = useState<Message.Message[]>([]);
|
|
204
205
|
useEffect(() => {
|
|
205
206
|
void Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())).then(setMessages);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { useThemeContext } from '@dxos/react-ui';
|
|
8
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
9
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
10
|
+
import {
|
|
11
|
+
autoScroll,
|
|
12
|
+
createBasicExtensions,
|
|
13
|
+
createMarkdownExtensions,
|
|
14
|
+
createThemeExtensions,
|
|
15
|
+
decorateMarkdown,
|
|
16
|
+
documentSlots,
|
|
17
|
+
preview,
|
|
18
|
+
} from '@dxos/ui-editor';
|
|
19
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
20
|
+
import { isTruthy } from '@dxos/util';
|
|
21
|
+
|
|
22
|
+
import { type SerializationModel } from '../../model';
|
|
23
|
+
import { renderByline } from '../../util';
|
|
24
|
+
import { transcription } from './transcription-extension';
|
|
25
|
+
|
|
26
|
+
export { renderByline };
|
|
27
|
+
|
|
28
|
+
export type TranscriptionProps = {
|
|
29
|
+
transcript?: Transcript.Transcript;
|
|
30
|
+
model: SerializationModel<Message.Message>;
|
|
31
|
+
// TODO(burdon): Are these still in use?
|
|
32
|
+
attendableId?: string;
|
|
33
|
+
ignoreAttention?: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Transcript component implemented using the editor.
|
|
38
|
+
*/
|
|
39
|
+
export const Transcription = composable<HTMLDivElement, TranscriptionProps>(
|
|
40
|
+
({ transcript: object, model, children, ...props }, forwardedRef) => {
|
|
41
|
+
const { themeMode } = useThemeContext();
|
|
42
|
+
const { parentRef } = useTextEditor(() => {
|
|
43
|
+
return {
|
|
44
|
+
extensions: [
|
|
45
|
+
createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
|
|
46
|
+
createMarkdownExtensions(),
|
|
47
|
+
createThemeExtensions({ themeMode, slots: documentSlots }),
|
|
48
|
+
decorateMarkdown(),
|
|
49
|
+
preview(),
|
|
50
|
+
transcription({ model, started: object?.started ? new Date(object.started) : undefined }),
|
|
51
|
+
autoScroll(),
|
|
52
|
+
].filter(isTruthy),
|
|
53
|
+
};
|
|
54
|
+
}, [model]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
{...composableProps(props, { classNames: 'dx-container' })}
|
|
59
|
+
ref={parentRef}
|
|
60
|
+
data-popover-collision-boundary={true /* TODO(thure): Make this a constant and document it. */}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
@@ -15,7 +15,7 @@ import { DocumentAdapter, type SerializationModel } from '../../model';
|
|
|
15
15
|
/**
|
|
16
16
|
* Data structure that maps Chunks queue to lines with transcript state.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
18
|
+
export type TranscriptionOptions = {
|
|
19
19
|
model: SerializationModel<Message.Message>;
|
|
20
20
|
started?: Date;
|
|
21
21
|
};
|
|
@@ -23,7 +23,7 @@ export type TranscriptOptions = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Scrolling transcript with timestamps.
|
|
25
25
|
*/
|
|
26
|
-
export const
|
|
26
|
+
export const transcription = ({ model, started }: TranscriptionOptions): Extension => {
|
|
27
27
|
return [
|
|
28
28
|
// Show timestamps in the gutter.
|
|
29
29
|
gutter({
|
|
@@ -132,7 +132,7 @@ export const transcript = ({ model, started }: TranscriptOptions): Extension =>
|
|
|
132
132
|
|
|
133
133
|
EditorView.theme({
|
|
134
134
|
'.cm-gutters': {
|
|
135
|
-
backgroundColor: 'var(--
|
|
135
|
+
backgroundColor: 'var(--color-base-surface)',
|
|
136
136
|
},
|
|
137
137
|
'.cm-timestamp-gutter': {
|
|
138
138
|
width: '6rem',
|
|
@@ -166,7 +166,7 @@ class TimestampMarker extends GutterMarker {
|
|
|
166
166
|
|
|
167
167
|
override toDOM(view: EditorView) {
|
|
168
168
|
const el = document.createElement('div');
|
|
169
|
-
el.className = 'text-sm text-subdued hover:bg-
|
|
169
|
+
el.className = 'text-sm text-subdued hover:bg-hover-surface cursor-pointer';
|
|
170
170
|
el.textContent = formatTimestamp(this._timestamp, this._started);
|
|
171
171
|
// TODO(burdon): Click to bookmark or copy hyperlink.
|
|
172
172
|
el.onclick = () => {
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Feed, Obj } from '@dxos/echo';
|
|
9
|
+
import { useMembers, useQueue } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
12
|
+
|
|
13
|
+
import { Transcription } from '#components';
|
|
14
|
+
import { useQueueModelAdapter } from '#hooks';
|
|
15
|
+
|
|
16
|
+
import { renderByline } from '../../util';
|
|
17
|
+
|
|
18
|
+
export type TranscriptionContainerProps = AppSurface.ObjectArticleProps<Transcript.Transcript>;
|
|
19
|
+
|
|
20
|
+
export const TranscriptionContainer = ({ role, subject: transcript, attendableId }: TranscriptionContainerProps) => {
|
|
21
|
+
const db = Obj.getDatabase(transcript);
|
|
22
|
+
const members = useMembers(db?.spaceId).map((member) => member.identity);
|
|
23
|
+
const feed = transcript.feed.target;
|
|
24
|
+
const queueDxn = feed ? Feed.getQueueDxn(feed) : undefined;
|
|
25
|
+
const queue = useQueue<Message.Message>(queueDxn, { pollInterval: 1_000 });
|
|
26
|
+
const model = useQueueModelAdapter(renderByline(members), queue);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Panel.Root role={role}>
|
|
30
|
+
<Panel.Content asChild>
|
|
31
|
+
<Transcription attendableId={attendableId} model={model} transcript={transcript} />
|
|
32
|
+
</Panel.Content>
|
|
33
|
+
</Panel.Root>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useCapabilities } from '@dxos/app-framework/
|
|
7
|
+
import { useCapabilities } from '@dxos/app-framework/ui';
|
|
8
|
+
|
|
9
|
+
import { TranscriptionCapabilities } from '#types';
|
|
8
10
|
|
|
9
11
|
import { type Transcriber } from '../transcriber';
|
|
10
|
-
import { TranscriptionCapabilities } from '../types';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Records audio while user is speaking and transcribes it after user is done speaking.
|
|
@@ -17,6 +18,7 @@ export const useTranscriber = ({
|
|
|
17
18
|
recorderConfig,
|
|
18
19
|
transcriberConfig,
|
|
19
20
|
onSegments,
|
|
21
|
+
transcribe,
|
|
20
22
|
}: Partial<TranscriptionCapabilities.GetTranscriberProps>) => {
|
|
21
23
|
const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);
|
|
22
24
|
|
|
@@ -31,8 +33,9 @@ export const useTranscriber = ({
|
|
|
31
33
|
recorderConfig,
|
|
32
34
|
transcriberConfig,
|
|
33
35
|
onSegments,
|
|
36
|
+
transcribe,
|
|
34
37
|
});
|
|
35
|
-
}, [getTranscriber, audioStreamTrack, recorderConfig, transcriberConfig, onSegments]);
|
|
38
|
+
}, [getTranscriber, audioStreamTrack, recorderConfig, transcriberConfig, onSegments, transcribe]);
|
|
36
39
|
|
|
37
40
|
useEffect(() => {
|
|
38
41
|
return () => {
|
|
@@ -10,7 +10,6 @@ import { log } from '@dxos/log';
|
|
|
10
10
|
import { useSoundEffect } from '@dxos/react-ui-sfx';
|
|
11
11
|
|
|
12
12
|
import { type TranscriberProps } from '../transcriber';
|
|
13
|
-
|
|
14
13
|
import { useAudioTrack } from './useAudioTrack';
|
|
15
14
|
import { useTranscriber } from './useTranscriber';
|
|
16
15
|
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
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
|
+
|
|
5
11
|
export { TranscriptionCapabilities } from './types';
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
// TODO(wittjosiah): Hooks should not be exported from the plugin package at all.
|
|
14
|
+
// Either refactor callers to not need them or factor them out to a shared package.
|
|
9
15
|
export * from './meta';
|
|
16
|
+
export * from './hooks';
|
|
10
17
|
export * from './transcriber';
|
|
11
|
-
|
|
12
|
-
export * from './TranscriptionPlugin';
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.transcription',
|
|
10
10
|
name: 'Transcription',
|
|
11
11
|
description: trim`
|
|
12
12
|
Real-time voice-to-text transcription service for capturing spoken content.
|
package/src/model/model.test.ts
CHANGED
|
@@ -51,8 +51,8 @@ describe('SerializationModel', () => {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// Update message.
|
|
54
|
-
Obj.
|
|
55
|
-
|
|
54
|
+
Obj.update(message, (message) => {
|
|
55
|
+
message.blocks.push({ _tag: 'transcript', started: createDate(), text: 'Hello again!' });
|
|
56
56
|
});
|
|
57
57
|
model.updateChunk(message);
|
|
58
58
|
{
|
|
@@ -133,16 +133,16 @@ describe('SerializationModel', () => {
|
|
|
133
133
|
expect(view.state.doc.toString()).to.eq('###### Alice\nHello world!\n\n');
|
|
134
134
|
|
|
135
135
|
// Update message (add block).
|
|
136
|
-
Obj.
|
|
137
|
-
|
|
136
|
+
Obj.update(message, (message) => {
|
|
137
|
+
message.blocks.push({ _tag: 'transcript', started: createDate(), text: 'Hello again!' });
|
|
138
138
|
});
|
|
139
139
|
model.updateChunk(message);
|
|
140
140
|
model.sync(adapter);
|
|
141
141
|
expect(view.state.doc.toString()).to.eq('###### Alice\nHello world!\nHello again!\n\n');
|
|
142
142
|
|
|
143
143
|
// Update message (remove block).
|
|
144
|
-
Obj.
|
|
145
|
-
|
|
144
|
+
Obj.update(message, (message) => {
|
|
145
|
+
message.blocks.splice(0, 1);
|
|
146
146
|
});
|
|
147
147
|
model.updateChunk(message);
|
|
148
148
|
model.sync(adapter);
|
package/src/model/model.ts
CHANGED
|
@@ -80,6 +80,9 @@ type ChunkChange<T extends Chunk> =
|
|
|
80
80
|
* Instead this model tracks changes and syncs them with the ChunkDocument.
|
|
81
81
|
*/
|
|
82
82
|
export class SerializationModel<T extends Chunk> {
|
|
83
|
+
/** Emits when the document is updated. */
|
|
84
|
+
public readonly update = new Event<void>();
|
|
85
|
+
|
|
83
86
|
/** Ordered set of chunks. */
|
|
84
87
|
private readonly _chunks: T[] = [];
|
|
85
88
|
|
|
@@ -92,9 +95,6 @@ export class SerializationModel<T extends Chunk> {
|
|
|
92
95
|
/** Track chunk changes since last sync. */
|
|
93
96
|
private readonly _changes: Array<ChunkChange<T>> = [];
|
|
94
97
|
|
|
95
|
-
/** Emits when the document is updated. */
|
|
96
|
-
public readonly update = new Event<void>();
|
|
97
|
-
|
|
98
98
|
constructor(
|
|
99
99
|
private readonly _renderer: ChunkRenderer<T>,
|
|
100
100
|
initialChunks: T[] = [],
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
// Copyright 2025 DXOS.org
|
|
7
|
-
//
|
|
8
|
-
|
|
9
5
|
import { DeferredTask, asyncTimeout } from '@dxos/async';
|
|
10
6
|
import { LifecycleState, Resource } from '@dxos/context';
|
|
11
7
|
import { type Queue } from '@dxos/echo-db';
|
|
@@ -31,9 +27,9 @@ export type QueueCursor = {
|
|
|
31
27
|
timestamp: string;
|
|
32
28
|
};
|
|
33
29
|
|
|
34
|
-
// TODO(mykola): .
|
|
35
30
|
export class MessageNormalizer extends Resource {
|
|
36
31
|
private readonly _functionExecutor: FunctionExecutor;
|
|
32
|
+
|
|
37
33
|
private _queue: Queue<Message.Message>;
|
|
38
34
|
private _cursor: QueueCursor;
|
|
39
35
|
private _messagesToProcess: MessageWithRangeId[] = [];
|
|
@@ -7,8 +7,8 @@ import { describe, test } from 'vitest';
|
|
|
7
7
|
import { scheduleTaskInterval } from '@dxos/async';
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import { createQueueDXN } from '@dxos/echo/internal';
|
|
11
10
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
11
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
12
12
|
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
13
13
|
import { log } from '@dxos/log';
|
|
14
14
|
import { type Actor, Message } from '@dxos/types';
|
|
@@ -98,7 +98,7 @@ describe.skip('SentenceNormalization', () => {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
log.info('sentences', {
|
|
101
|
-
|
|
101
|
+
messages: JSON.stringify(messages, null, 2),
|
|
102
102
|
sentences: JSON.stringify(sentences, null, 2),
|
|
103
103
|
});
|
|
104
104
|
throw new Error('test');
|
|
@@ -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
|
+
`;
|
|
@@ -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;
|