@webex/internal-plugin-voicea 3.12.0-auth-prejoin-fetch.1 → 3.12.0-llmrefactor.10

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.
@@ -40,6 +40,21 @@ interface Transcription {
40
40
  csis: number[];
41
41
  last_packet_timestamp_ms: number;
42
42
  timestamp: string;
43
+ taggedSpeaker?: {
44
+ speakerId?: string[];
45
+ newName?: string;
46
+ };
47
+ }
48
+
49
+ interface TaggedSpeaker {
50
+ csiId: number;
51
+ speakerId: string;
52
+ newName: string;
53
+ }
54
+
55
+ interface SpeakerNameUpdatePayload {
56
+ id?: string;
57
+ taggedSpeakers: TaggedSpeaker[];
43
58
  }
44
59
 
45
60
  /**
@@ -96,6 +111,7 @@ interface IVoiceaChannel {
96
111
  csis: number[],
97
112
  isFinal: boolean
98
113
  ) => void;
114
+ getKeepTranscriptionSubscribed: () => boolean;
99
115
  }
100
116
 
101
117
  type MeetingTranscripts = {
@@ -109,6 +125,10 @@ type MeetingTranscripts = {
109
125
  [key: string]: string;
110
126
  };
111
127
  timestamp?: string;
128
+ taggedSpeaker?: {
129
+ speakerId?: string[];
130
+ newName?: string;
131
+ };
112
132
  };
113
133
 
114
134
  type MeetingTranscriptPayload = {
@@ -123,6 +143,8 @@ export type {
123
143
  TranscriptionResponse,
124
144
  Transcription,
125
145
  Highlight,
146
+ TaggedSpeaker,
147
+ SpeakerNameUpdatePayload,
126
148
  IVoiceaChannel,
127
149
  MeetingTranscriptPayload,
128
150
  };
@@ -0,0 +1,83 @@
1
+ import MockWebex from '@webex/test-helper-mock-webex';
2
+ import {assert} from '@webex/test-helper-chai';
3
+ import sinon from 'sinon';
4
+ import Mercury from '@webex/internal-plugin-mercury';
5
+ import LLMChannel from '@webex/internal-plugin-llm';
6
+
7
+ import {VoiceaPlugin} from '@webex/internal-plugin-voicea/src/voicea-plugin';
8
+ import {VoiceaChannel} from '@webex/internal-plugin-voicea/src/voicea';
9
+
10
+ /**
11
+ * Creates a mock LLM channel for testing
12
+ * @returns {Object} Mock channel
13
+ */
14
+ function createMockLLMChannel() {
15
+ return {
16
+ isConnected: sinon.stub().returns(true),
17
+ getSocket: sinon.stub().returns({}),
18
+ getBinding: sinon.stub().returns('binding'),
19
+ getDatachannelUrl: sinon.stub().returns('datachannelUrl'),
20
+ getLocusUrl: sinon.stub().returns('locusUrl'),
21
+ isDataChannelTokenEnabled: sinon.stub().resolves(true),
22
+ on: sinon.stub(),
23
+ off: sinon.stub(),
24
+ };
25
+ }
26
+
27
+ describe('plugin-voicea', () => {
28
+ describe('VoiceaPlugin', () => {
29
+ let webex;
30
+ let plugin;
31
+
32
+ beforeEach(() => {
33
+ webex = new MockWebex({
34
+ children: {
35
+ mercury: Mercury,
36
+ llm: LLMChannel,
37
+ },
38
+ });
39
+
40
+ plugin = new VoiceaPlugin({}, {parent: webex});
41
+ });
42
+
43
+ afterEach(() => sinon.restore());
44
+
45
+ describe('#createChannel', () => {
46
+ it('creates a new VoiceaChannel instance', () => {
47
+ const mockLLMChannel = createMockLLMChannel();
48
+
49
+ const channel = plugin.createChannel(mockLLMChannel);
50
+
51
+ assert.instanceOf(channel, VoiceaChannel);
52
+ });
53
+
54
+ it('creates a new VoiceaChannel instance without llmChannel', () => {
55
+ const channel = plugin.createChannel();
56
+
57
+ assert.instanceOf(channel, VoiceaChannel);
58
+ });
59
+
60
+ it('creates a new VoiceaChannel instance with undefined llmChannel', () => {
61
+ const channel = plugin.createChannel(undefined);
62
+
63
+ assert.instanceOf(channel, VoiceaChannel);
64
+ });
65
+
66
+ it('creates independent channels for multiple calls', () => {
67
+ const mockLLMChannel1 = createMockLLMChannel();
68
+ const mockLLMChannel2 = createMockLLMChannel();
69
+
70
+ const channel1 = plugin.createChannel(mockLLMChannel1);
71
+ const channel2 = plugin.createChannel(mockLLMChannel2);
72
+
73
+ assert.notStrictEqual(channel1, channel2);
74
+ });
75
+ });
76
+
77
+ describe('namespace', () => {
78
+ it('has the correct namespace', () => {
79
+ assert.equal(plugin.namespace, 'voicea');
80
+ });
81
+ });
82
+ });
83
+ });