convo-ai-sdk 1.2.3 → 1.2.4
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 +1 -1
- package/dist/index.js +4 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +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
|
+
sendTranscriptionMessage(transcriptionText: string, transcriptionKey: string, modified?: boolean): Promise<void>;
|
|
27
27
|
sendMessage(text: string): Promise<void>;
|
|
28
28
|
toolCall(tool_call: any): Promise<void>;
|
|
29
29
|
sendStreamMessage(message: ChatMessage): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -229,7 +229,7 @@ export class ChatClient {
|
|
|
229
229
|
console.error('Transcribe API endpoint not available.');
|
|
230
230
|
return null;
|
|
231
231
|
}
|
|
232
|
-
const contentType = audioBlob.type || '
|
|
232
|
+
const contentType = audioBlob.type || 'audio/webm';
|
|
233
233
|
const fileBuffer = await audioBlob.arrayBuffer();
|
|
234
234
|
// 1. Get Presigned URL
|
|
235
235
|
const uploadUrlResponse = await fetch(`${this.config.transcribeApiEndpoint}upload-url?contentType=${contentType}`, {
|
|
@@ -253,7 +253,6 @@ export class ChatClient {
|
|
|
253
253
|
if (!uploadResponse.ok) {
|
|
254
254
|
throw new Error(`Failed to upload file to S3: ${uploadResponse.statusText}`);
|
|
255
255
|
}
|
|
256
|
-
console.log("File uploaded successfully, key:", key);
|
|
257
256
|
// transcribe file.
|
|
258
257
|
const response = await fetch(this.config.transcribeApiEndpoint + 'transcribe', {
|
|
259
258
|
method: 'POST',
|
|
@@ -268,20 +267,20 @@ export class ChatClient {
|
|
|
268
267
|
const responseData = await response.json();
|
|
269
268
|
return responseData;
|
|
270
269
|
}
|
|
271
|
-
async sendTranscriptionMessage(transcriptionText, transcriptionKey) {
|
|
270
|
+
async sendTranscriptionMessage(transcriptionText, transcriptionKey, modified = false) {
|
|
272
271
|
if (this.status !== 'connected') {
|
|
273
272
|
console.error('Cannot send transcription message, not connected.');
|
|
274
273
|
return;
|
|
275
274
|
}
|
|
276
275
|
const transcriptionMessage = {
|
|
277
276
|
id: `transcription-${Date.now()}`,
|
|
278
|
-
data: { content: transcriptionText, metadata: { transcriptionKey } },
|
|
277
|
+
data: { content: transcriptionText, metadata: { transcriptionKey, modified } },
|
|
279
278
|
from: 'transcription',
|
|
280
279
|
timestamp: Date.now(),
|
|
281
280
|
};
|
|
282
281
|
this._addMessage(transcriptionMessage);
|
|
283
282
|
this._emit('message', transcriptionMessage);
|
|
284
|
-
this.sendStreamMessage(transcriptionMessage);
|
|
283
|
+
await this.sendStreamMessage(transcriptionMessage);
|
|
285
284
|
}
|
|
286
285
|
async sendMessage(text) {
|
|
287
286
|
if (this.status !== 'connected') {
|