@dxos/plugin-transcription 0.8.4-main.72ec0f3 → 0.8.4-main.937b3ca
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-6EHKWVS4.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-FTRNMLJZ.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-FTRNMLJZ.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +9 -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-EHT3TE6U.mjs → chunk-ICM7JRCO.mjs} +57 -97
- package/dist/lib/browser/chunk-ICM7JRCO.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-Q5OC3WVG.mjs +72 -0
- package/dist/lib/browser/chunk-Q5OC3WVG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OCI42DWB.mjs → chunk-SYGEFDWO.mjs} +2 -2
- package/dist/lib/browser/{chunk-PVU4XCKI.mjs → chunk-TKFU53OZ.mjs} +17 -23
- package/dist/lib/browser/chunk-TKFU53OZ.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-WBWHO4OH.mjs → chunk-ZZF7ICVM.mjs} +30 -30
- package/dist/lib/browser/chunk-ZZF7ICVM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +59 -72
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-ZUWTU7C5.mjs +22 -0
- package/dist/lib/browser/operation-resolver-ZUWTU7C5.mjs.map +7 -0
- package/dist/lib/browser/react-surface-ZXH5267I.mjs +34 -0
- package/dist/lib/browser/react-surface-ZXH5267I.mjs.map +7 -0
- package/dist/lib/browser/{transcriber-E2KAOXPS.mjs → transcriber-EZZTUCPE.mjs} +17 -13
- package/dist/lib/browser/transcriber-EZZTUCPE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -5
- package/dist/lib/node-esm/{TranscriptContainer-WU3EDQR3.mjs → TranscriptContainer-5YT5W73I.mjs} +5 -4
- package/dist/lib/node-esm/TranscriptContainer-5YT5W73I.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-IOX35YUX.mjs +19 -0
- package/dist/lib/node-esm/blueprint-definition-IOX35YUX.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-7XASA7DX.mjs → chunk-BX2AB7S7.mjs} +57 -97
- package/dist/lib/node-esm/chunk-BX2AB7S7.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-WUHZFRWZ.mjs → chunk-CWP22IHV.mjs} +30 -30
- package/dist/lib/node-esm/chunk-CWP22IHV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UVOYXXDJ.mjs → chunk-EPC27WWV.mjs} +17 -23
- package/dist/lib/node-esm/chunk-EPC27WWV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-X5BKN32O.mjs → chunk-GVAVEVZ6.mjs} +2 -2
- 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/index.mjs +59 -72
- 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-Z72B4H2Q.mjs +23 -0
- package/dist/lib/node-esm/operation-resolver-Z72B4H2Q.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-6GUBZX2V.mjs +35 -0
- package/dist/lib/node-esm/react-surface-6GUBZX2V.mjs.map +7 -0
- package/dist/lib/node-esm/{transcriber-ZPJM4U2W.mjs → transcriber-RGW3YYT4.mjs} +17 -13
- package/dist/lib/node-esm/transcriber-RGW3YYT4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -5
- 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 +9 -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 -5
- 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 +4 -7
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +2 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +9 -9
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +4 -6
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +3 -3
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +3 -3
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/TranscriptionStory.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 +1 -1
- package/dist/types/src/hooks/useTranscriber.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 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/message-normalizer.d.ts +2 -2
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +501 -456
- package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +4 -4
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +2 -2
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +2 -2
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +6 -3
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptAction.d.ts +22 -20
- package/dist/types/src/types/TranscriptAction.d.ts.map +1 -1
- 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 +2 -1
- package/dist/types/src/types/index.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 +83 -71
- package/src/TranscriptionPlugin.tsx +34 -58
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +25 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +23 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +4 -8
- 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 +27 -0
- package/src/capabilities/transcriber/index.ts +7 -0
- package/src/capabilities/transcriber/transcriber.ts +85 -0
- package/src/components/Transcript/Transcript.stories.tsx +31 -32
- package/src/components/Transcript/Transcript.tsx +8 -36
- package/src/components/Transcript/deprecated/OldTranscript.tsx +2 -2
- package/src/components/TranscriptContainer.tsx +12 -15
- package/src/components/stories/FileTranscription.stories.tsx +21 -26
- package/src/components/stories/KeyWordRecognition.stories.tsx +2 -2
- package/src/components/stories/MicrophoneTranscription.stories.tsx +41 -45
- package/src/components/stories/TranscriptionStory.tsx +1 -4
- package/src/functions/open.ts +5 -5
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +1 -1
- package/src/hooks/useVoiceInput.ts +2 -2
- package/src/index.ts +1 -1
- package/src/meta.ts +2 -2
- package/src/model/model.test.ts +9 -3
- package/src/segments-normalization/message-normalizer.ts +12 -7
- package/src/segments-normalization/normalization.test.ts +0 -5
- package/src/testing/testing.ts +10 -5
- package/src/transcriber/media-stream-recorder.ts +3 -3
- package/src/transcriber/transcriber.browser.test.ts +1 -1
- package/src/transcriber/transcriber.ts +3 -3
- package/src/transcriber/transcription-manager.ts +15 -9
- package/src/types/TranscriptAction.ts +21 -13
- package/src/{capabilities → types}/capabilities.ts +8 -8
- package/src/types/index.ts +2 -1
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-EKSP5DQ6.mjs +0 -11
- package/dist/lib/browser/blueprint-definition-WBWHO4OH.mjs.map +0 -7
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs +0 -16
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-EHT3TE6U.mjs.map +0 -7
- package/dist/lib/browser/chunk-PVU4XCKI.mjs.map +0 -7
- package/dist/lib/browser/chunk-VBUIO677.mjs +0 -29
- package/dist/lib/browser/chunk-VBUIO677.mjs.map +0 -7
- package/dist/lib/browser/chunk-W7WKZTM4.mjs +0 -63
- package/dist/lib/browser/chunk-W7WKZTM4.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs +0 -25
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NARMYO2O.mjs +0 -34
- package/dist/lib/browser/react-surface-NARMYO2O.mjs.map +0 -7
- package/dist/lib/browser/transcriber-E2KAOXPS.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-WUHZFRWZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7XASA7DX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs +0 -64
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs +0 -17
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UVOYXXDJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs +0 -30
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-5MQA3IUS.mjs +0 -35
- package/dist/lib/node-esm/react-surface-5MQA3IUS.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-ZPJM4U2W.mjs.map +0 -7
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- 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/Transcript.d.ts +0 -30
- package/dist/types/src/types/Transcript.d.ts.map +0 -1
- package/src/capabilities/blueprint-definition.ts +0 -31
- package/src/capabilities/intent-resolver.ts +0 -18
- package/src/capabilities/react-surface.tsx +0 -22
- package/src/capabilities/transcriber.ts +0 -77
- package/src/types/Transcript.ts +0 -44
- /package/dist/lib/browser/{TranscriptContainer-EKSP5DQ6.mjs.map → TranscriptContainer-6EHKWVS4.mjs.map} +0 -0
- /package/dist/lib/{node-esm/TranscriptContainer-WU3EDQR3.mjs.map → browser/blueprints/index.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-OCI42DWB.mjs.map → chunk-SYGEFDWO.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-X5BKN32O.mjs.map → chunk-GVAVEVZ6.mjs.map} +0 -0
|
@@ -3,23 +3,20 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Key } from '@dxos/echo';
|
|
11
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
12
12
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
13
|
-
import {
|
|
14
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
15
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
13
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
14
|
import { faker } from '@dxos/random';
|
|
17
15
|
import { useMembers, useSpace } from '@dxos/react-client/echo';
|
|
18
16
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
19
17
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
20
18
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
21
|
-
import {
|
|
22
|
-
import { Testing } from '@dxos/schema/testing';
|
|
19
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
23
20
|
import { type Message, Organization, Person } from '@dxos/types';
|
|
24
21
|
|
|
25
22
|
import { useQueueModelAdapter } from '../../hooks';
|
|
@@ -31,8 +28,9 @@ import {
|
|
|
31
28
|
useTestTranscriptionQueueWithEntityExtraction,
|
|
32
29
|
} from '../../testing';
|
|
33
30
|
import { translations } from '../../translations';
|
|
31
|
+
import { renderByline } from '../../util';
|
|
34
32
|
|
|
35
|
-
import { TranscriptView, type TranscriptViewProps
|
|
33
|
+
import { TranscriptView, type TranscriptViewProps } from './Transcript';
|
|
36
34
|
|
|
37
35
|
faker.seed(1);
|
|
38
36
|
|
|
@@ -45,10 +43,10 @@ const TranscriptContainer: FC<
|
|
|
45
43
|
onRunningChange: (running: boolean) => void;
|
|
46
44
|
onReset?: () => void;
|
|
47
45
|
}
|
|
48
|
-
> = ({
|
|
46
|
+
> = ({ model, running, onRunningChange, onReset }) => {
|
|
49
47
|
return (
|
|
50
48
|
<div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
|
|
51
|
-
<TranscriptView
|
|
49
|
+
<TranscriptView model={model} />
|
|
52
50
|
<div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
|
|
53
51
|
<div className='flex items-center'>
|
|
54
52
|
<SyntaxHighlighter language='json' className='text-sm'>
|
|
@@ -137,19 +135,12 @@ const QueueStory = ({
|
|
|
137
135
|
}: StoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
|
|
138
136
|
const [running, setRunning] = useState(true);
|
|
139
137
|
const space = useSpace();
|
|
140
|
-
const members = useMembers(space?.
|
|
138
|
+
const members = useMembers(space?.id).map((member) => member.identity);
|
|
141
139
|
const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
|
|
142
140
|
const model = useQueueModelAdapter(renderByline(members), queue, initialMessages);
|
|
143
141
|
|
|
144
142
|
return (
|
|
145
|
-
<TranscriptContainer
|
|
146
|
-
space={space}
|
|
147
|
-
model={model}
|
|
148
|
-
running={running}
|
|
149
|
-
onRunningChange={setRunning}
|
|
150
|
-
onReset={onReset}
|
|
151
|
-
{...props}
|
|
152
|
-
/>
|
|
143
|
+
<TranscriptContainer model={model} running={running} onRunningChange={setRunning} onReset={onReset} {...props} />
|
|
153
144
|
);
|
|
154
145
|
};
|
|
155
146
|
|
|
@@ -161,7 +152,7 @@ const EntityExtractionQueueStory = () => {
|
|
|
161
152
|
const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
|
|
162
153
|
const model = useQueueModelAdapter(renderByline(members), queue, []);
|
|
163
154
|
|
|
164
|
-
return <TranscriptContainer
|
|
155
|
+
return <TranscriptContainer model={model} running={running} onRunningChange={setRunning} />;
|
|
165
156
|
};
|
|
166
157
|
|
|
167
158
|
/**
|
|
@@ -183,20 +174,17 @@ const meta = {
|
|
|
183
174
|
withTheme,
|
|
184
175
|
withPluginManager({
|
|
185
176
|
plugins: [
|
|
177
|
+
...corePlugins(),
|
|
178
|
+
StorybookPlugin({}),
|
|
186
179
|
ClientPlugin({
|
|
187
|
-
types: [TestItem,
|
|
188
|
-
onClientInitialized:
|
|
189
|
-
|
|
190
|
-
|
|
180
|
+
types: [TestItem, TestSchema.DocumentType, Person.Person, Organization.Organization],
|
|
181
|
+
onClientInitialized: ({ client }) =>
|
|
182
|
+
Effect.gen(function* () {
|
|
183
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
184
|
+
}),
|
|
191
185
|
}),
|
|
192
|
-
SpacePlugin({}),
|
|
193
|
-
IntentPlugin(),
|
|
194
|
-
SettingsPlugin(),
|
|
195
186
|
|
|
196
|
-
// UI
|
|
197
187
|
PreviewPlugin(),
|
|
198
|
-
ThemePlugin({ tx: defaultTx }),
|
|
199
|
-
StorybookLayoutPlugin({}),
|
|
200
188
|
],
|
|
201
189
|
}),
|
|
202
190
|
],
|
|
@@ -208,12 +196,23 @@ const meta = {
|
|
|
208
196
|
|
|
209
197
|
export default meta;
|
|
210
198
|
|
|
211
|
-
|
|
212
|
-
|
|
199
|
+
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
200
|
+
const DefaultStory = (props: StoryProps) => {
|
|
201
|
+
const [messages, setMessages] = useState<Message.Message[]>([]);
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
void Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())).then(setMessages);
|
|
204
|
+
}, []);
|
|
205
|
+
if (messages.length === 0) {
|
|
206
|
+
return <div>Loading messages...</div>;
|
|
207
|
+
}
|
|
208
|
+
return <BasicStory {...props} messages={messages} />;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const Default: StoryObj<typeof DefaultStory> = {
|
|
212
|
+
render: DefaultStory,
|
|
213
213
|
args: {
|
|
214
214
|
ignoreAttention: true,
|
|
215
215
|
attendableId: 'story',
|
|
216
|
-
messages: await Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())),
|
|
217
216
|
},
|
|
218
217
|
};
|
|
219
218
|
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
-
import { type Identity } from '@dxos/react-client/halo';
|
|
9
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
11
|
autoScroll,
|
|
12
12
|
createBasicExtensions,
|
|
@@ -15,46 +15,18 @@ import {
|
|
|
15
15
|
decorateMarkdown,
|
|
16
16
|
editorSlots,
|
|
17
17
|
preview,
|
|
18
|
-
|
|
19
|
-
} from '@dxos/
|
|
20
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
21
|
-
import { type Message } from '@dxos/types';
|
|
18
|
+
} from '@dxos/ui-editor';
|
|
19
|
+
import { mx } from '@dxos/ui-theme';
|
|
22
20
|
import { isTruthy } from '@dxos/util';
|
|
23
21
|
|
|
24
22
|
import { type SerializationModel } from '../../model';
|
|
25
|
-
import {
|
|
23
|
+
import { renderByline } from '../../util';
|
|
26
24
|
|
|
27
25
|
import { transcript } from './transcript-extension';
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
export const renderByline =
|
|
31
|
-
(identities: Identity[]) =>
|
|
32
|
-
(message: Message.Message, index: number, debug = false): string[] => {
|
|
33
|
-
if (message.sender.role === 'assistant') {
|
|
34
|
-
// Start/stop block.
|
|
35
|
-
return [message.blocks.find((block) => block._tag === 'transcript')?.text ?? '', ''];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// TODO(burdon): Use link/reference markup for users (with popover).
|
|
39
|
-
// TODO(burdon): Color and avatar.
|
|
40
|
-
const identity = identities.find((identity) => identity.did === message.sender.identityDid);
|
|
41
|
-
const name =
|
|
42
|
-
identity?.profile?.displayName ??
|
|
43
|
-
message.sender.contact?.target?.fullName ??
|
|
44
|
-
message.sender.name ??
|
|
45
|
-
message.sender.email ??
|
|
46
|
-
message.sender.identityDid;
|
|
47
|
-
const blocks = message.blocks.filter((block) => block._tag === 'transcript');
|
|
48
|
-
return [
|
|
49
|
-
// TODO(thure): Use an XML tag with the bits needed here.
|
|
50
|
-
`###### ${name}` + (debug ? ` [${index}]:${message.id}` : ''),
|
|
51
|
-
blocks.map((block) => block.text.trim()).join(' '),
|
|
52
|
-
'',
|
|
53
|
-
];
|
|
54
|
-
};
|
|
27
|
+
export { renderByline };
|
|
55
28
|
|
|
56
29
|
export type TranscriptViewProps = ThemedClassName<{
|
|
57
|
-
space?: Space;
|
|
58
30
|
transcript?: Transcript.Transcript;
|
|
59
31
|
model: SerializationModel<Message.Message>;
|
|
60
32
|
// TODO(burdon): Are these still in use?
|
|
@@ -65,7 +37,7 @@ export type TranscriptViewProps = ThemedClassName<{
|
|
|
65
37
|
/**
|
|
66
38
|
* Transcript component implemented using the editor.
|
|
67
39
|
*/
|
|
68
|
-
export const TranscriptView = ({ classNames,
|
|
40
|
+
export const TranscriptView = ({ classNames, transcript: object, model }: TranscriptViewProps) => {
|
|
69
41
|
const { themeMode } = useThemeContext();
|
|
70
42
|
const { parentRef } = useTextEditor(() => {
|
|
71
43
|
return {
|
|
@@ -82,7 +54,7 @@ export const TranscriptView = ({ classNames, space, transcript: object, model }:
|
|
|
82
54
|
autoScroll(),
|
|
83
55
|
].filter(isTruthy),
|
|
84
56
|
};
|
|
85
|
-
}, [
|
|
57
|
+
}, [model]);
|
|
86
58
|
|
|
87
59
|
return (
|
|
88
60
|
<div
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
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
24
|
import { meta } from '../../../meta';
|
|
25
25
|
|
|
@@ -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
|
}),
|
|
@@ -4,33 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
import { useMembers, useQueue } from '@dxos/react-client/echo';
|
|
10
|
-
import {
|
|
11
|
-
import { type Message } from '@dxos/types';
|
|
10
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
11
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
12
12
|
|
|
13
13
|
import { useQueueModelAdapter } from '../hooks';
|
|
14
|
-
import {
|
|
14
|
+
import { renderByline } from '../util';
|
|
15
15
|
|
|
16
|
-
import { TranscriptView
|
|
16
|
+
import { TranscriptView } from './Transcript';
|
|
17
17
|
|
|
18
|
-
export type TranscriptionContainerProps =
|
|
19
|
-
role: string;
|
|
20
|
-
transcript: Transcript.Transcript;
|
|
21
|
-
};
|
|
18
|
+
export type TranscriptionContainerProps = SurfaceComponentProps<Transcript.Transcript>;
|
|
22
19
|
|
|
23
|
-
export const TranscriptionContainer = ({ transcript }: TranscriptionContainerProps) => {
|
|
20
|
+
export const TranscriptionContainer = ({ role, subject: transcript }: TranscriptionContainerProps) => {
|
|
24
21
|
const attendableId = Obj.getDXN(transcript).toString();
|
|
25
|
-
const
|
|
26
|
-
const members = useMembers(
|
|
22
|
+
const db = Obj.getDatabase(transcript);
|
|
23
|
+
const members = useMembers(db?.spaceId).map((member) => member.identity);
|
|
27
24
|
const queue = useQueue<Message.Message>(transcript.queue.dxn, { pollInterval: 1_000 });
|
|
28
25
|
const model = useQueueModelAdapter(renderByline(members), queue);
|
|
29
26
|
|
|
30
27
|
return (
|
|
31
|
-
<
|
|
32
|
-
<TranscriptView attendableId={attendableId}
|
|
33
|
-
</
|
|
28
|
+
<Layout.Main role={role}>
|
|
29
|
+
<TranscriptView attendableId={attendableId} model={model} transcript={transcript} />
|
|
30
|
+
</Layout.Main>
|
|
34
31
|
);
|
|
35
32
|
};
|
|
36
33
|
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
9
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
11
|
import { scheduleTask } from '@dxos/async';
|
|
11
12
|
import { Context } from '@dxos/context';
|
|
@@ -16,21 +17,18 @@ import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
|
16
17
|
import { log } from '@dxos/log';
|
|
17
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
18
19
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
19
|
-
import {
|
|
20
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
21
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
22
21
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
23
|
-
import {
|
|
24
|
-
import { Testing } from '@dxos/schema/testing';
|
|
22
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
25
23
|
import { type Actor, Message, Organization, Person } from '@dxos/types';
|
|
26
24
|
import { seedTestData } from '@dxos/types/testing';
|
|
27
25
|
|
|
28
26
|
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '../../hooks';
|
|
29
27
|
import { MessageNormalizer, getActorId } from '../../segments-normalization';
|
|
30
28
|
import { TestItem } from '../../testing';
|
|
31
|
-
import { type
|
|
29
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
32
30
|
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
33
|
-
import { renderByline } from '
|
|
31
|
+
import { renderByline } from '../../util';
|
|
34
32
|
|
|
35
33
|
import { TranscriptionStory } from './TranscriptionStory';
|
|
36
34
|
import { useIsSpeaking } from './useIsSpeaking';
|
|
@@ -46,8 +44,8 @@ const AudioFile = ({
|
|
|
46
44
|
detectSpeaking?: boolean;
|
|
47
45
|
normalizeSentences?: boolean;
|
|
48
46
|
audioUrl: string;
|
|
49
|
-
transcriberConfig?:
|
|
50
|
-
recorderConfig?:
|
|
47
|
+
transcriberConfig?: TranscriberProps['config'];
|
|
48
|
+
recorderConfig?: MediaStreamRecorderProps['config'];
|
|
51
49
|
audioConstraints?: MediaTrackConstraints;
|
|
52
50
|
}) => {
|
|
53
51
|
const [running, setRunning] = useState(false);
|
|
@@ -83,7 +81,7 @@ const AudioFile = ({
|
|
|
83
81
|
const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
|
|
84
82
|
|
|
85
83
|
const model = useQueueModelAdapter(renderByline([]), queue);
|
|
86
|
-
const handleSegments = useCallback<
|
|
84
|
+
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
87
85
|
async (blocks) => {
|
|
88
86
|
void queue?.append([
|
|
89
87
|
Obj.make(Message.Message, {
|
|
@@ -189,29 +187,26 @@ const meta = {
|
|
|
189
187
|
title: 'plugins/plugin-transcription/FileTranscription',
|
|
190
188
|
decorators: [
|
|
191
189
|
withTheme,
|
|
192
|
-
withLayout({
|
|
190
|
+
withLayout({ layout: 'column' }),
|
|
193
191
|
withPluginManager({
|
|
194
192
|
plugins: [
|
|
193
|
+
...corePlugins(),
|
|
194
|
+
StorybookPlugin({}),
|
|
195
195
|
ClientPlugin({
|
|
196
|
-
types: [TestItem, Person.Person, Organization.Organization,
|
|
197
|
-
onClientInitialized:
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
196
|
+
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
197
|
+
onClientInitialized: ({ client }) =>
|
|
198
|
+
Effect.gen(function* () {
|
|
199
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
200
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
201
|
+
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
202
|
+
yield* Effect.promise(() => seedTestData(client.spaces.default));
|
|
203
|
+
}),
|
|
203
204
|
}),
|
|
204
|
-
SpacePlugin({}),
|
|
205
|
-
IntentPlugin(),
|
|
206
205
|
|
|
207
|
-
// UI
|
|
208
|
-
ThemePlugin({ tx: defaultTx }),
|
|
209
|
-
SettingsPlugin(),
|
|
210
206
|
PreviewPlugin(),
|
|
211
207
|
TranscriptionPlugin(),
|
|
212
|
-
StorybookLayoutPlugin({}),
|
|
213
208
|
],
|
|
214
|
-
fireEvents: [
|
|
209
|
+
fireEvents: [Common.ActivationEvent.SetupAppGraph],
|
|
215
210
|
}),
|
|
216
211
|
],
|
|
217
212
|
} satisfies Meta;
|
|
@@ -8,7 +8,7 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
import { Toolbar } from '@dxos/react-ui';
|
|
10
10
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
-
import { mx } from '@dxos/
|
|
11
|
+
import { mx } from '@dxos/ui-theme';
|
|
12
12
|
|
|
13
13
|
type Word = {
|
|
14
14
|
text: string;
|
|
@@ -118,7 +118,7 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
118
118
|
const meta = {
|
|
119
119
|
title: 'plugins/plugin-transcription/KeyWordDetection',
|
|
120
120
|
render: DefaultStory,
|
|
121
|
-
decorators: [withTheme, withLayout({
|
|
121
|
+
decorators: [withTheme, withLayout({ layout: 'column' })],
|
|
122
122
|
} satisfies Meta<typeof DefaultStory>;
|
|
123
123
|
|
|
124
124
|
export default meta;
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
9
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
11
|
import {
|
|
11
12
|
type ExtractionFunction,
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
getNer,
|
|
15
16
|
processTranscriptMessage,
|
|
16
17
|
} from '@dxos/assistant/extraction';
|
|
17
|
-
import { Filter,
|
|
18
|
+
import { Filter, type Obj } from '@dxos/echo';
|
|
18
19
|
import { createQueueDXN } from '@dxos/echo/internal';
|
|
19
20
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
20
21
|
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
@@ -22,21 +23,18 @@ import { invariant } from '@dxos/invariant';
|
|
|
22
23
|
import { log } from '@dxos/log';
|
|
23
24
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
24
25
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
25
|
-
import {
|
|
26
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
27
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
26
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
28
27
|
import { IndexKind, useSpace } from '@dxos/react-client/echo';
|
|
29
28
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
30
|
-
import {
|
|
31
|
-
import { Testing } from '@dxos/schema/testing';
|
|
29
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
32
30
|
import { Message, Organization, Person } from '@dxos/types';
|
|
33
31
|
import { seedTestData } from '@dxos/types/testing';
|
|
34
32
|
|
|
35
33
|
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '../../hooks';
|
|
36
34
|
import { TestItem } from '../../testing';
|
|
37
|
-
import { type
|
|
35
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
38
36
|
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
39
|
-
import { renderByline } from '
|
|
37
|
+
import { renderByline } from '../../util';
|
|
40
38
|
|
|
41
39
|
import { TranscriptionStory } from './TranscriptionStory';
|
|
42
40
|
import { useIsSpeaking } from './useIsSpeaking';
|
|
@@ -52,8 +50,8 @@ const RECORDER_CONFIG = {
|
|
|
52
50
|
|
|
53
51
|
type StoryProps = {
|
|
54
52
|
detectSpeaking?: boolean;
|
|
55
|
-
transcriberConfig:
|
|
56
|
-
recorderConfig:
|
|
53
|
+
transcriberConfig: TranscriberProps['config'];
|
|
54
|
+
recorderConfig: MediaStreamRecorderProps['config'];
|
|
57
55
|
audioConstraints?: MediaTrackConstraints;
|
|
58
56
|
entityExtraction: 'none' | 'ner' | 'llm';
|
|
59
57
|
};
|
|
@@ -95,7 +93,7 @@ const DefaultStory = ({
|
|
|
95
93
|
|
|
96
94
|
let executor: FunctionExecutor | undefined;
|
|
97
95
|
let extractionFunction: ExtractionFunction | undefined;
|
|
98
|
-
let objects: Promise<
|
|
96
|
+
let objects: Promise<Obj.Unknown[]> | undefined;
|
|
99
97
|
|
|
100
98
|
if (entityExtraction === 'ner') {
|
|
101
99
|
// Init model loading. Takes time.
|
|
@@ -108,11 +106,10 @@ const DefaultStory = ({
|
|
|
108
106
|
Filter.or(
|
|
109
107
|
Filter.type(Person.Person),
|
|
110
108
|
Filter.type(Organization.Organization),
|
|
111
|
-
Filter.type(
|
|
109
|
+
Filter.type(TestSchema.DocumentType),
|
|
112
110
|
),
|
|
113
111
|
)
|
|
114
|
-
.run()
|
|
115
|
-
.then((result) => result.objects);
|
|
112
|
+
.run();
|
|
116
113
|
}
|
|
117
114
|
if (entityExtraction !== 'none') {
|
|
118
115
|
executor = new FunctionExecutor(
|
|
@@ -131,9 +128,9 @@ const DefaultStory = ({
|
|
|
131
128
|
}, [entityExtraction, space]);
|
|
132
129
|
|
|
133
130
|
// Transcriber.
|
|
134
|
-
const handleSegments = useCallback<
|
|
131
|
+
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
135
132
|
async (blocks) => {
|
|
136
|
-
const message =
|
|
133
|
+
const message = Message.make({
|
|
137
134
|
sender: { name: 'You' },
|
|
138
135
|
created: new Date().toISOString(),
|
|
139
136
|
blocks,
|
|
@@ -197,42 +194,41 @@ const meta = {
|
|
|
197
194
|
render: DefaultStory,
|
|
198
195
|
decorators: [
|
|
199
196
|
withTheme,
|
|
200
|
-
withLayout({
|
|
197
|
+
withLayout({ layout: 'column' }),
|
|
201
198
|
withPluginManager({
|
|
202
199
|
plugins: [
|
|
200
|
+
...corePlugins(),
|
|
201
|
+
StorybookPlugin({}),
|
|
203
202
|
ClientPlugin({
|
|
204
|
-
types: [TestItem, Person.Person, Organization.Organization,
|
|
205
|
-
onClientInitialized:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
203
|
+
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
204
|
+
onClientInitialized: ({ client }) =>
|
|
205
|
+
Effect.gen(function* () {
|
|
206
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
207
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
208
|
+
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
209
|
+
// TODO(mykola): Make API easier to use.
|
|
210
|
+
// TODO(mykola): Delete after enabling vector indexing by default.
|
|
211
|
+
// Enable vector indexing.
|
|
212
|
+
yield* Effect.promise(() =>
|
|
213
|
+
client.services.services.QueryService!.setConfig({
|
|
214
|
+
enabled: true,
|
|
215
|
+
indexes: [
|
|
216
|
+
//
|
|
217
|
+
{ kind: IndexKind.Kind.SCHEMA_MATCH },
|
|
218
|
+
{ kind: IndexKind.Kind.GRAPH },
|
|
219
|
+
{ kind: IndexKind.Kind.VECTOR },
|
|
220
|
+
],
|
|
221
|
+
}),
|
|
222
|
+
);
|
|
223
|
+
yield* Effect.promise(() => client.services.services.QueryService!.reindex());
|
|
224
|
+
yield* Effect.promise(() => seedTestData(client.spaces.default));
|
|
225
|
+
}),
|
|
224
226
|
}),
|
|
225
|
-
SpacePlugin({}),
|
|
226
|
-
IntentPlugin(),
|
|
227
|
-
SettingsPlugin(),
|
|
228
227
|
|
|
229
|
-
// UI
|
|
230
|
-
ThemePlugin({ tx: defaultTx }),
|
|
231
228
|
PreviewPlugin(),
|
|
232
229
|
TranscriptionPlugin(),
|
|
233
|
-
StorybookLayoutPlugin({}),
|
|
234
230
|
],
|
|
235
|
-
fireEvents: [
|
|
231
|
+
fireEvents: [Common.ActivationEvent.SetupAppGraph],
|
|
236
232
|
}),
|
|
237
233
|
],
|
|
238
234
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -6,7 +6,6 @@ import '@dxos-theme';
|
|
|
6
6
|
|
|
7
7
|
import React, { type Dispatch, type FC, type RefObject, type SetStateAction } from 'react';
|
|
8
8
|
|
|
9
|
-
import { useSpace } from '@dxos/react-client/echo';
|
|
10
9
|
import { IconButton, ScrollContainer, Toolbar } from '@dxos/react-ui';
|
|
11
10
|
import { type Message } from '@dxos/types';
|
|
12
11
|
|
|
@@ -20,8 +19,6 @@ export const TranscriptionStory: FC<{
|
|
|
20
19
|
onRunningChange: Dispatch<SetStateAction<boolean>>;
|
|
21
20
|
audioRef?: RefObject<HTMLAudioElement | null>;
|
|
22
21
|
}> = ({ model, running, onRunningChange, audioRef, disabled }) => {
|
|
23
|
-
const space = useSpace();
|
|
24
|
-
|
|
25
22
|
return (
|
|
26
23
|
<div className='flex flex-col is-[30rem]'>
|
|
27
24
|
{audioRef && <audio ref={audioRef} autoPlay />}
|
|
@@ -36,7 +33,7 @@ export const TranscriptionStory: FC<{
|
|
|
36
33
|
</Toolbar.Root>
|
|
37
34
|
<ScrollContainer.Root pin>
|
|
38
35
|
<ScrollContainer.Viewport>
|
|
39
|
-
<TranscriptView
|
|
36
|
+
<TranscriptView model={model} />
|
|
40
37
|
</ScrollContainer.Viewport>
|
|
41
38
|
</ScrollContainer.Root>
|
|
42
39
|
</div>
|
package/src/functions/open.ts
CHANGED
|
@@ -7,11 +7,11 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
|
|
8
8
|
import { ArtifactId } from '@dxos/assistant';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { Database } from '@dxos/echo';
|
|
11
|
+
import { QueueService, defineFunction } from '@dxos/functions';
|
|
12
|
+
import { Message, Transcript } from '@dxos/types';
|
|
12
13
|
|
|
13
|
-
import { renderByline } from '../
|
|
14
|
-
import { Transcript } from '../types';
|
|
14
|
+
import { renderByline } from '../util';
|
|
15
15
|
|
|
16
16
|
export default defineFunction({
|
|
17
17
|
key: 'dxos.org/function/transcription/open',
|
|
@@ -26,7 +26,7 @@ export default defineFunction({
|
|
|
26
26
|
content: Schema.String,
|
|
27
27
|
}),
|
|
28
28
|
handler: Effect.fn(function* ({ data: { id } }) {
|
|
29
|
-
const transcript = yield*
|
|
29
|
+
const transcript = yield* Database.Service.resolve(ArtifactId.toDXN(id), Transcript.Transcript);
|
|
30
30
|
const { dxn } = yield* Effect.promise(() => transcript.queue.load());
|
|
31
31
|
const queue = yield* QueueService.getQueue(dxn);
|
|
32
32
|
yield* Effect.promise(() => queue?.queryObjects());
|
|
@@ -12,7 +12,7 @@ import { type ChunkRenderer, SerializationModel } from '../model';
|
|
|
12
12
|
/**
|
|
13
13
|
* Model adapter for a queue.
|
|
14
14
|
*/
|
|
15
|
-
export const useQueueModelAdapter = <T extends Obj.
|
|
15
|
+
export const useQueueModelAdapter = <T extends Obj.Unknown>(
|
|
16
16
|
renderer: ChunkRenderer<T>,
|
|
17
17
|
queue: Queue<T> | undefined,
|
|
18
18
|
initialChunks: T[] = [],
|
|
@@ -6,8 +6,8 @@ import { useEffect, useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
8
|
|
|
9
|
-
import { TranscriptionCapabilities } from '../capabilities';
|
|
10
9
|
import { type Transcriber } from '../transcriber';
|
|
10
|
+
import { TranscriptionCapabilities } from '../types';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Records audio while user is speaking and transcribes it after user is done speaking.
|
|
@@ -9,7 +9,7 @@ import { Context } from '@dxos/context';
|
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
10
|
import { useSoundEffect } from '@dxos/react-ui-sfx';
|
|
11
11
|
|
|
12
|
-
import { type
|
|
12
|
+
import { type TranscriberProps } from '../transcriber';
|
|
13
13
|
|
|
14
14
|
import { useAudioTrack } from './useAudioTrack';
|
|
15
15
|
import { useTranscriber } from './useTranscriber';
|
|
@@ -26,7 +26,7 @@ export const useVoiceInput = ({ active, onUpdate }: UseVoiceInputProps) => {
|
|
|
26
26
|
const soundStart = useSoundEffect('StartRecording');
|
|
27
27
|
const soundStop = useSoundEffect('StopRecording');
|
|
28
28
|
|
|
29
|
-
const handleSegments = useCallback<
|
|
29
|
+
const handleSegments = useCallback<TranscriberProps['onSegments']>(async (segments) => {
|
|
30
30
|
const text = segments.map((str) => str.text.trim().replace(/[^\w\s]/g, '')).join(' ');
|
|
31
31
|
onUpdate(text);
|
|
32
32
|
}, []);
|