tango-app-api-audit 3.6.51 → 3.6.52
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/package.json
CHANGED
|
@@ -3187,12 +3187,7 @@ export async function getConversationDetails( req, res ) {
|
|
|
3187
3187
|
'must': [
|
|
3188
3188
|
{
|
|
3189
3189
|
'term': {
|
|
3190
|
-
'
|
|
3191
|
-
},
|
|
3192
|
-
},
|
|
3193
|
-
{
|
|
3194
|
-
'term': {
|
|
3195
|
-
'moduleType.keyword': 'eyeTest-SOP',
|
|
3190
|
+
'unique_id.keyword': inputData.id,
|
|
3196
3191
|
},
|
|
3197
3192
|
},
|
|
3198
3193
|
],
|
|
@@ -3201,7 +3196,7 @@ export async function getConversationDetails( req, res ) {
|
|
|
3201
3196
|
'size': 1,
|
|
3202
3197
|
};
|
|
3203
3198
|
|
|
3204
|
-
const result = await getOpenSearchData( '
|
|
3199
|
+
const result = await getOpenSearchData( 'audio_analytics_report_v2', query );
|
|
3205
3200
|
if ( result?.body?.hits?.hits?.length === 0 ) {
|
|
3206
3201
|
return res.sendError( 'No data found', 204 );
|
|
3207
3202
|
}
|
|
@@ -3220,53 +3215,33 @@ export async function getConversationDetails( req, res ) {
|
|
|
3220
3215
|
return `${minutes}:${secs.toString().padStart( 2, '0' )}`;
|
|
3221
3216
|
};
|
|
3222
3217
|
|
|
3218
|
+
// Helper: parse "s3://bucket/path/to/file" into { Bucket, file_path }
|
|
3219
|
+
const parseS3Uri = ( uri ) => {
|
|
3220
|
+
if ( !uri ) return null;
|
|
3221
|
+
const withoutScheme = uri.replace( /^s3:\/\//, '' );
|
|
3222
|
+
const slashIdx = withoutScheme.indexOf( '/' );
|
|
3223
|
+
if ( slashIdx === -1 ) return null;
|
|
3224
|
+
return {
|
|
3225
|
+
Bucket: withoutScheme.slice( 0, slashIdx ),
|
|
3226
|
+
file_path: withoutScheme.slice( slashIdx + 1 ),
|
|
3227
|
+
};
|
|
3228
|
+
};
|
|
3229
|
+
|
|
3223
3230
|
// Helper function to format transcript: fetch and clean transcript file
|
|
3224
3231
|
const getFormattedTranscript = async ( transcriptPath ) => {
|
|
3225
3232
|
try {
|
|
3226
3233
|
if ( !transcriptPath ) return '';
|
|
3227
3234
|
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
[00:00:51.134 --> 00:00:51.266] [silence]
|
|
3239
|
-
[00:00:51.266 --> 00:00:52.166] It is near to the ear and has an inter-implication distance.
|
|
3240
|
-
[00:00:53.182 --> 00:00:53.666] [silence]
|
|
3241
|
-
[00:00:53.666 --> 00:00:54.050] This is the base.
|
|
3242
|
-
[00:00:54.430 --> 00:00:54.914] [silence]
|
|
3243
|
-
[00:00:54.914 --> 00:00:56.514] It will be adjustable upwards and downwards.
|
|
3244
|
-
[00:00:57.174 --> 00:00:57.914] It has an up and down.
|
|
3245
|
-
[00:00:59.194 --> 00:01:01.654] There are three lenses in this.
|
|
3246
|
-
[00:01:03.294 --> 00:01:03.426] [silence]
|
|
3247
|
-
[00:01:03.426 --> 00:01:05.166] The standard has a reading area and a distance.
|
|
3248
|
-
[00:01:05.166 --> 00:01:06.906] When the wider lens is used,
|
|
3249
|
-
[00:01:06.986 --> 00:01:08.366] the wider angle is achieved.
|
|
3250
|
-
[00:01:08.606 --> 00:01:09.026] [silence]
|
|
3251
|
-
[00:01:09.026 --> 00:01:10.266] The cost will change accordingly.
|
|
3252
|
-
[00:01:10.286 --> 00:01:11.246] The lens of this is 4000.
|
|
3253
|
-
[00:01:12.062 --> 00:01:12.738] [silence]
|
|
3254
|
-
[00:01:12.738 --> 00:01:13.662] The lens of this is 6000.
|
|
3255
|
-
[00:01:14.430 --> 00:01:14.722] [silence]
|
|
3256
|
-
[00:01:14.722 --> 00:01:16.734] The lens of this is 10,000.
|
|
3257
|
-
[00:01:16.934 --> 00:01:17.394] You can adjust the size.
|
|
3258
|
-
[00:01:53.854 --> 00:02:08.738] [silence]
|
|
3259
|
-
[00:02:08.738 --> 00:02:09.198] Please change the number.
|
|
3260
|
-
[00:02:10.302 --> 00:02:10.914] [silence]
|
|
3261
|
-
[00:02:10.914 --> 00:02:11.830] Can I change the number now?
|
|
3262
|
-
[00:02:12.230 --> 00:02:12.770] Yes, you can.
|
|
3263
|
-
[00:02:13.470 --> 00:02:14.114] [silence]
|
|
3264
|
-
[00:02:14.114 --> 00:02:15.294] I will give you a different number.
|
|
3265
|
-
[00:02:15.774 --> 00:02:15.970] [silence]
|
|
3266
|
-
[00:02:15.970 --> 00:02:17.710] Which number do you want?
|
|
3267
|
-
[00:02:18.670 --> 00:02:19.110] 555.
|
|
3268
|
-
[00:02:19.130 --> 00:02:20.010] I will give you a different number.
|
|
3269
|
-
`;
|
|
3235
|
+
const s3Parts = parseS3Uri( transcriptPath );
|
|
3236
|
+
logger.info( { s3Parts: s3Parts, function: 'getFormattedTranscript' } );
|
|
3237
|
+
if ( !s3Parts ) return '';
|
|
3238
|
+
|
|
3239
|
+
const transcriptSignedUrl = await signedUrl( { ...s3Parts, key: 'aws' } );
|
|
3240
|
+
if ( !transcriptSignedUrl ) return '';
|
|
3241
|
+
|
|
3242
|
+
const fetchRes = await fetch( transcriptSignedUrl );
|
|
3243
|
+
if ( !fetchRes.ok ) return '';
|
|
3244
|
+
let text = await fetchRes.text();
|
|
3270
3245
|
|
|
3271
3246
|
// Remove timestamps like [00:00:33.954 --> 00:00:36.154]
|
|
3272
3247
|
text = text.replace( /\[\d{2}:\d{2}:\d{2}\.\d{3} --> \d{2}:\d{2}:\d{2}\.\d{3}\]\s*/g, '' );
|
|
@@ -3336,6 +3311,9 @@ export async function getConversationDetails( req, res ) {
|
|
|
3336
3311
|
};
|
|
3337
3312
|
} ) || [];
|
|
3338
3313
|
|
|
3314
|
+
// Fetch signed URL for audio
|
|
3315
|
+
const audioS3Parts = parseS3Uri( source?.s3_audio_path );
|
|
3316
|
+
const audioSignedUrl = audioS3Parts ? await signedUrl( { ...audioS3Parts, key: 'aws' } ) : null;
|
|
3339
3317
|
// Fetch and format transcript
|
|
3340
3318
|
const formattedTranscript = await getFormattedTranscript( source?.s3_transcript_path );
|
|
3341
3319
|
|
|
@@ -3352,7 +3330,7 @@ export async function getConversationDetails( req, res ) {
|
|
|
3352
3330
|
// fileDate: source?.filedate,
|
|
3353
3331
|
// processTimestamp: source?.processTimestamp,
|
|
3354
3332
|
duration: formatDuration( source?.duration ),
|
|
3355
|
-
|
|
3333
|
+
audio_url: audioSignedUrl,
|
|
3356
3334
|
// s3_transcript_path: source?.s3_transcript_path,
|
|
3357
3335
|
transcript_summary: formattedTranscript,
|
|
3358
3336
|
// overall_score: executiveSummary?.overall_score,
|