convo-ai-sdk 1.2.1 → 1.2.2

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/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export declare class ChatClient {
23
23
  transcriptionKey: string;
24
24
  cost_analysis: any;
25
25
  } | null>;
26
+ sendTranscriptionMessage(transcriptionText: string, transcriptionKey: string): Promise<void>;
26
27
  sendMessage(text: string): Promise<void>;
27
28
  toolCall(tool_call: any): Promise<void>;
28
29
  sendStreamMessage(message: ChatMessage): Promise<void>;
package/dist/index.js CHANGED
@@ -270,6 +270,21 @@ export class ChatClient {
270
270
  const responseData = await response.json();
271
271
  return responseData;
272
272
  }
273
+ async sendTranscriptionMessage(transcriptionText, transcriptionKey) {
274
+ if (this.status !== 'connected') {
275
+ console.error('Cannot send transcription message, not connected.');
276
+ return;
277
+ }
278
+ const transcriptionMessage = {
279
+ id: `transcription-${Date.now()}`,
280
+ data: { content: transcriptionText, metadata: { transcriptionKey } },
281
+ from: 'transcription',
282
+ timestamp: Date.now(),
283
+ };
284
+ this._addMessage(transcriptionMessage);
285
+ this._emit('message', transcriptionMessage);
286
+ this.sendStreamMessage(transcriptionMessage);
287
+ }
273
288
  async sendMessage(text) {
274
289
  if (this.status !== 'connected') {
275
290
  console.error('Cannot send message, not connected.');
@@ -301,6 +316,9 @@ export class ChatClient {
301
316
  input.toolCallId = message.data.toolCallId;
302
317
  input.toolName = message.data.toolCallName;
303
318
  }
319
+ if (message.from === 'transcription') {
320
+ input.metadata = message.data?.metadata;
321
+ }
304
322
  if (message.from === 'widget') {
305
323
  input.content = message.data.content;
306
324
  }
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ export type ConversationStatus = 'started' | 'awaiting_user' | 'ended_by_system'
3
3
  export interface ChatMessage {
4
4
  id: string | number;
5
5
  data: any;
6
- from: 'user' | 'assistant' | 'system' | 'tool' | 'widget';
6
+ from: 'user' | 'assistant' | 'system' | 'tool' | 'widget' | 'transcription';
7
7
  timestamp: number;
8
8
  }
9
9
  export interface ChatConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "convo-ai-sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",