@dxos/plugin-transcription 0.8.3 → 0.8.4-main.1068cf700f
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/TranscriptContainer-MV3JBKLS.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-K3E72ZBC.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-K3E72ZBC.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +9 -0
- package/dist/lib/browser/chunk-AV44VISC.mjs +148 -0
- package/dist/lib/browser/chunk-AV44VISC.mjs.map +7 -0
- package/dist/lib/browser/chunk-HOOPZ7EM.mjs +35 -0
- package/dist/lib/browser/chunk-HOOPZ7EM.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-53AXUEIQ.mjs → chunk-K3JJ46VV.mjs} +367 -433
- package/dist/lib/browser/chunk-K3JJ46VV.mjs.map +7 -0
- package/dist/lib/browser/chunk-Q5OC3WVG.mjs +72 -0
- package/dist/lib/browser/chunk-Q5OC3WVG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UDCCT32F.mjs → chunk-RUKY36XW.mjs} +3 -3
- package/dist/lib/browser/{chunk-IQ5ZRMHZ.mjs → chunk-TKFU53OZ.mjs} +70 -105
- package/dist/lib/browser/chunk-TKFU53OZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +68 -75
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-GLEBGPKH.mjs +22 -0
- package/dist/lib/browser/operation-resolver-GLEBGPKH.mjs.map +7 -0
- package/dist/lib/browser/react-surface-AWZ2A5WZ.mjs +35 -0
- package/dist/lib/browser/react-surface-AWZ2A5WZ.mjs.map +7 -0
- package/dist/lib/browser/{transcriber-OYPLZFG5.mjs → transcriber-SLVQP76E.mjs} +17 -13
- package/dist/lib/browser/transcriber-SLVQP76E.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -8
- package/dist/lib/node-esm/{TranscriptContainer-G75LDEO5.mjs → TranscriptContainer-7M43UAZ2.mjs} +5 -4
- package/dist/lib/node-esm/TranscriptContainer-7M43UAZ2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-2WIDDA3Y.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-2WIDDA3Y.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +10 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4BFY6P2D.mjs +73 -0
- package/dist/lib/node-esm/chunk-4BFY6P2D.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PRL64SRU.mjs → chunk-EPC27WWV.mjs} +70 -105
- package/dist/lib/node-esm/chunk-EPC27WWV.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-NVM2QUMX.mjs +37 -0
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MFJO7EKD.mjs → chunk-SNZAN34I.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-56QHOX4A.mjs → chunk-TIUYXGQN.mjs} +367 -433
- package/dist/lib/node-esm/chunk-TIUYXGQN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TTJBW7CY.mjs +149 -0
- package/dist/lib/node-esm/chunk-TTJBW7CY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +68 -75
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-SMCFTUFM.mjs +23 -0
- package/dist/lib/node-esm/operation-resolver-SMCFTUFM.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-YBBXC4W5.mjs +36 -0
- package/dist/lib/node-esm/react-surface-YBBXC4W5.mjs.map +7 -0
- package/dist/lib/node-esm/{transcriber-TVG2MBBN.mjs → transcriber-BO2N3UQ4.mjs} +17 -13
- package/dist/lib/node-esm/transcriber-BO2N3UQ4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +8 -8
- package/dist/types/src/TranscriptionPlugin.d.ts +2 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- 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 +21 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +5 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber/index.d.ts +3 -0
- package/dist/types/src/capabilities/transcriber/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts +9 -0
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +1 -0
- package/dist/types/src/components/Transcript/Transcript.d.ts +7 -10
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +34 -18
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +12 -12
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +3 -7
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +5 -6
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +8 -7
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -6
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +10 -9
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +4 -3
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +3 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/open.d.ts +11 -0
- package/dist/types/src/functions/open.d.ts.map +1 -0
- package/dist/types/src/functions/summarize.d.ts +11 -0
- package/dist/types/src/functions/summarize.d.ts.map +1 -0
- package/dist/types/src/hooks/useAudioFile.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 +1 -1
- 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/segments-normalization/message-normalizer.d.ts +5 -5
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +503 -311
- package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/utils.d.ts +2 -2
- package/dist/types/src/segments-normalization/utils.d.ts.map +1 -1
- 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/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 +3 -3
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +4 -4
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- 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 +11 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptAction.d.ts +25 -0
- package/dist/types/src/types/TranscriptAction.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +18 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -26
- package/dist/types/src/types/types.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/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 +88 -72
- package/src/TranscriptionPlugin.tsx +40 -58
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +25 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +24 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +4 -7
- package/src/capabilities/operation-handler/index.ts +7 -0
- package/src/capabilities/operation-handler/operation-handler.ts +25 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +25 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +28 -0
- package/src/capabilities/transcriber/index.ts +7 -0
- package/src/capabilities/transcriber/transcriber.ts +85 -0
- package/src/components/Transcript/Transcript.stories.tsx +61 -57
- package/src/components/Transcript/Transcript.tsx +25 -59
- package/src/components/Transcript/deprecated/OldTranscript.tsx +11 -11
- package/src/components/Transcript/transcript-extension.ts +13 -46
- package/src/components/TranscriptContainer.tsx +19 -15
- package/src/components/stories/FileTranscription.stories.tsx +80 -70
- package/src/components/stories/KeyWordRecognition.stories.tsx +17 -13
- package/src/components/stories/MicrophoneTranscription.stories.tsx +89 -87
- package/src/components/stories/TranscriptionStory.tsx +14 -14
- package/src/functions/index.ts +6 -0
- package/src/functions/open.ts +37 -0
- package/src/functions/summarize.ts +103 -0
- package/src/hooks/useAudioFile.ts +49 -53
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +12 -7
- package/src/hooks/useVoiceInput.ts +4 -3
- package/src/index.ts +1 -1
- package/src/meta.ts +9 -6
- package/src/model/model.test.ts +27 -21
- package/src/segments-normalization/message-normalizer.ts +19 -14
- package/src/segments-normalization/normalization.test.ts +25 -32
- package/src/segments-normalization/normalization.ts +59 -49
- package/src/segments-normalization/utils.ts +2 -2
- package/src/testing/testing.ts +42 -32
- package/src/transcriber/index.ts +1 -1
- package/src/transcriber/media-stream-recorder.ts +4 -4
- package/src/transcriber/transcriber.browser.test.ts +6 -5
- package/src/transcriber/transcriber.ts +9 -11
- package/src/transcriber/transcription-manager.ts +37 -52
- package/src/translations.ts +6 -4
- package/src/types/TranscriptAction.ts +32 -0
- package/src/types/capabilities.ts +33 -0
- package/src/types/index.ts +3 -1
- package/src/types/types.ts +0 -23
- 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.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.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-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.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/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-MFJPEIVB.mjs +0 -17
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +0 -7
- 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.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/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber.d.ts +0 -8
- package/dist/types/src/capabilities/transcriber.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/src/capabilities/capabilities.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -24
- package/src/capabilities/react-surface.tsx +0 -22
- package/src/capabilities/transcriber.ts +0 -76
- package/src/types/schema.ts +0 -41
- /package/dist/lib/browser/{TranscriptContainer-H3AZQ4CQ.mjs.map → TranscriptContainer-MV3JBKLS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/TranscriptContainer-G75LDEO5.mjs.map → browser/blueprints/index.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-UDCCT32F.mjs.map → chunk-RUKY36XW.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-MFJO7EKD.mjs.map → chunk-SNZAN34I.mjs.map} +0 -0
|
@@ -2,29 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import type * as Types from 'effect/Types';
|
|
8
8
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
11
|
import { Key } from '@dxos/echo';
|
|
13
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
13
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
15
|
-
import {
|
|
16
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
17
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
14
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
18
15
|
import { faker } from '@dxos/random';
|
|
19
16
|
import { useMembers, useSpace } from '@dxos/react-client/echo';
|
|
20
17
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
18
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
21
19
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { Testing } from '@dxos/schema/testing';
|
|
25
|
-
import { withLayout } from '@dxos/storybook-utils';
|
|
20
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
21
|
+
import { type ContentBlock, type Message, Organization, Person } from '@dxos/types';
|
|
26
22
|
|
|
27
|
-
import { renderMarkdown, Transcript, type TranscriptProps } from './Transcript';
|
|
28
23
|
import { useQueueModelAdapter } from '../../hooks';
|
|
29
24
|
import { SerializationModel } from '../../model';
|
|
30
25
|
import {
|
|
@@ -33,7 +28,10 @@ import {
|
|
|
33
28
|
useTestTranscriptionQueue,
|
|
34
29
|
useTestTranscriptionQueueWithEntityExtraction,
|
|
35
30
|
} from '../../testing';
|
|
36
|
-
import translations from '../../translations';
|
|
31
|
+
import { translations } from '../../translations';
|
|
32
|
+
import { renderByline } from '../../util';
|
|
33
|
+
|
|
34
|
+
import { TranscriptView, type TranscriptViewProps } from './Transcript';
|
|
37
35
|
|
|
38
36
|
faker.seed(1);
|
|
39
37
|
|
|
@@ -41,15 +39,15 @@ faker.seed(1);
|
|
|
41
39
|
* Story wrapper with test controls.
|
|
42
40
|
*/
|
|
43
41
|
const TranscriptContainer: FC<
|
|
44
|
-
|
|
42
|
+
TranscriptViewProps & {
|
|
45
43
|
running: boolean;
|
|
46
44
|
onRunningChange: (running: boolean) => void;
|
|
47
45
|
onReset?: () => void;
|
|
48
46
|
}
|
|
49
|
-
> = ({
|
|
47
|
+
> = ({ model, running, onRunningChange, onReset }) => {
|
|
50
48
|
return (
|
|
51
49
|
<div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
|
|
52
|
-
<
|
|
50
|
+
<TranscriptView model={model} />
|
|
53
51
|
<div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
|
|
54
52
|
<div className='flex items-center'>
|
|
55
53
|
<SyntaxHighlighter language='json' className='text-sm'>
|
|
@@ -69,7 +67,7 @@ const TranscriptContainer: FC<
|
|
|
69
67
|
);
|
|
70
68
|
};
|
|
71
69
|
|
|
72
|
-
type StoryProps = { messages?:
|
|
70
|
+
type StoryProps = { messages?: Message.Message[] } & Pick<TranscriptViewProps, 'ignoreAttention' | 'attendableId'>;
|
|
73
71
|
|
|
74
72
|
/**
|
|
75
73
|
* Basic story mutates array of messages.
|
|
@@ -78,11 +76,12 @@ const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) =>
|
|
|
78
76
|
const [reset, setReset] = useState({});
|
|
79
77
|
const builder = useMemo(() => new MessageBuilder(), []);
|
|
80
78
|
const model = useMemo(
|
|
81
|
-
() => new SerializationModel<
|
|
79
|
+
() => new SerializationModel<Message.Message>(renderByline([]), initialMessages),
|
|
82
80
|
[initialMessages, reset],
|
|
83
81
|
);
|
|
84
82
|
const [running, setRunning] = useState(true);
|
|
85
|
-
|
|
83
|
+
// Use mutable type for local message building (not ECHO-managed).
|
|
84
|
+
const [currentMessage, setCurrentMessage] = useState<Types.Mutable<Message.Message> | null>(null);
|
|
86
85
|
useEffect(() => {
|
|
87
86
|
if (!running) {
|
|
88
87
|
return;
|
|
@@ -103,7 +102,7 @@ const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) =>
|
|
|
103
102
|
return;
|
|
104
103
|
}
|
|
105
104
|
|
|
106
|
-
currentMessage.blocks.push(builder.createBlock());
|
|
105
|
+
(currentMessage.blocks as ContentBlock.Any[]).push(builder.createBlock());
|
|
107
106
|
model.updateChunk(currentMessage);
|
|
108
107
|
}, 3_000);
|
|
109
108
|
|
|
@@ -138,19 +137,12 @@ const QueueStory = ({
|
|
|
138
137
|
}: StoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
|
|
139
138
|
const [running, setRunning] = useState(true);
|
|
140
139
|
const space = useSpace();
|
|
141
|
-
const members = useMembers(space?.
|
|
140
|
+
const members = useMembers(space?.id).map((member) => member.identity);
|
|
142
141
|
const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
|
|
143
|
-
const model = useQueueModelAdapter(
|
|
142
|
+
const model = useQueueModelAdapter(renderByline(members), queue, initialMessages);
|
|
144
143
|
|
|
145
144
|
return (
|
|
146
|
-
<TranscriptContainer
|
|
147
|
-
space={space}
|
|
148
|
-
model={model}
|
|
149
|
-
running={running}
|
|
150
|
-
onRunningChange={setRunning}
|
|
151
|
-
onReset={onReset}
|
|
152
|
-
{...props}
|
|
153
|
-
/>
|
|
145
|
+
<TranscriptContainer model={model} running={running} onRunningChange={setRunning} onReset={onReset} {...props} />
|
|
154
146
|
);
|
|
155
147
|
};
|
|
156
148
|
|
|
@@ -160,9 +152,9 @@ const EntityExtractionQueueStory = () => {
|
|
|
160
152
|
const space = useSpace();
|
|
161
153
|
const members = useMembers(space?.key).map((member) => member.identity);
|
|
162
154
|
const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
|
|
163
|
-
const model = useQueueModelAdapter(
|
|
155
|
+
const model = useQueueModelAdapter(renderByline(members), queue, []);
|
|
164
156
|
|
|
165
|
-
return <TranscriptContainer
|
|
157
|
+
return <TranscriptContainer model={model} running={running} onRunningChange={setRunning} />;
|
|
166
158
|
};
|
|
167
159
|
|
|
168
160
|
/**
|
|
@@ -178,46 +170,55 @@ const QueueStoryWrapper = () => {
|
|
|
178
170
|
return <QueueStory key={key} queueId={queueId} onReset={handleReset} />;
|
|
179
171
|
};
|
|
180
172
|
|
|
181
|
-
const meta
|
|
173
|
+
const meta = {
|
|
182
174
|
title: 'plugins/plugin-transcription/Transcript',
|
|
183
175
|
decorators: [
|
|
176
|
+
withTheme(),
|
|
184
177
|
withPluginManager({
|
|
185
178
|
plugins: [
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
...corePlugins(),
|
|
180
|
+
StorybookPlugin({}),
|
|
188
181
|
ClientPlugin({
|
|
189
|
-
types: [TestItem,
|
|
190
|
-
onClientInitialized:
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
types: [TestItem, TestSchema.DocumentType, Person.Person, Organization.Organization],
|
|
183
|
+
onClientInitialized: ({ client }) =>
|
|
184
|
+
Effect.gen(function* () {
|
|
185
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
186
|
+
}),
|
|
193
187
|
}),
|
|
188
|
+
|
|
194
189
|
PreviewPlugin(),
|
|
195
|
-
SpacePlugin(),
|
|
196
|
-
SettingsPlugin(),
|
|
197
|
-
IntentPlugin(),
|
|
198
190
|
],
|
|
199
191
|
}),
|
|
200
|
-
withLayout({ fullscreen: true }),
|
|
201
192
|
],
|
|
202
193
|
parameters: {
|
|
194
|
+
layout: 'fullscreen',
|
|
203
195
|
translations,
|
|
204
196
|
},
|
|
205
|
-
};
|
|
197
|
+
} satisfies Meta;
|
|
206
198
|
|
|
207
199
|
export default meta;
|
|
208
200
|
|
|
209
|
-
|
|
201
|
+
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
202
|
+
const DefaultStory = (props: StoryProps) => {
|
|
203
|
+
const [messages, setMessages] = useState<Message.Message[]>([]);
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
void Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())).then(setMessages);
|
|
206
|
+
}, []);
|
|
207
|
+
if (messages.length === 0) {
|
|
208
|
+
return <div>Loading messages...</div>;
|
|
209
|
+
}
|
|
210
|
+
return <BasicStory {...props} messages={messages} />;
|
|
211
|
+
};
|
|
210
212
|
|
|
211
|
-
export const Default:
|
|
212
|
-
render:
|
|
213
|
+
export const Default: StoryObj<typeof DefaultStory> = {
|
|
214
|
+
render: DefaultStory,
|
|
213
215
|
args: {
|
|
214
216
|
ignoreAttention: true,
|
|
215
217
|
attendableId: 'story',
|
|
216
|
-
messages: await Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())),
|
|
217
218
|
},
|
|
218
219
|
};
|
|
219
220
|
|
|
220
|
-
export const Empty:
|
|
221
|
+
export const Empty: StoryObj<typeof BasicStory> = {
|
|
221
222
|
render: BasicStory,
|
|
222
223
|
args: {
|
|
223
224
|
ignoreAttention: true,
|
|
@@ -225,7 +226,7 @@ export const Empty: Story = {
|
|
|
225
226
|
},
|
|
226
227
|
};
|
|
227
228
|
|
|
228
|
-
export const WithQueue:
|
|
229
|
+
export const WithQueue: StoryObj<typeof QueueStoryWrapper> = {
|
|
229
230
|
render: QueueStoryWrapper,
|
|
230
231
|
args: {
|
|
231
232
|
ignoreAttention: true,
|
|
@@ -233,10 +234,13 @@ export const WithQueue: Story = {
|
|
|
233
234
|
},
|
|
234
235
|
};
|
|
235
236
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
// NOTE: We are running out of free quota on hugging face entity extraction.
|
|
238
|
+
// TODO(mykola): Fix AI service in entity extraction function.
|
|
239
|
+
// TODO(mykola): Fix hugging face quota issues.
|
|
240
|
+
// export const WithEntityExtractionQueue: StoryObj<typeof EntityExtractionQueueStory> = {
|
|
241
|
+
// render: EntityExtractionQueueStory,
|
|
242
|
+
// args: {
|
|
243
|
+
// ignoreAttention: true,
|
|
244
|
+
// attendableId: 'story',
|
|
245
|
+
// },
|
|
246
|
+
// };
|
|
@@ -4,57 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
8
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
9
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
10
10
|
import {
|
|
11
|
+
autoScroll,
|
|
11
12
|
createBasicExtensions,
|
|
12
13
|
createMarkdownExtensions,
|
|
13
|
-
createRenderer,
|
|
14
14
|
createThemeExtensions,
|
|
15
15
|
decorateMarkdown,
|
|
16
|
-
|
|
16
|
+
editorSlots,
|
|
17
17
|
preview,
|
|
18
|
-
|
|
19
|
-
} from '@dxos/
|
|
20
|
-
import {
|
|
21
|
-
import { type DataType } from '@dxos/schema';
|
|
22
|
-
import { isNotFalsy } from '@dxos/util';
|
|
18
|
+
} from '@dxos/ui-editor';
|
|
19
|
+
import { mx } from '@dxos/ui-theme';
|
|
20
|
+
import { isTruthy } from '@dxos/util';
|
|
23
21
|
|
|
24
|
-
import { transcript } from './transcript-extension';
|
|
25
22
|
import { type SerializationModel } from '../../model';
|
|
26
|
-
import {
|
|
23
|
+
import { renderByline } from '../../util';
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
(identities: Identity[]) =>
|
|
30
|
-
(message: DataType.Message, index: number, debug = false): string[] => {
|
|
31
|
-
if (message.sender.role === 'assistant') {
|
|
32
|
-
// Start/stop block.
|
|
33
|
-
return [message.blocks.find((block) => block.type === 'transcription')?.text ?? '', ''];
|
|
34
|
-
}
|
|
25
|
+
import { transcript } from './transcript-extension';
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
// TODO(burdon): Color and avatar.
|
|
38
|
-
const identity = identities.find((identity) => identity.did === message.sender.identityDid);
|
|
39
|
-
const name =
|
|
40
|
-
identity?.profile?.displayName ??
|
|
41
|
-
message.sender.contact?.target?.fullName ??
|
|
42
|
-
message.sender.name ??
|
|
43
|
-
message.sender.email ??
|
|
44
|
-
message.sender.identityDid;
|
|
45
|
-
const blocks = message.blocks.filter((block) => block.type === 'transcription');
|
|
46
|
-
return [
|
|
47
|
-
`###### ${name}` + (debug ? ` [${index}]:${message.id}` : ''),
|
|
48
|
-
blocks.map((block) => block.text.trim()).join(' '),
|
|
49
|
-
'',
|
|
50
|
-
];
|
|
51
|
-
};
|
|
27
|
+
export { renderByline };
|
|
52
28
|
|
|
53
|
-
export type
|
|
54
|
-
transcript?:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// TODO(wittjosiah): Move to container.
|
|
29
|
+
export type TranscriptViewProps = ThemedClassName<{
|
|
30
|
+
transcript?: Transcript.Transcript;
|
|
31
|
+
model: SerializationModel<Message.Message>;
|
|
32
|
+
// TODO(burdon): Are these still in use?
|
|
58
33
|
attendableId?: string;
|
|
59
34
|
ignoreAttention?: boolean;
|
|
60
35
|
}>;
|
|
@@ -62,39 +37,30 @@ export type TranscriptProps = ThemedClassName<{
|
|
|
62
37
|
/**
|
|
63
38
|
* Transcript component implemented using the editor.
|
|
64
39
|
*/
|
|
65
|
-
export const
|
|
66
|
-
classNames,
|
|
67
|
-
transcript: object,
|
|
68
|
-
space,
|
|
69
|
-
model,
|
|
70
|
-
attendableId,
|
|
71
|
-
ignoreAttention,
|
|
72
|
-
}: TranscriptProps) => {
|
|
40
|
+
export const TranscriptView = ({ classNames, transcript: object, model }: TranscriptViewProps) => {
|
|
73
41
|
const { themeMode } = useThemeContext();
|
|
74
42
|
const { parentRef } = useTextEditor(() => {
|
|
75
43
|
return {
|
|
76
44
|
extensions: [
|
|
77
|
-
createBasicExtensions({ readOnly: true, lineWrapping: true }),
|
|
78
|
-
createMarkdownExtensions(
|
|
79
|
-
createThemeExtensions({ themeMode }),
|
|
45
|
+
createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
|
|
46
|
+
createMarkdownExtensions(),
|
|
47
|
+
createThemeExtensions({ themeMode, slots: editorSlots }),
|
|
80
48
|
decorateMarkdown(),
|
|
81
|
-
|
|
49
|
+
preview(),
|
|
82
50
|
transcript({
|
|
83
51
|
model,
|
|
84
52
|
started: object?.started ? new Date(object.started) : undefined,
|
|
85
|
-
renderButton: createRenderer(({ onClick }) => (
|
|
86
|
-
<IconButton icon='ph--arrow-line-down--regular' iconOnly label='Scroll to bottom' onClick={onClick} />
|
|
87
|
-
)),
|
|
88
53
|
}),
|
|
89
|
-
|
|
54
|
+
autoScroll(),
|
|
55
|
+
].filter(isTruthy),
|
|
90
56
|
};
|
|
91
|
-
}, [
|
|
57
|
+
}, [model]);
|
|
92
58
|
|
|
93
59
|
return (
|
|
94
60
|
<div
|
|
95
61
|
ref={parentRef}
|
|
96
|
-
className={mx('flex grow overflow-hidden',
|
|
97
|
-
data-popover-collision-boundary={true}
|
|
62
|
+
className={mx('flex grow overflow-hidden container-max-width', classNames)}
|
|
63
|
+
data-popover-collision-boundary={true /* TODO(thure): Make this a constant and document it. */}
|
|
98
64
|
/>
|
|
99
65
|
);
|
|
100
66
|
};
|
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { intervalToDuration } from 'date-fns/intervalToDuration';
|
|
6
|
-
import
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
7
|
import { yieldOrContinue } from 'main-thread-scheduling';
|
|
8
|
-
import React, { type FC, useCallback, useEffect, useMemo, useRef, useState
|
|
8
|
+
import React, { type FC, type WheelEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
import { type OnResizeCallback, useResizeDetector } from 'react-resize-detector';
|
|
10
10
|
|
|
11
11
|
import { Type } from '@dxos/echo';
|
|
12
12
|
import { IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
13
13
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
14
14
|
import {
|
|
15
|
+
type DxGridAxisMeta,
|
|
15
16
|
type DxGridCellValue,
|
|
16
17
|
type DxGridElement,
|
|
17
|
-
type DxGridAxisMeta,
|
|
18
18
|
type DxGridPlaneCells,
|
|
19
19
|
Grid,
|
|
20
20
|
toPlaneCellIndex,
|
|
21
21
|
} from '@dxos/react-ui-grid';
|
|
22
|
-
import { mx } from '@dxos/
|
|
22
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import { meta } from '../../../meta';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Transcription fragment.
|
|
@@ -43,7 +43,7 @@ const TranscriptBlock = Schema.Struct({
|
|
|
43
43
|
authorHue: Schema.optional(Schema.String), // TOOD(burdon): Remove.
|
|
44
44
|
segments: Schema.Array(TranscriptSegment),
|
|
45
45
|
}).pipe(
|
|
46
|
-
Type.
|
|
46
|
+
Type.object({
|
|
47
47
|
typename: 'dxos.org/type/TranscriptBlock',
|
|
48
48
|
version: '0.1.0',
|
|
49
49
|
}),
|
|
@@ -115,7 +115,7 @@ const measureRows = async (
|
|
|
115
115
|
return result;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
export type
|
|
118
|
+
export type TranscriptViewProps = ThemedClassName<{
|
|
119
119
|
blocks?: TranscriptBlock[];
|
|
120
120
|
attendableId?: string;
|
|
121
121
|
ignoreAttention?: boolean;
|
|
@@ -124,8 +124,8 @@ export type TranscriptProps = ThemedClassName<{
|
|
|
124
124
|
/**
|
|
125
125
|
* @@deprecated
|
|
126
126
|
*/
|
|
127
|
-
export const Transcript: FC<
|
|
128
|
-
const { t } = useTranslation(
|
|
127
|
+
export const Transcript: FC<TranscriptViewProps> = ({ classNames, blocks, attendableId, ignoreAttention }) => {
|
|
128
|
+
const { t } = useTranslation(meta.id);
|
|
129
129
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
130
130
|
const [rows, setRows] = useState<DxGridAxisMeta | undefined>(undefined);
|
|
131
131
|
const [columns, setColumns] = useState<DxGridAxisMeta | undefined>(undefined);
|
|
@@ -144,7 +144,7 @@ export const Transcript: FC<TranscriptProps> = ({ classNames, blocks, attendable
|
|
|
144
144
|
[hasAttention, ignoreAttention],
|
|
145
145
|
);
|
|
146
146
|
|
|
147
|
-
const abortControllerRef = useRef<AbortController>();
|
|
147
|
+
const abortControllerRef = useRef<AbortController>(null);
|
|
148
148
|
|
|
149
149
|
const handleResize = useCallback(
|
|
150
150
|
async ({ entry }: { entry: { target: HTMLDivElement } | null }) => {
|
|
@@ -242,7 +242,7 @@ export const Transcript: FC<TranscriptProps> = ({ classNames, blocks, attendable
|
|
|
242
242
|
ref={setDxGrid}
|
|
243
243
|
/>
|
|
244
244
|
</Grid.Root>
|
|
245
|
-
<div role='none' {...{ inert:
|
|
245
|
+
<div role='none' {...{ inert: true }} aria-hidden className={measureClasses} ref={measureRef} />
|
|
246
246
|
<IconButton
|
|
247
247
|
icon='ph--arrow-line-down--regular'
|
|
248
248
|
iconOnly
|
|
@@ -8,8 +8,7 @@ import { format } from 'date-fns/format';
|
|
|
8
8
|
import { intervalToDuration } from 'date-fns/intervalToDuration';
|
|
9
9
|
|
|
10
10
|
import { type CleanupFn, addEventListener, combine } from '@dxos/async';
|
|
11
|
-
import { type
|
|
12
|
-
import { type DataType } from '@dxos/schema';
|
|
11
|
+
import { type Message } from '@dxos/types';
|
|
13
12
|
|
|
14
13
|
import { DocumentAdapter, type SerializationModel } from '../../model';
|
|
15
14
|
|
|
@@ -17,15 +16,14 @@ import { DocumentAdapter, type SerializationModel } from '../../model';
|
|
|
17
16
|
* Data structure that maps Chunks queue to lines with transcript state.
|
|
18
17
|
*/
|
|
19
18
|
export type TranscriptOptions = {
|
|
20
|
-
model: SerializationModel<
|
|
19
|
+
model: SerializationModel<Message.Message>;
|
|
21
20
|
started?: Date;
|
|
22
|
-
renderButton?: RenderCallback<{ onClick: () => void }>;
|
|
23
21
|
};
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* Scrolling transcript with timestamps.
|
|
27
25
|
*/
|
|
28
|
-
export const transcript = ({ model, started
|
|
26
|
+
export const transcript = ({ model, started }: TranscriptOptions): Extension => {
|
|
29
27
|
return [
|
|
30
28
|
// Show timestamps in the gutter.
|
|
31
29
|
gutter({
|
|
@@ -38,7 +36,7 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
38
36
|
let line = view.state.doc.lineAt(from);
|
|
39
37
|
while (line.from <= to) {
|
|
40
38
|
const block = model.getChunkAtLine(line.number)?.blocks[0];
|
|
41
|
-
const timestamp = block?.
|
|
39
|
+
const timestamp = block?._tag === 'transcript' && block.started;
|
|
42
40
|
if (timestamp) {
|
|
43
41
|
builder.add(line.from, line.from, new TimestampMarker(line.number, new Date(timestamp), start));
|
|
44
42
|
}
|
|
@@ -90,22 +88,6 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
90
88
|
});
|
|
91
89
|
};
|
|
92
90
|
|
|
93
|
-
// Scroll button.
|
|
94
|
-
if (renderButton) {
|
|
95
|
-
this._controls = document.createElement('div');
|
|
96
|
-
this._controls.classList.add('cm-controls', 'transition-opacity', 'duration-300', 'opacity-0');
|
|
97
|
-
view.dom.appendChild(this._controls);
|
|
98
|
-
renderButton(
|
|
99
|
-
this._controls,
|
|
100
|
-
{
|
|
101
|
-
onClick: () => {
|
|
102
|
-
scrollToBottom(false);
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
view,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
91
|
// Event listeners.
|
|
110
92
|
this._cleanup = combine(
|
|
111
93
|
addEventListener(view.scrollDOM, 'scroll', () => {
|
|
@@ -131,7 +113,7 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
131
113
|
);
|
|
132
114
|
}
|
|
133
115
|
|
|
134
|
-
update(
|
|
116
|
+
update(_update: ViewUpdate) {
|
|
135
117
|
// Initial sync.
|
|
136
118
|
if (!this._initialized) {
|
|
137
119
|
this._initialized = true;
|
|
@@ -149,27 +131,12 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
|
|
|
149
131
|
),
|
|
150
132
|
|
|
151
133
|
EditorView.theme({
|
|
152
|
-
'.cm-
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
'.cm-hide-scrollbar': {
|
|
156
|
-
scrollbarWidth: 'none',
|
|
157
|
-
'-ms-overflow-style': 'none',
|
|
158
|
-
},
|
|
159
|
-
'.cm-hide-scrollbar::-webkit-scrollbar': {
|
|
160
|
-
display: 'none',
|
|
161
|
-
},
|
|
162
|
-
'.cm-controls': {
|
|
163
|
-
position: 'absolute',
|
|
164
|
-
bottom: '0.5rem',
|
|
165
|
-
right: '0.5rem',
|
|
166
|
-
zIndex: 1000,
|
|
167
|
-
},
|
|
168
|
-
'.cm-line': {
|
|
169
|
-
paddingRight: '1rem',
|
|
134
|
+
'.cm-gutters': {
|
|
135
|
+
backgroundColor: 'var(--dx-baseSurface)',
|
|
170
136
|
},
|
|
171
137
|
'.cm-timestamp-gutter': {
|
|
172
138
|
width: '6rem',
|
|
139
|
+
paddingLeft: '0.5rem',
|
|
173
140
|
paddingRight: '1rem',
|
|
174
141
|
},
|
|
175
142
|
'.cm-timestamp-gutter > .cm-gutterElement > div': {
|
|
@@ -193,11 +160,11 @@ class TimestampMarker extends GutterMarker {
|
|
|
193
160
|
super();
|
|
194
161
|
}
|
|
195
162
|
|
|
196
|
-
override eq(other: this)
|
|
197
|
-
return
|
|
163
|
+
override eq(other: this) {
|
|
164
|
+
return this._timestamp === other._timestamp;
|
|
198
165
|
}
|
|
199
166
|
|
|
200
|
-
override toDOM(view: EditorView)
|
|
167
|
+
override toDOM(view: EditorView) {
|
|
201
168
|
const el = document.createElement('div');
|
|
202
169
|
el.className = 'text-sm text-subdued hover:bg-hoverSurface cursor-pointer';
|
|
203
170
|
el.textContent = formatTimestamp(this._timestamp, this._started);
|
|
@@ -213,12 +180,12 @@ class TimestampMarker extends GutterMarker {
|
|
|
213
180
|
}
|
|
214
181
|
}
|
|
215
182
|
|
|
216
|
-
const getStartTime = (started?: Date, message?:
|
|
183
|
+
const getStartTime = (started?: Date, message?: Message.Message): Date | undefined => {
|
|
217
184
|
if (started) {
|
|
218
185
|
return started;
|
|
219
186
|
}
|
|
220
187
|
|
|
221
|
-
if (message?.blocks[0]?.
|
|
188
|
+
if (message?.blocks[0]?._tag === 'transcript' && message.blocks[0].started) {
|
|
222
189
|
return new Date(message.blocks[0].started);
|
|
223
190
|
}
|
|
224
191
|
|
|
@@ -2,28 +2,32 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
8
9
|
import { useMembers, useQueue } from '@dxos/react-client/echo';
|
|
9
|
-
import {
|
|
10
|
-
import { type
|
|
10
|
+
import { Layout } from '@dxos/react-ui';
|
|
11
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
11
12
|
|
|
12
|
-
import { Transcript, renderMarkdown } from './Transcript';
|
|
13
13
|
import { useQueueModelAdapter } from '../hooks';
|
|
14
|
-
import {
|
|
14
|
+
import { renderByline } from '../util';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
16
|
+
import { TranscriptView } from './Transcript';
|
|
17
|
+
|
|
18
|
+
export type TranscriptionContainerProps = SurfaceComponentProps<Transcript.Transcript>;
|
|
19
|
+
|
|
20
|
+
export const TranscriptionContainer = ({ role, subject: transcript }: TranscriptionContainerProps) => {
|
|
21
|
+
const attendableId = Obj.getDXN(transcript).toString();
|
|
22
|
+
const db = Obj.getDatabase(transcript);
|
|
23
|
+
const members = useMembers(db?.spaceId).map((member) => member.identity);
|
|
24
|
+
const queue = useQueue<Message.Message>(transcript.queue.dxn, { pollInterval: 1_000 });
|
|
25
|
+
const model = useQueueModelAdapter(renderByline(members), queue);
|
|
22
26
|
|
|
23
27
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
</
|
|
28
|
+
<Layout.Main role={role}>
|
|
29
|
+
<TranscriptView attendableId={attendableId} model={model} transcript={transcript} />
|
|
30
|
+
</Layout.Main>
|
|
27
31
|
);
|
|
28
32
|
};
|
|
29
33
|
|