@@ -14,10 +14,25 @@ const InterviewReportComponent = () => {
14
14
const [ recordId , setRecordId ] = useState < string | null > ( null ) ;
15
15
const [ roomId , setRoomId ] = useState < string | null > ( null ) ;
16
16
17
- const [ interviewsDataList , setInterviewsDataList ] = useState < any | null > ( null ) ;
18
- const [ selectedInterviewData , setSelectedInterviewData ] = useState < any | null > ( null ) ;
17
+ // Data of the interviews
18
+ const [ interviewsDataList , setInterviewsDataList ] = useState < any | null > (
19
+ null
20
+ ) ;
21
+ const [ selectedInterviewData , setSelectedInterviewData ] = useState <
22
+ any | null
23
+ > ( null ) ;
19
24
20
25
const [ videoURL , setVideoURL ] = useState < string | null > ( null ) ;
26
+ const [ meetingTranscript , setMeetingTranscript ] = useState < string > (
27
+ "Waiting for transcription...(if it's the first time here, it could take up to 20 minutes). Try again later, reload the page or check the debug section."
28
+ ) ;
29
+ const [ actionItens , setActionItens ] = useState ( [ { text : "Loading..." } ] ) ;
30
+ const [ followUps , setFollowUps ] = useState ( [ { text : "Loading..." } ] ) ;
31
+ const [ questionsReport , setQuestionsReport ] = useState ( [
32
+ { text : "Loading..." } ,
33
+ ] ) ;
34
+ const [ topics , setTopics ] = useState ( [ { text : "Loading..." } ] ) ;
35
+ const [ summary , setSummary ] = useState ( [ { text : "Loading..." } ] ) ;
21
36
22
37
// Estados de carregamento
23
38
const [ videoStatus , setVideoStatus ] = useState < string > ( "loading" ) ;
@@ -36,7 +51,9 @@ const InterviewReportComponent = () => {
36
51
console . log ( "Requesting interviews data list..." ) ;
37
52
try {
38
53
const request = await getRecordings ( ) ;
39
- const filteredData = request . data . filter ( ( recording : any ) => recording . roomId == room_id ) ;
54
+ const filteredData = request . data . filter (
55
+ ( recording : any ) => recording . roomId == room_id
56
+ ) ;
40
57
setInterviewsDataList ( filteredData ) ;
41
58
} catch ( error ) {
42
59
console . error ( "Error getting interviews data list: " , error ) ;
@@ -79,7 +96,121 @@ const InterviewReportComponent = () => {
79
96
} else {
80
97
setVideoStatus ( "failed" ) ;
81
98
}
82
- } , [ videoURL ] ) ;
99
+
100
+ // First it tries to get the transcript for all the interviews, if it fails, it requests all the transcripts
101
+ interviewsDataList . forEach ( ( interview : any ) => {
102
+ getTranscript ( interview . uuid )
103
+ . then ( ( transcript ) => {
104
+ console . log ( "Transcript for interview " , interview . uuid , ": VALID!" ) ;
105
+
106
+ // but shows only the selected interview transcript
107
+ if ( interview . uuid == recordId ) {
108
+ setMeetingTranscript (
109
+ transformTranscriptIntoHumanFormat ( transcript )
110
+ ) ;
111
+ }
112
+ } )
113
+ . catch ( ( error ) => {
114
+ console . error (
115
+ "Error getting transcript for interview " ,
116
+ interview . uuid ,
117
+ ": " ,
118
+ error
119
+ ) ;
120
+ console . log ( "Requesting transcript for interview " , interview . uuid ) ;
121
+ requestGenerateTranscript ( interview . uuid )
122
+ . then ( ( ) =>
123
+ console . log (
124
+ "TRANSCRIPT REQUESTED FOR SUPERVIZ, U HAVE TO WAIT. UUID: " ,
125
+ interview . uuid
126
+ )
127
+ )
128
+ . catch ( ( error ) =>
129
+ console . error (
130
+ "Error generating transcript request for interview " ,
131
+ interview . uuid ,
132
+ ": " ,
133
+ error
134
+ )
135
+ ) ;
136
+ } ) ;
137
+ } ) ;
138
+
139
+ // Get the action itens
140
+ getActionItems ( recordId )
141
+ . then ( ( actionItens ) => {
142
+ console . log ( "Action itens for interview" , recordId , ": VALID!" ) ;
143
+ setActionItens ( actionItens ) ;
144
+ } )
145
+ . catch ( ( error ) => {
146
+ console . error (
147
+ "Error getting action itens for interview " ,
148
+ recordId ,
149
+ ": " ,
150
+ error
151
+ ) ;
152
+ } ) ;
153
+
154
+ // Get the follow-ups
155
+ getFollowUps ( recordId )
156
+ . then ( ( followUps ) => {
157
+ console . log ( "Follow-ups for interview" , recordId , ": VALID!" ) ;
158
+ setFollowUps ( followUps ) ;
159
+ } )
160
+ . catch ( ( error ) => {
161
+ console . error (
162
+ "Error getting follow-ups for interview " ,
163
+ recordId ,
164
+ ": " ,
165
+ error
166
+ ) ;
167
+ } ) ;
168
+
169
+ // Get the questions
170
+ getQuestions ( recordId )
171
+ . then ( ( questions ) => {
172
+ console . log ( "Questions for interview" , recordId , ": VALID!" ) ;
173
+ setQuestionsReport ( questions ) ;
174
+ } )
175
+ . catch ( ( error ) => {
176
+ console . error (
177
+ "Error getting questions for interview " ,
178
+ recordId ,
179
+ ": " ,
180
+ error
181
+ ) ;
182
+ } ) ;
183
+
184
+ // Get the topics
185
+ getTopics ( recordId )
186
+ . then ( ( topics ) => {
187
+ console . log ( "Topics for interview" , recordId , ": VALID!" ) ;
188
+ setTopics ( topics ) ;
189
+ } )
190
+ . catch ( ( error ) => {
191
+ console . error (
192
+ "Error getting topics for interview " ,
193
+ recordId ,
194
+ ": " ,
195
+ error
196
+ ) ;
197
+ } ) ;
198
+
199
+ // Get the summary
200
+ getSummary ( recordId )
201
+ . then ( ( summary ) => {
202
+ console . log ( "Summary for interview" , recordId , ": VALID!" ) ;
203
+ setSummary ( summary ) ;
204
+ } )
205
+ . catch ( ( error ) => {
206
+ console . error (
207
+ "Error getting summary for interview " ,
208
+ recordId ,
209
+ ": " ,
210
+ error
211
+ ) ;
212
+ } ) ;
213
+ } , [ recordId ] ) ;
83
214
84
215
return (
85
216
< >
@@ -92,15 +223,24 @@ const InterviewReportComponent = () => {
92
223
onChange = { ( e ) => {
93
224
console . log ( "selectedInterviewData" , e . target . value ) ;
94
225
setSelectedInterviewData (
95
- interviewsDataList . find ( ( interview : any ) => interview . uuid === e . target . value )
226
+ interviewsDataList . find (
227
+ ( interview : any ) => interview . uuid === e . target . value
228
+ )
96
229
) ;
97
230
} }
98
- value = { recordId || "" } >
231
+ value = { recordId || "" }
232
+ >
99
233
< option value = "" disabled >
100
234
Select an interview
101
235
</ option >
102
- ))}
103
- </ select >
236
+ { interviewsDataList . map ( ( interview : any ) => (
237
+ < option key = { interview . uuid } value = { interview . uuid } >
238
+ { new Date ( interview . createdAt ) . toUTCString ( ) } -{ " " }
239
+ { interview . uuid }
240
+ </ option >
241
+ ) ) }
242
+ </ select >
243
+ </ >
104
244
) }
105
245
</ div >
106
246
{ /* Interview Video */ }
@@ -119,7 +259,11 @@ const InterviewReportComponent = () => {
119
259
120
260
{ /* Meeting Transcript */ }
121
261
< CollapsibleText title = "Meeting transcript" >
122
- < textarea value = { meetingTranscript } readOnly = { true } style = { { width : 1000 , height : 200 } } />
262
+ < textarea
263
+ value = { meetingTranscript }
264
+ readOnly = { true }
265
+ style = { { width : 1000 , height : 200 } }
266
+ />
123
267
</ CollapsibleText >
124
268
125
269
{ /* Action itens */ }
0 commit comments