tango-app-api-audio-analytics 1.0.21 → 1.0.23
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/COHORT_API_EXAMPLES.sh
CHANGED
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Cohort API Test Examples
|
|
4
|
-
# This file contains curl commands to test all cohort API endpoints
|
|
5
|
-
|
|
6
|
-
BASE_URL="https://testtangoretail-api.tangoeye.ai/v3/audio-analitics"
|
|
7
|
-
COHORT_ID="cohort_photochromatic_001"
|
|
8
|
-
CLIENT_ID="11"
|
|
9
|
-
|
|
10
|
-
# ==================== Helper Function ====================
|
|
11
|
-
print_section() {
|
|
12
|
-
echo ""
|
|
13
|
-
echo "=================================="
|
|
14
|
-
echo "$1"
|
|
15
|
-
echo "=================================="
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
# ==================== 1. CREATE COHORT ====================
|
|
19
|
-
print_section "1. CREATE COHORT"
|
|
20
|
-
|
|
21
|
-
curl -X POST "$BASE_URL/cohorts" \
|
|
22
|
-
-H "Content-Type: application/json" \
|
|
23
|
-
-d '{
|
|
24
|
-
"clientId": "11",
|
|
25
|
-
"cohortId": "cohort_photochromatic_001",
|
|
26
|
-
"cohortName": "Photochromatic",
|
|
27
|
-
"cohortDescription": "A strict evaluation of the photochromatic sales journey, focusing on pitch quality, technical accuracy, and customer sentiment",
|
|
28
|
-
"metrics": [
|
|
29
|
-
{
|
|
30
|
-
"metricId": "pitch_quality_001",
|
|
31
|
-
"metricName": "Standard Pitch Quality",
|
|
32
|
-
"metricDescription": "Identify which specific value propositions were explicitly used by the staff",
|
|
33
|
-
"hasContext": true,
|
|
34
|
-
"isNumneric": false,
|
|
35
|
-
"contexts": [
|
|
36
|
-
{
|
|
37
|
-
"contextName": "ONE_GLASS_ALL_NEEDS",
|
|
38
|
-
"priority": 2,
|
|
39
|
-
"description": "Convenience of one pair for all lighting"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"contextName": "TRAVEL_CONVENIENCE",
|
|
43
|
-
"priority": 2,
|
|
44
|
-
"description": "Specific benefits for bikers/commuters"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"contextName": "LIGHT_ADAPTATION",
|
|
48
|
-
"priority": 2,
|
|
49
|
-
"description": "Technical explanation of UV reaction"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"contextName": "REDUCES_EYE_STRAIN",
|
|
53
|
-
"priority": 2,
|
|
54
|
-
"description": "Glare and fatigue protection"
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"metricId": "technical_depth_score_001",
|
|
60
|
-
"metricName": "Technical Depth Score",
|
|
61
|
-
"metricDescription": "A numeric evaluation of the staff'\''s product knowledge during the pitch",
|
|
62
|
-
"hasContext": true,
|
|
63
|
-
"isNumneric": true,
|
|
64
|
-
"contexts": [
|
|
65
|
-
{
|
|
66
|
-
"minValue": 0,
|
|
67
|
-
"maxValue": 100
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"metricId": "customer_sentiment_001",
|
|
73
|
-
"metricName": "Initial Customer Sentiment",
|
|
74
|
-
"metricDescription": "The immediate reaction of the customer when the lens was introduced",
|
|
75
|
-
"hasContext": true,
|
|
76
|
-
"isNumneric": false,
|
|
77
|
-
"contexts": [
|
|
78
|
-
{
|
|
79
|
-
"contextName": "POSITIVE",
|
|
80
|
-
"priority": 2,
|
|
81
|
-
"description": "High interest or curiosity"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"contextName": "NEUTRAL",
|
|
85
|
-
"priority": 1,
|
|
86
|
-
"description": "Acknowledgment or price-focused only"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"contextName": "NEGATIVE",
|
|
90
|
-
"priority": 0,
|
|
91
|
-
"description": "Dismissive or disinterested"
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"metricId": "staff_responsiveness_001",
|
|
97
|
-
"metricName": "Staff Responsiveness",
|
|
98
|
-
"metricDescription": "How effectively were customer doubts addressed?",
|
|
99
|
-
"hasContext": true,
|
|
100
|
-
"isNumneric": false,
|
|
101
|
-
"contexts": [
|
|
102
|
-
{
|
|
103
|
-
"contextName": "FULLY_RESPONSIVE",
|
|
104
|
-
"priority": 2,
|
|
105
|
-
"description": "All doubts cleared with evidence"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"contextName": "PARTIALLY_RESPONSIVE",
|
|
109
|
-
"priority": 1,
|
|
110
|
-
"description": "Some doubts addressed, others ignored"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"contextName": "UNRESPONSIVE",
|
|
114
|
-
"priority": 0,
|
|
115
|
-
"description": "Customer doubts were dismissed"
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"metricId": "sales_outcome_001",
|
|
121
|
-
"metricName": "Final Sales Outcome",
|
|
122
|
-
"metricDescription": "The final commitment level reached at the end of the conversation",
|
|
123
|
-
"hasContext": true,
|
|
124
|
-
"isNumneric": false,
|
|
125
|
-
"contexts": [
|
|
126
|
-
{
|
|
127
|
-
"contextName": "BOUGHT_PHOTOCHROMATIC",
|
|
128
|
-
"priority": 2,
|
|
129
|
-
"description": "Customer agreed to the upgrade"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"contextName": "BOUGHT_SOMETHING_ELSE",
|
|
133
|
-
"priority": 0,
|
|
134
|
-
"description": "Bought standard lenses/frames only"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"contextName": "NO_SALE",
|
|
138
|
-
"priority": 0,
|
|
139
|
-
"description": "No purchase commitment"
|
|
140
|
-
}
|
|
141
|
-
]
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"metricId": "pitch_timing_summary_001",
|
|
145
|
-
"metricName": "Pitch Timing & Context",
|
|
146
|
-
"metricDescription": "Narrative summary of when and how the pitch was introduced",
|
|
147
|
-
"hasContext": false,
|
|
148
|
-
"isNumneric": false
|
|
149
|
-
}
|
|
150
|
-
]
|
|
151
|
-
}'
|
|
152
|
-
|
|
153
|
-
# ==================== 2. GET COHORT BY ID ====================
|
|
154
|
-
print_section "2. GET COHORT BY ID"
|
|
155
|
-
|
|
156
|
-
curl -X GET "$BASE_URL/cohorts/$COHORT_ID" \
|
|
157
|
-
-H "Content-Type: application/json"
|
|
158
|
-
|
|
159
|
-
# ==================== 3. GET COHORTS BY CLIENT ====================
|
|
160
|
-
print_section "3. GET COHORTS BY CLIENT"
|
|
161
|
-
|
|
162
|
-
curl -X GET "$BASE_URL/cohorts/client/$CLIENT_ID?limit=10&offset=0" \
|
|
163
|
-
-H "Content-Type: application/json"
|
|
164
|
-
|
|
165
|
-
# ==================== 4. SEARCH COHORTS ====================
|
|
166
|
-
print_section "4. SEARCH COHORTS"
|
|
167
|
-
|
|
168
|
-
curl -X POST "$BASE_URL/cohorts/search" \
|
|
169
|
-
-H "Content-Type: application/json" \
|
|
170
|
-
-d '{
|
|
171
|
-
"clientId": "11",
|
|
172
|
-
"cohortName": "Photochrom",
|
|
173
|
-
"limit": 10,
|
|
174
|
-
"offset": 0
|
|
175
|
-
}'
|
|
176
|
-
|
|
177
|
-
# ==================== 5. UPDATE COHORT ====================
|
|
178
|
-
print_section "5. UPDATE COHORT"
|
|
179
|
-
|
|
180
|
-
# Note: Replace DOCUMENT_ID with actual ID returned from create
|
|
181
|
-
DOCUMENT_ID="550e8400-e29b-41d4-a716-446655440000"
|
|
182
|
-
|
|
183
|
-
curl -X PUT "$BASE_URL/cohorts/$DOCUMENT_ID" \
|
|
184
|
-
-H "Content-Type: application/json" \
|
|
185
|
-
-d '{
|
|
186
|
-
"cohortName": "Updated Photochromatic",
|
|
187
|
-
"cohortDescription": "Updated description for photochromatic cohort"
|
|
188
|
-
}'
|
|
189
|
-
|
|
190
|
-
# ==================== 6. GET COHORT ANALYTICS ====================
|
|
191
|
-
print_section "6. GET COHORT ANALYTICS"
|
|
192
|
-
|
|
193
|
-
curl -X GET "$BASE_URL/cohorts/$COHORT_ID/analytics" \
|
|
194
|
-
-H "Content-Type: application/json"
|
|
195
|
-
|
|
196
|
-
# ==================== 7. DELETE COHORT ====================
|
|
197
|
-
print_section "7. DELETE COHORT"
|
|
198
|
-
|
|
199
|
-
# Note: Replace DOCUMENT_ID with actual ID
|
|
200
|
-
curl -X DELETE "$BASE_URL/cohorts/$DOCUMENT_ID" \
|
|
201
|
-
-H "Content-Type: application/json"
|
|
202
|
-
|
|
203
|
-
# ==================== VALIDATION TESTS ====================
|
|
204
|
-
print_section "VALIDATION TESTS"
|
|
205
|
-
|
|
206
|
-
echo "Testing invalid cohort name (too short):"
|
|
207
|
-
curl -X POST "$BASE_URL/cohorts" \
|
|
208
|
-
-H "Content-Type: application/json" \
|
|
209
|
-
-d '{
|
|
210
|
-
"clientId": "11",
|
|
211
|
-
"cohortId": "invalid_test",
|
|
212
|
-
"cohortName": "AB",
|
|
213
|
-
"cohortDescription": "This should fail because name is too short"
|
|
214
|
-
}'
|
|
215
|
-
|
|
216
|
-
echo ""
|
|
217
|
-
echo "Testing missing required field:"
|
|
218
|
-
curl -X POST "$BASE_URL/cohorts" \
|
|
219
|
-
-H "Content-Type: application/json" \
|
|
220
|
-
-d '{
|
|
221
|
-
"clientId": "11",
|
|
222
|
-
"cohortId": "invalid_test",
|
|
223
|
-
"cohortName": "Valid Name"
|
|
224
|
-
}'
|
|
225
|
-
|
|
226
|
-
echo ""
|
|
227
|
-
echo "Testing invalid cohortId (special characters):"
|
|
228
|
-
curl -X POST "$BASE_URL/cohorts" \
|
|
229
|
-
-H "Content-Type: application/json" \
|
|
230
|
-
-d '{
|
|
231
|
-
"clientId": "11",
|
|
232
|
-
"cohortId": "invalid@test",
|
|
233
|
-
"cohortName": "Valid Name",
|
|
234
|
-
"cohortDescription": "This should fail because cohortId has invalid characters"
|
|
235
|
-
}'
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Cohort API Test Examples
|
|
4
|
+
# This file contains curl commands to test all cohort API endpoints
|
|
5
|
+
|
|
6
|
+
BASE_URL="https://testtangoretail-api.tangoeye.ai/v3/audio-analitics"
|
|
7
|
+
COHORT_ID="cohort_photochromatic_001"
|
|
8
|
+
CLIENT_ID="11"
|
|
9
|
+
|
|
10
|
+
# ==================== Helper Function ====================
|
|
11
|
+
print_section() {
|
|
12
|
+
echo ""
|
|
13
|
+
echo "=================================="
|
|
14
|
+
echo "$1"
|
|
15
|
+
echo "=================================="
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# ==================== 1. CREATE COHORT ====================
|
|
19
|
+
print_section "1. CREATE COHORT"
|
|
20
|
+
|
|
21
|
+
curl -X POST "$BASE_URL/cohorts" \
|
|
22
|
+
-H "Content-Type: application/json" \
|
|
23
|
+
-d '{
|
|
24
|
+
"clientId": "11",
|
|
25
|
+
"cohortId": "cohort_photochromatic_001",
|
|
26
|
+
"cohortName": "Photochromatic",
|
|
27
|
+
"cohortDescription": "A strict evaluation of the photochromatic sales journey, focusing on pitch quality, technical accuracy, and customer sentiment",
|
|
28
|
+
"metrics": [
|
|
29
|
+
{
|
|
30
|
+
"metricId": "pitch_quality_001",
|
|
31
|
+
"metricName": "Standard Pitch Quality",
|
|
32
|
+
"metricDescription": "Identify which specific value propositions were explicitly used by the staff",
|
|
33
|
+
"hasContext": true,
|
|
34
|
+
"isNumneric": false,
|
|
35
|
+
"contexts": [
|
|
36
|
+
{
|
|
37
|
+
"contextName": "ONE_GLASS_ALL_NEEDS",
|
|
38
|
+
"priority": 2,
|
|
39
|
+
"description": "Convenience of one pair for all lighting"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"contextName": "TRAVEL_CONVENIENCE",
|
|
43
|
+
"priority": 2,
|
|
44
|
+
"description": "Specific benefits for bikers/commuters"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"contextName": "LIGHT_ADAPTATION",
|
|
48
|
+
"priority": 2,
|
|
49
|
+
"description": "Technical explanation of UV reaction"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"contextName": "REDUCES_EYE_STRAIN",
|
|
53
|
+
"priority": 2,
|
|
54
|
+
"description": "Glare and fatigue protection"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"metricId": "technical_depth_score_001",
|
|
60
|
+
"metricName": "Technical Depth Score",
|
|
61
|
+
"metricDescription": "A numeric evaluation of the staff'\''s product knowledge during the pitch",
|
|
62
|
+
"hasContext": true,
|
|
63
|
+
"isNumneric": true,
|
|
64
|
+
"contexts": [
|
|
65
|
+
{
|
|
66
|
+
"minValue": 0,
|
|
67
|
+
"maxValue": 100
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"metricId": "customer_sentiment_001",
|
|
73
|
+
"metricName": "Initial Customer Sentiment",
|
|
74
|
+
"metricDescription": "The immediate reaction of the customer when the lens was introduced",
|
|
75
|
+
"hasContext": true,
|
|
76
|
+
"isNumneric": false,
|
|
77
|
+
"contexts": [
|
|
78
|
+
{
|
|
79
|
+
"contextName": "POSITIVE",
|
|
80
|
+
"priority": 2,
|
|
81
|
+
"description": "High interest or curiosity"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"contextName": "NEUTRAL",
|
|
85
|
+
"priority": 1,
|
|
86
|
+
"description": "Acknowledgment or price-focused only"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"contextName": "NEGATIVE",
|
|
90
|
+
"priority": 0,
|
|
91
|
+
"description": "Dismissive or disinterested"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"metricId": "staff_responsiveness_001",
|
|
97
|
+
"metricName": "Staff Responsiveness",
|
|
98
|
+
"metricDescription": "How effectively were customer doubts addressed?",
|
|
99
|
+
"hasContext": true,
|
|
100
|
+
"isNumneric": false,
|
|
101
|
+
"contexts": [
|
|
102
|
+
{
|
|
103
|
+
"contextName": "FULLY_RESPONSIVE",
|
|
104
|
+
"priority": 2,
|
|
105
|
+
"description": "All doubts cleared with evidence"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"contextName": "PARTIALLY_RESPONSIVE",
|
|
109
|
+
"priority": 1,
|
|
110
|
+
"description": "Some doubts addressed, others ignored"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"contextName": "UNRESPONSIVE",
|
|
114
|
+
"priority": 0,
|
|
115
|
+
"description": "Customer doubts were dismissed"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"metricId": "sales_outcome_001",
|
|
121
|
+
"metricName": "Final Sales Outcome",
|
|
122
|
+
"metricDescription": "The final commitment level reached at the end of the conversation",
|
|
123
|
+
"hasContext": true,
|
|
124
|
+
"isNumneric": false,
|
|
125
|
+
"contexts": [
|
|
126
|
+
{
|
|
127
|
+
"contextName": "BOUGHT_PHOTOCHROMATIC",
|
|
128
|
+
"priority": 2,
|
|
129
|
+
"description": "Customer agreed to the upgrade"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"contextName": "BOUGHT_SOMETHING_ELSE",
|
|
133
|
+
"priority": 0,
|
|
134
|
+
"description": "Bought standard lenses/frames only"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"contextName": "NO_SALE",
|
|
138
|
+
"priority": 0,
|
|
139
|
+
"description": "No purchase commitment"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"metricId": "pitch_timing_summary_001",
|
|
145
|
+
"metricName": "Pitch Timing & Context",
|
|
146
|
+
"metricDescription": "Narrative summary of when and how the pitch was introduced",
|
|
147
|
+
"hasContext": false,
|
|
148
|
+
"isNumneric": false
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}'
|
|
152
|
+
|
|
153
|
+
# ==================== 2. GET COHORT BY ID ====================
|
|
154
|
+
print_section "2. GET COHORT BY ID"
|
|
155
|
+
|
|
156
|
+
curl -X GET "$BASE_URL/cohorts/$COHORT_ID" \
|
|
157
|
+
-H "Content-Type: application/json"
|
|
158
|
+
|
|
159
|
+
# ==================== 3. GET COHORTS BY CLIENT ====================
|
|
160
|
+
print_section "3. GET COHORTS BY CLIENT"
|
|
161
|
+
|
|
162
|
+
curl -X GET "$BASE_URL/cohorts/client/$CLIENT_ID?limit=10&offset=0" \
|
|
163
|
+
-H "Content-Type: application/json"
|
|
164
|
+
|
|
165
|
+
# ==================== 4. SEARCH COHORTS ====================
|
|
166
|
+
print_section "4. SEARCH COHORTS"
|
|
167
|
+
|
|
168
|
+
curl -X POST "$BASE_URL/cohorts/search" \
|
|
169
|
+
-H "Content-Type: application/json" \
|
|
170
|
+
-d '{
|
|
171
|
+
"clientId": "11",
|
|
172
|
+
"cohortName": "Photochrom",
|
|
173
|
+
"limit": 10,
|
|
174
|
+
"offset": 0
|
|
175
|
+
}'
|
|
176
|
+
|
|
177
|
+
# ==================== 5. UPDATE COHORT ====================
|
|
178
|
+
print_section "5. UPDATE COHORT"
|
|
179
|
+
|
|
180
|
+
# Note: Replace DOCUMENT_ID with actual ID returned from create
|
|
181
|
+
DOCUMENT_ID="550e8400-e29b-41d4-a716-446655440000"
|
|
182
|
+
|
|
183
|
+
curl -X PUT "$BASE_URL/cohorts/$DOCUMENT_ID" \
|
|
184
|
+
-H "Content-Type: application/json" \
|
|
185
|
+
-d '{
|
|
186
|
+
"cohortName": "Updated Photochromatic",
|
|
187
|
+
"cohortDescription": "Updated description for photochromatic cohort"
|
|
188
|
+
}'
|
|
189
|
+
|
|
190
|
+
# ==================== 6. GET COHORT ANALYTICS ====================
|
|
191
|
+
print_section "6. GET COHORT ANALYTICS"
|
|
192
|
+
|
|
193
|
+
curl -X GET "$BASE_URL/cohorts/$COHORT_ID/analytics" \
|
|
194
|
+
-H "Content-Type: application/json"
|
|
195
|
+
|
|
196
|
+
# ==================== 7. DELETE COHORT ====================
|
|
197
|
+
print_section "7. DELETE COHORT"
|
|
198
|
+
|
|
199
|
+
# Note: Replace DOCUMENT_ID with actual ID
|
|
200
|
+
curl -X DELETE "$BASE_URL/cohorts/$DOCUMENT_ID" \
|
|
201
|
+
-H "Content-Type: application/json"
|
|
202
|
+
|
|
203
|
+
# ==================== VALIDATION TESTS ====================
|
|
204
|
+
print_section "VALIDATION TESTS"
|
|
205
|
+
|
|
206
|
+
echo "Testing invalid cohort name (too short):"
|
|
207
|
+
curl -X POST "$BASE_URL/cohorts" \
|
|
208
|
+
-H "Content-Type: application/json" \
|
|
209
|
+
-d '{
|
|
210
|
+
"clientId": "11",
|
|
211
|
+
"cohortId": "invalid_test",
|
|
212
|
+
"cohortName": "AB",
|
|
213
|
+
"cohortDescription": "This should fail because name is too short"
|
|
214
|
+
}'
|
|
215
|
+
|
|
216
|
+
echo ""
|
|
217
|
+
echo "Testing missing required field:"
|
|
218
|
+
curl -X POST "$BASE_URL/cohorts" \
|
|
219
|
+
-H "Content-Type: application/json" \
|
|
220
|
+
-d '{
|
|
221
|
+
"clientId": "11",
|
|
222
|
+
"cohortId": "invalid_test",
|
|
223
|
+
"cohortName": "Valid Name"
|
|
224
|
+
}'
|
|
225
|
+
|
|
226
|
+
echo ""
|
|
227
|
+
echo "Testing invalid cohortId (special characters):"
|
|
228
|
+
curl -X POST "$BASE_URL/cohorts" \
|
|
229
|
+
-H "Content-Type: application/json" \
|
|
230
|
+
-d '{
|
|
231
|
+
"clientId": "11",
|
|
232
|
+
"cohortId": "invalid@test",
|
|
233
|
+
"cohortName": "Valid Name",
|
|
234
|
+
"cohortDescription": "This should fail because cohortId has invalid characters"
|
|
235
|
+
}'
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tango-app-api-audio-analytics",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "audioAnalytics",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
|
-
},
|
|
10
|
-
"engines": {
|
|
11
|
-
"node": ">=18.10.0"
|
|
12
|
-
},
|
|
13
|
-
"author": "praveenraj",
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@aws-sdk/client-secrets-manager": "^3.1003.0",
|
|
17
|
-
"@google/generative-ai": "^0.24.1",
|
|
18
|
-
"aws-sdk": "^2.1693.0",
|
|
19
|
-
"body-parser": "^2.2.2",
|
|
20
|
-
"cors": "^2.8.6",
|
|
21
|
-
"dotenv": "^17.3.1",
|
|
22
|
-
"express": "^5.2.1",
|
|
23
|
-
"json2csv": "^6.0.0-alpha.2",
|
|
24
|
-
"mongodb": "^6.21.0",
|
|
25
|
-
"nodemon": "^3.1.14",
|
|
26
|
-
"tango-api-schema": "^2.5.62",
|
|
27
|
-
"tango-app-api-middleware": "^3.6.18",
|
|
28
|
-
"winston": "^3.19.0",
|
|
29
|
-
"winston-daily-rotate-file": "^5.0.0"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"eslint": "^8.57.1",
|
|
33
|
-
"eslint-config-google": "^0.14.0",
|
|
34
|
-
"eslint-config-semistandard": "^17.0.0",
|
|
35
|
-
"eslint-config-standard": "^17.1.0",
|
|
36
|
-
"eslint-plugin-import": "^2.32.0",
|
|
37
|
-
"eslint-plugin-promise": "^6.6.0"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "tango-app-api-audio-analytics",
|
|
3
|
+
"version": "1.0.23",
|
|
4
|
+
"description": "audioAnalytics",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "nodemon --exec \"eslint --fix . && node app.js\""
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18.10.0"
|
|
12
|
+
},
|
|
13
|
+
"author": "praveenraj",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@aws-sdk/client-secrets-manager": "^3.1003.0",
|
|
17
|
+
"@google/generative-ai": "^0.24.1",
|
|
18
|
+
"aws-sdk": "^2.1693.0",
|
|
19
|
+
"body-parser": "^2.2.2",
|
|
20
|
+
"cors": "^2.8.6",
|
|
21
|
+
"dotenv": "^17.3.1",
|
|
22
|
+
"express": "^5.2.1",
|
|
23
|
+
"json2csv": "^6.0.0-alpha.2",
|
|
24
|
+
"mongodb": "^6.21.0",
|
|
25
|
+
"nodemon": "^3.1.14",
|
|
26
|
+
"tango-api-schema": "^2.5.62",
|
|
27
|
+
"tango-app-api-middleware": "^3.6.18",
|
|
28
|
+
"winston": "^3.19.0",
|
|
29
|
+
"winston-daily-rotate-file": "^5.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"eslint": "^8.57.1",
|
|
33
|
+
"eslint-config-google": "^0.14.0",
|
|
34
|
+
"eslint-config-semistandard": "^17.0.0",
|
|
35
|
+
"eslint-config-standard": "^17.1.0",
|
|
36
|
+
"eslint-plugin-import": "^2.32.0",
|
|
37
|
+
"eslint-plugin-promise": "^6.6.0"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -456,6 +456,9 @@ Only return the JSON array, no other text.`;
|
|
|
456
456
|
// ======================= CHAT STREAM API =======================
|
|
457
457
|
|
|
458
458
|
const CHAT_STREAM_API = 'http://65.2.124.154:8000/api/chat/stream';
|
|
459
|
+
const AUDIO_STREAM_API = 'http://65.2.124.154:8000/api/chat/audio';
|
|
460
|
+
const EYE_TEST_STREAM_API = 'http://65.2.124.154:8000/api/chat/audio';
|
|
461
|
+
|
|
459
462
|
|
|
460
463
|
/**
|
|
461
464
|
* Chat Stream API - Streams response from external AI chat API
|
|
@@ -473,6 +476,8 @@ export async function chatStream( req, res ) {
|
|
|
473
476
|
sessionTimezone,
|
|
474
477
|
message,
|
|
475
478
|
config,
|
|
479
|
+
|
|
480
|
+
|
|
476
481
|
} = req.body;
|
|
477
482
|
|
|
478
483
|
logger.info( { message: 'Received chat stream request', userId, sessionId, message } );
|
|
@@ -488,7 +493,7 @@ export async function chatStream( req, res ) {
|
|
|
488
493
|
};
|
|
489
494
|
/* eslint-enable camelcase */
|
|
490
495
|
|
|
491
|
-
logger.info( { message: 'Calling external chat stream API', payload } );
|
|
496
|
+
logger.info( { message: 'Calling external chat stream API', payload, EYE_TEST_STREAM_API } );
|
|
492
497
|
|
|
493
498
|
// Set SSE headers
|
|
494
499
|
res.setHeader( 'Content-Type', 'text/event-stream' );
|
|
@@ -505,7 +510,6 @@ export async function chatStream( req, res ) {
|
|
|
505
510
|
},
|
|
506
511
|
body: JSON.stringify( payload ),
|
|
507
512
|
} );
|
|
508
|
-
|
|
509
513
|
if ( !response.ok ) {
|
|
510
514
|
logger.error( `External Chat Stream API error: ${response.status} ${response.statusText}` );
|
|
511
515
|
res.write( `data: ${JSON.stringify( { error: `External API error: ${response.statusText}` } )}\n\n` );
|
|
@@ -537,7 +541,7 @@ export async function chatStream( req, res ) {
|
|
|
537
541
|
export async function aiStreamResponse( req, res ) {
|
|
538
542
|
try {
|
|
539
543
|
/* eslint-disable camelcase */
|
|
540
|
-
const { user_id, session_id, session_date, session_timezone, message, config } = req.body;
|
|
544
|
+
const { user_id, session_id, session_date, session_timezone, message, config, analyticsType } = req.body;
|
|
541
545
|
|
|
542
546
|
logger.info( { message: 'Received ai-stream-response request', user_id, session_id } );
|
|
543
547
|
|
|
@@ -552,11 +556,13 @@ export async function aiStreamResponse( req, res ) {
|
|
|
552
556
|
selected_stores: config.selected_stores,
|
|
553
557
|
date_range: config.date_range,
|
|
554
558
|
selected_products: config.selected_products,
|
|
559
|
+
selected_model: config.selected_model,
|
|
560
|
+
selected_cohorts: config.selected_cohorts,
|
|
555
561
|
},
|
|
556
562
|
};
|
|
557
563
|
/* eslint-enable camelcase */
|
|
558
564
|
|
|
559
|
-
const response = await fetch( CHAT_STREAM_API, {
|
|
565
|
+
const response = await fetch( analyticsType === 'audio'? AUDIO_STREAM_API: CHAT_STREAM_API, {
|
|
560
566
|
method: 'POST',
|
|
561
567
|
headers: {
|
|
562
568
|
'Content-Type': 'application/json',
|
|
@@ -565,7 +571,6 @@ export async function aiStreamResponse( req, res ) {
|
|
|
565
571
|
},
|
|
566
572
|
body: JSON.stringify( payload ),
|
|
567
573
|
} );
|
|
568
|
-
|
|
569
574
|
if ( !response.ok ) {
|
|
570
575
|
logger.error( response, `External Chat Stream API error: ${response.status} ${response.statusText}` );
|
|
571
576
|
return res.sendError( `External API error: ${response.statusText}`, response.status );
|
|
@@ -40,6 +40,8 @@ export const getConversationsList = async ( req, res ) => {
|
|
|
40
40
|
limit,
|
|
41
41
|
offset,
|
|
42
42
|
isExport,
|
|
43
|
+
_id,
|
|
44
|
+
name,
|
|
43
45
|
} = req.body;
|
|
44
46
|
|
|
45
47
|
// Validation
|
|
@@ -75,6 +77,8 @@ export const getConversationsList = async ( req, res ) => {
|
|
|
75
77
|
isExport,
|
|
76
78
|
limit,
|
|
77
79
|
offset,
|
|
80
|
+
_id,
|
|
81
|
+
name,
|
|
78
82
|
} );
|
|
79
83
|
|
|
80
84
|
// conversations = exportResponse.conversations || [];
|
|
@@ -115,6 +119,8 @@ export const getConversationsList = async ( req, res ) => {
|
|
|
115
119
|
searchValue,
|
|
116
120
|
limit,
|
|
117
121
|
offset,
|
|
122
|
+
_id,
|
|
123
|
+
name,
|
|
118
124
|
} );
|
|
119
125
|
// conversations = lambdaResponse.conversations || [];
|
|
120
126
|
// totalCount = lambdaResponse.totalCount || conversations.length;
|
|
@@ -72,12 +72,15 @@ export async function getConversationsListFromLambda( params ) {
|
|
|
72
72
|
storeId: params.storeId,
|
|
73
73
|
clientId: params.clientId,
|
|
74
74
|
cohort_id: params?.cohortType?.[0],
|
|
75
|
+
_id: params?._id,
|
|
76
|
+
name: params?.name,
|
|
75
77
|
isAI: params.isAI,
|
|
76
78
|
analyticsType: params.analyticsType,
|
|
77
79
|
searchValue: params.searchValue,
|
|
78
80
|
limit: params.limit,
|
|
79
81
|
offset: params.offset,
|
|
80
82
|
};
|
|
83
|
+
console.log( payload );
|
|
81
84
|
const response = await axios.post( `${LAMBDA_ENDPOINT.cohortConversationList}/conversations/list`, payload, {
|
|
82
85
|
timeout: 30000,
|
|
83
86
|
} );
|