@dxos/plugin-transcription 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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-RIUSFL62.mjs +112 -0
- package/dist/lib/browser/chunk-RIUSFL62.mjs.map +7 -0
- package/dist/lib/browser/chunk-YXU2ZO6W.mjs +17 -0
- package/dist/lib/browser/chunk-YXU2ZO6W.mjs.map +7 -0
- package/dist/lib/browser/create-IZPB7VZW.mjs +19 -0
- package/dist/lib/browser/create-IZPB7VZW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1154 -60
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-SN5O5I6X.mjs +29 -0
- package/dist/lib/browser/open-SN5O5I6X.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-5MZENAU5.mjs +71 -0
- package/dist/lib/browser/summarize-5MZENAU5.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-3GSFEN4L.mjs +113 -0
- package/dist/lib/node-esm/chunk-3GSFEN4L.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BR2R6PCT.mjs +19 -0
- package/dist/lib/node-esm/chunk-BR2R6PCT.mjs.map +7 -0
- package/dist/lib/node-esm/create-TQDGXQBL.mjs +20 -0
- package/dist/lib/node-esm/create-TQDGXQBL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1154 -60
- 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-4GAAWWKJ.mjs +30 -0
- package/dist/lib/node-esm/open-4GAAWWKJ.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-RVOSRHEC.mjs +72 -0
- package/dist/lib/node-esm/summarize-RVOSRHEC.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -5
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- 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} +10 -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} +12 -12
- 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/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +2 -2
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +2 -2
- 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/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 +3 -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/useTranscriber.d.ts +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- 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 +905 -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/segments-normalization/normalization.d.ts +41 -200
- package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -7
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +86 -65
- package/src/TranscriptionPlugin.tsx +17 -13
- package/src/blueprints/index.ts +1 -1
- package/src/blueprints/transcription-blueprint.ts +13 -8
- package/src/capabilities/blueprint-definition.ts +17 -0
- package/src/capabilities/index.ts +10 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +30 -0
- package/src/capabilities/{transcriber/transcriber.ts → transcriber.ts} +6 -6
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +17 -14
- package/src/components/Transcription/Transcription.tsx +65 -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/components/stories/FileTranscription.stories.tsx +9 -11
- package/src/components/stories/KeyWordRecognition.stories.tsx +6 -6
- package/src/components/stories/MicrophoneTranscription.stories.tsx +13 -31
- package/src/components/stories/TranscriptionStory.tsx +7 -5
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +32 -0
- package/src/containers/TranscriptionContainer/index.ts +7 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useTranscriber.ts +2 -2
- package/src/meta.ts +1 -1
- package/src/model/model.test.ts +6 -6
- package/src/operations/create.ts +22 -0
- package/src/operations/definitions.ts +102 -0
- package/src/operations/index.ts +13 -0
- package/src/operations/open.ts +31 -0
- package/src/{functions → operations}/summarize.ts +41 -47
- package/src/segments-normalization/normalization.test.ts +1 -1
- package/src/segments-normalization/normalization.ts +33 -71
- package/src/testing/testing.ts +1 -11
- package/src/transcriber/transcriber.ts +1 -1
- package/src/translations.ts +7 -7
- package/src/types/capabilities.ts +3 -3
- package/src/types/index.ts +0 -2
- package/dist/lib/browser/TranscriptContainer-6EHKWVS4.mjs +0 -12
- package/dist/lib/browser/TranscriptContainer-6EHKWVS4.mjs.map +0 -7
- 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/TranscriptContainer-5YT5W73I.mjs.map +0 -7
- 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/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/types/TranscriptAction.d.ts +0 -25
- package/dist/types/src/types/TranscriptAction.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/functions/index.ts +0 -6
- package/src/functions/open.ts +0 -39
- package/src/types/TranscriptAction.ts +0 -32
package/src/components/index.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Common } from '@dxos/app-framework';
|
|
10
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
11
|
import { scheduleTask } from '@dxos/async';
|
|
12
12
|
import { Context } from '@dxos/context';
|
|
13
13
|
import { Obj } from '@dxos/echo';
|
|
@@ -16,16 +16,17 @@ import { MemoryQueue } from '@dxos/echo-db';
|
|
|
16
16
|
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
17
17
|
import { log } from '@dxos/log';
|
|
18
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
19
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
19
20
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
20
21
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
21
|
-
import { withLayout
|
|
22
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
22
23
|
import { TestSchema } from '@dxos/schema/testing';
|
|
23
24
|
import { type Actor, Message, Organization, Person } from '@dxos/types';
|
|
24
25
|
import { seedTestData } from '@dxos/types/testing';
|
|
25
26
|
|
|
26
|
-
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '
|
|
27
|
+
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '#hooks';
|
|
27
28
|
import { MessageNormalizer, getActorId } from '../../segments-normalization';
|
|
28
|
-
import { TestItem } from '
|
|
29
|
+
import { TestItem } from '#testing';
|
|
29
30
|
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
30
31
|
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
31
32
|
import { renderByline } from '../../util';
|
|
@@ -184,9 +185,8 @@ const AudioFile = ({
|
|
|
184
185
|
};
|
|
185
186
|
|
|
186
187
|
const meta = {
|
|
187
|
-
title: 'plugins/plugin-transcription/FileTranscription',
|
|
188
|
+
title: 'plugins/plugin-transcription/components/FileTranscription',
|
|
188
189
|
decorators: [
|
|
189
|
-
withTheme,
|
|
190
190
|
withLayout({ layout: 'column' }),
|
|
191
191
|
withPluginManager({
|
|
192
192
|
plugins: [
|
|
@@ -196,17 +196,15 @@ const meta = {
|
|
|
196
196
|
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
197
197
|
onClientInitialized: ({ client }) =>
|
|
198
198
|
Effect.gen(function* () {
|
|
199
|
-
yield*
|
|
200
|
-
yield* Effect.promise(() =>
|
|
201
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
202
|
-
yield* Effect.promise(() => seedTestData(client.spaces.default));
|
|
199
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
200
|
+
yield* Effect.promise(() => seedTestData(personalSpace));
|
|
203
201
|
}),
|
|
204
202
|
}),
|
|
205
203
|
|
|
206
204
|
PreviewPlugin(),
|
|
207
205
|
TranscriptionPlugin(),
|
|
208
206
|
],
|
|
209
|
-
fireEvents: [
|
|
207
|
+
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
210
208
|
}),
|
|
211
209
|
],
|
|
212
210
|
} satisfies Meta;
|
|
@@ -15,11 +15,11 @@ type Word = {
|
|
|
15
15
|
matched: boolean;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type DefaultStoryProps = {
|
|
19
19
|
keywords: string[];
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const DefaultStory = ({ keywords }:
|
|
22
|
+
const DefaultStory = ({ keywords }: DefaultStoryProps) => {
|
|
23
23
|
const [running, setRunning] = useState(false);
|
|
24
24
|
const [matchingWords, setMatchingWords] = useState<Word[]>(keywords.map((word) => ({ text: word, matched: false })));
|
|
25
25
|
|
|
@@ -86,7 +86,7 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
86
86
|
}, [running, recognition]);
|
|
87
87
|
|
|
88
88
|
return (
|
|
89
|
-
<div className={mx('flex flex-col gap-2
|
|
89
|
+
<div className={mx('flex flex-col gap-2 w-[30rem]')}>
|
|
90
90
|
<Toolbar.Root>
|
|
91
91
|
<Toolbar.IconButton
|
|
92
92
|
iconOnly
|
|
@@ -101,7 +101,7 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
101
101
|
<span
|
|
102
102
|
key={index}
|
|
103
103
|
className={mx(
|
|
104
|
-
'
|
|
104
|
+
'px-3 py-1 m-2 rounded-sm border',
|
|
105
105
|
word.matched ? 'bg-red-200 text-red-800 border-red-300' : 'bg-gray-200 text-gray-600 border-gray-300',
|
|
106
106
|
)}
|
|
107
107
|
>
|
|
@@ -116,9 +116,9 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
const meta = {
|
|
119
|
-
title: 'plugins/plugin-transcription/KeyWordDetection',
|
|
119
|
+
title: 'plugins/plugin-transcription/components/KeyWordDetection',
|
|
120
120
|
render: DefaultStory,
|
|
121
|
-
decorators: [withTheme, withLayout({ layout: 'column' })],
|
|
121
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
122
122
|
} satisfies Meta<typeof DefaultStory>;
|
|
123
123
|
|
|
124
124
|
export default meta;
|
|
@@ -6,8 +6,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Common } from '@dxos/app-framework';
|
|
10
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
11
|
import {
|
|
12
12
|
type ExtractionFunction,
|
|
13
13
|
extractionAnthropicFunction,
|
|
@@ -18,20 +18,20 @@ import {
|
|
|
18
18
|
import { Filter, type Obj } from '@dxos/echo';
|
|
19
19
|
import { createQueueDXN } from '@dxos/echo/internal';
|
|
20
20
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
21
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
22
21
|
import { invariant } from '@dxos/invariant';
|
|
23
22
|
import { log } from '@dxos/log';
|
|
24
23
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
24
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
25
25
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
26
26
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
27
27
|
import { IndexKind, useSpace } from '@dxos/react-client/echo';
|
|
28
|
-
import { withLayout
|
|
28
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
29
29
|
import { TestSchema } from '@dxos/schema/testing';
|
|
30
30
|
import { Message, Organization, Person } from '@dxos/types';
|
|
31
31
|
import { seedTestData } from '@dxos/types/testing';
|
|
32
32
|
|
|
33
|
-
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '
|
|
34
|
-
import { TestItem } from '
|
|
33
|
+
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '#hooks';
|
|
34
|
+
import { TestItem } from '#testing';
|
|
35
35
|
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
36
36
|
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
37
37
|
import { renderByline } from '../../util';
|
|
@@ -48,7 +48,7 @@ const RECORDER_CONFIG = {
|
|
|
48
48
|
interval: 200,
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
type
|
|
51
|
+
type DefaultStoryProps = {
|
|
52
52
|
detectSpeaking?: boolean;
|
|
53
53
|
transcriberConfig: TranscriberProps['config'];
|
|
54
54
|
recorderConfig: MediaStreamRecorderProps['config'];
|
|
@@ -62,7 +62,7 @@ const DefaultStory = ({
|
|
|
62
62
|
transcriberConfig,
|
|
63
63
|
recorderConfig,
|
|
64
64
|
audioConstraints,
|
|
65
|
-
}:
|
|
65
|
+
}: DefaultStoryProps) => {
|
|
66
66
|
const [running, setRunning] = useState(false);
|
|
67
67
|
|
|
68
68
|
// Audio.
|
|
@@ -85,13 +85,12 @@ const DefaultStory = ({
|
|
|
85
85
|
}, [space]);
|
|
86
86
|
|
|
87
87
|
// Entity extraction.
|
|
88
|
-
const { extractionFunction,
|
|
88
|
+
const { extractionFunction, objects } = useMemo(() => {
|
|
89
89
|
if (!space) {
|
|
90
90
|
log.warn('no space');
|
|
91
91
|
return {};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
let executor: FunctionExecutor | undefined;
|
|
95
94
|
let extractionFunction: ExtractionFunction | undefined;
|
|
96
95
|
let objects: Promise<Obj.Unknown[]> | undefined;
|
|
97
96
|
|
|
@@ -111,20 +110,8 @@ const DefaultStory = ({
|
|
|
111
110
|
)
|
|
112
111
|
.run();
|
|
113
112
|
}
|
|
114
|
-
if (entityExtraction !== 'none') {
|
|
115
|
-
executor = new FunctionExecutor(
|
|
116
|
-
new ServiceContainer().setServices({
|
|
117
|
-
// ai: {
|
|
118
|
-
// client: new Edge AiServiceClient({
|
|
119
|
-
// endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
120
|
-
// }),
|
|
121
|
-
// },
|
|
122
|
-
// database: { db: space!.db },
|
|
123
|
-
}),
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
113
|
|
|
127
|
-
return { extractionFunction,
|
|
114
|
+
return { extractionFunction, objects };
|
|
128
115
|
}, [entityExtraction, space]);
|
|
129
116
|
|
|
130
117
|
// Transcriber.
|
|
@@ -142,9 +129,7 @@ const DefaultStory = ({
|
|
|
142
129
|
|
|
143
130
|
if (entityExtraction !== 'none') {
|
|
144
131
|
invariant(extractionFunction, 'extractionFunction is required');
|
|
145
|
-
invariant(executor, 'executor is required');
|
|
146
132
|
const result = await processTranscriptMessage({
|
|
147
|
-
executor,
|
|
148
133
|
function: extractionFunction,
|
|
149
134
|
input: {
|
|
150
135
|
message,
|
|
@@ -190,10 +175,9 @@ const DefaultStory = ({
|
|
|
190
175
|
};
|
|
191
176
|
|
|
192
177
|
const meta = {
|
|
193
|
-
title: 'plugins/plugin-transcription/MicrophoneTranscription',
|
|
178
|
+
title: 'plugins/plugin-transcription/components/MicrophoneTranscription',
|
|
194
179
|
render: DefaultStory,
|
|
195
180
|
decorators: [
|
|
196
|
-
withTheme,
|
|
197
181
|
withLayout({ layout: 'column' }),
|
|
198
182
|
withPluginManager({
|
|
199
183
|
plugins: [
|
|
@@ -203,9 +187,7 @@ const meta = {
|
|
|
203
187
|
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
204
188
|
onClientInitialized: ({ client }) =>
|
|
205
189
|
Effect.gen(function* () {
|
|
206
|
-
yield*
|
|
207
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
208
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
190
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
209
191
|
// TODO(mykola): Make API easier to use.
|
|
210
192
|
// TODO(mykola): Delete after enabling vector indexing by default.
|
|
211
193
|
// Enable vector indexing.
|
|
@@ -221,14 +203,14 @@ const meta = {
|
|
|
221
203
|
}),
|
|
222
204
|
);
|
|
223
205
|
yield* Effect.promise(() => client.services.services.QueryService!.reindex());
|
|
224
|
-
yield* Effect.promise(() => seedTestData(
|
|
206
|
+
yield* Effect.promise(() => seedTestData(personalSpace));
|
|
225
207
|
}),
|
|
226
208
|
}),
|
|
227
209
|
|
|
228
210
|
PreviewPlugin(),
|
|
229
211
|
TranscriptionPlugin(),
|
|
230
212
|
],
|
|
231
|
-
fireEvents: [
|
|
213
|
+
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
232
214
|
}),
|
|
233
215
|
],
|
|
234
216
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -10,7 +10,7 @@ import { IconButton, ScrollContainer, Toolbar } from '@dxos/react-ui';
|
|
|
10
10
|
import { type Message } from '@dxos/types';
|
|
11
11
|
|
|
12
12
|
import { type SerializationModel } from '../../model';
|
|
13
|
-
import {
|
|
13
|
+
import { Transcription } from '../Transcription';
|
|
14
14
|
|
|
15
15
|
export const TranscriptionStory: FC<{
|
|
16
16
|
model: SerializationModel<Message.Message>;
|
|
@@ -20,7 +20,7 @@ export const TranscriptionStory: FC<{
|
|
|
20
20
|
audioRef?: RefObject<HTMLAudioElement | null>;
|
|
21
21
|
}> = ({ model, running, onRunningChange, audioRef, disabled }) => {
|
|
22
22
|
return (
|
|
23
|
-
<div className='flex flex-col
|
|
23
|
+
<div className='flex flex-col w-[30rem]'>
|
|
24
24
|
{audioRef && <audio ref={audioRef} autoPlay />}
|
|
25
25
|
<Toolbar.Root>
|
|
26
26
|
<IconButton
|
|
@@ -32,9 +32,11 @@ export const TranscriptionStory: FC<{
|
|
|
32
32
|
/>
|
|
33
33
|
</Toolbar.Root>
|
|
34
34
|
<ScrollContainer.Root pin>
|
|
35
|
-
<ScrollContainer.
|
|
36
|
-
<
|
|
37
|
-
|
|
35
|
+
<ScrollContainer.Content>
|
|
36
|
+
<ScrollContainer.Viewport>
|
|
37
|
+
<Transcription model={model} />
|
|
38
|
+
</ScrollContainer.Viewport>
|
|
39
|
+
</ScrollContainer.Content>
|
|
38
40
|
</ScrollContainer.Root>
|
|
39
41
|
</div>
|
|
40
42
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ObjectSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { 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
|
+
import { renderByline } from '../../util';
|
|
16
|
+
|
|
17
|
+
export type TranscriptionContainerProps = ObjectSurfaceProps<Transcript.Transcript>;
|
|
18
|
+
|
|
19
|
+
export const TranscriptionContainer = ({ role, subject: transcript, attendableId }: TranscriptionContainerProps) => {
|
|
20
|
+
const db = Obj.getDatabase(transcript);
|
|
21
|
+
const members = useMembers(db?.spaceId).map((member) => member.identity);
|
|
22
|
+
const queue = useQueue<Message.Message>(transcript.queue.dxn, { pollInterval: 1_000 });
|
|
23
|
+
const model = useQueueModelAdapter(renderByline(members), queue);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Panel.Root role={role}>
|
|
27
|
+
<Panel.Content asChild>
|
|
28
|
+
<Transcription attendableId={attendableId} model={model} transcript={transcript} />
|
|
29
|
+
</Panel.Content>
|
|
30
|
+
</Panel.Root>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -4,10 +4,10 @@
|
|
|
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
8
|
|
|
9
9
|
import { type Transcriber } from '../transcriber';
|
|
10
|
-
import { TranscriptionCapabilities } from '
|
|
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.
|
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.change(message, (
|
|
55
|
-
|
|
54
|
+
Obj.change(message, (obj) => {
|
|
55
|
+
obj.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.change(message, (
|
|
137
|
-
|
|
136
|
+
Obj.change(message, (obj) => {
|
|
137
|
+
obj.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.change(message, (
|
|
145
|
-
|
|
144
|
+
Obj.change(message, (obj) => {
|
|
145
|
+
obj.blocks.splice(0, 1);
|
|
146
146
|
});
|
|
147
147
|
model.updateChunk(message);
|
|
148
148
|
model.sync(adapter);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/operation';
|
|
8
|
+
import { Transcript } from '@dxos/types';
|
|
9
|
+
|
|
10
|
+
import { Create } from './definitions';
|
|
11
|
+
|
|
12
|
+
const handler: Operation.WithHandler<typeof Create> = Create.pipe(
|
|
13
|
+
Operation.withHandler(
|
|
14
|
+
Effect.fn(function* ({ space }) {
|
|
15
|
+
return {
|
|
16
|
+
object: Transcript.make(space.queues.create().dxn),
|
|
17
|
+
};
|
|
18
|
+
}),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default handler;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { AiService } from '@dxos/ai';
|
|
8
|
+
import { SpaceSchema } from '@dxos/client/echo';
|
|
9
|
+
import { Database, Ref } from '@dxos/echo';
|
|
10
|
+
import { QueueService } from '@dxos/functions';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
|
+
import { Message, Transcript } from '@dxos/types';
|
|
13
|
+
|
|
14
|
+
import { meta } from '#meta';
|
|
15
|
+
|
|
16
|
+
const TRANSCRIPT_OPERATION = `${meta.id}.operation`;
|
|
17
|
+
|
|
18
|
+
export const Create = Operation.make({
|
|
19
|
+
meta: { key: `${TRANSCRIPT_OPERATION}.create`, name: 'Create Transcript' },
|
|
20
|
+
input: Schema.Struct({
|
|
21
|
+
name: Schema.optional(Schema.String),
|
|
22
|
+
space: SpaceSchema,
|
|
23
|
+
}),
|
|
24
|
+
output: Schema.Struct({
|
|
25
|
+
object: Transcript.Transcript,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const MessageWithRangeId = Schema.extend(
|
|
30
|
+
Message.Message,
|
|
31
|
+
Schema.Struct({
|
|
32
|
+
rangeId: Schema.optional(Schema.Array(Schema.String)).annotations({
|
|
33
|
+
description: 'The IDs of the messages that contain the sentences.',
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export type MessageWithRangeIdType = Schema.Schema.Type<typeof MessageWithRangeId>;
|
|
39
|
+
|
|
40
|
+
export const Open = Operation.make({
|
|
41
|
+
meta: {
|
|
42
|
+
key: 'org.dxos.function.transcription.open',
|
|
43
|
+
name: 'Open',
|
|
44
|
+
description: 'Opens and reads the contents of a transcription object.',
|
|
45
|
+
},
|
|
46
|
+
input: Schema.Struct({
|
|
47
|
+
transcript: Ref.Ref(Transcript.Transcript).annotations({
|
|
48
|
+
description: 'The ID of the transcription object.',
|
|
49
|
+
}),
|
|
50
|
+
}),
|
|
51
|
+
output: Schema.Struct({
|
|
52
|
+
content: Schema.String,
|
|
53
|
+
}),
|
|
54
|
+
services: [Database.Service, QueueService],
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const Summarize = Operation.make({
|
|
58
|
+
meta: {
|
|
59
|
+
key: 'org.dxos.function.transcription.summarize',
|
|
60
|
+
name: 'Summarize',
|
|
61
|
+
description: 'Summarize a transcript of a meeting.',
|
|
62
|
+
},
|
|
63
|
+
input: Schema.Struct({
|
|
64
|
+
transcript: Schema.String.annotations({
|
|
65
|
+
description: 'The transcript of the meeting.',
|
|
66
|
+
}),
|
|
67
|
+
notes: Schema.optional(Schema.String).annotations({
|
|
68
|
+
description: 'Additional notes from the participants.',
|
|
69
|
+
}),
|
|
70
|
+
}),
|
|
71
|
+
output: Schema.Struct({
|
|
72
|
+
summary: Schema.String.annotations({
|
|
73
|
+
description: 'The summary of the transcript.',
|
|
74
|
+
}),
|
|
75
|
+
}),
|
|
76
|
+
services: [AiService.AiService],
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const SentenceNormalizationInput = Schema.Struct({
|
|
80
|
+
messages: Schema.Array(MessageWithRangeId).annotations({
|
|
81
|
+
description: 'Messages to normalize into sentences.',
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export type SentenceNormalizationInputType = Schema.Schema.Type<typeof SentenceNormalizationInput>;
|
|
86
|
+
|
|
87
|
+
export const SentenceNormalizationOutput = Schema.Struct({
|
|
88
|
+
sentences: Schema.Array(MessageWithRangeId.pipe(Schema.mutable)).pipe(Schema.mutable).annotations({
|
|
89
|
+
description: 'The sentences of the transcript.',
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const SentenceNormalization = Operation.make({
|
|
94
|
+
meta: {
|
|
95
|
+
key: 'org.dxos.function.transcription.sentence-normalization',
|
|
96
|
+
name: 'Sentence Normalization',
|
|
97
|
+
description: 'Post process of transcription for sentence normalization',
|
|
98
|
+
},
|
|
99
|
+
input: SentenceNormalizationInput,
|
|
100
|
+
output: SentenceNormalizationOutput,
|
|
101
|
+
services: [],
|
|
102
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/operation';
|
|
6
|
+
|
|
7
|
+
export * as TranscriptOperation from './definitions';
|
|
8
|
+
|
|
9
|
+
export const TranscriptionOperationHandlerSet = OperationHandlerSet.lazy(
|
|
10
|
+
() => import('./create'),
|
|
11
|
+
() => import('./open'),
|
|
12
|
+
() => import('./summarize'),
|
|
13
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Database, Obj } from '@dxos/echo';
|
|
8
|
+
import { QueueService } from '@dxos/functions';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
import { Message } from '@dxos/types';
|
|
11
|
+
|
|
12
|
+
import { renderByline } from '../util';
|
|
13
|
+
import { Open } from './definitions';
|
|
14
|
+
|
|
15
|
+
const handler: Operation.WithHandler<typeof Open> = Open.pipe(
|
|
16
|
+
Operation.withHandler(
|
|
17
|
+
Effect.fn(function* ({ transcript }) {
|
|
18
|
+
const transcriptObj = yield* Database.load(transcript);
|
|
19
|
+
const { dxn } = yield* Effect.promise(() => transcriptObj.queue.load());
|
|
20
|
+
const queue = yield* QueueService.getQueue(dxn);
|
|
21
|
+
yield* Effect.promise(() => queue?.queryObjects());
|
|
22
|
+
const content = queue?.objects
|
|
23
|
+
.filter((message: unknown) => Obj.instanceOf(Message.Message, message))
|
|
24
|
+
.flatMap((message: Message.Message, index: number) => renderByline([])(message, index))
|
|
25
|
+
.join('\n\n');
|
|
26
|
+
return { content };
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default handler;
|