Skip to content

Commit

Permalink
Refactoring to use direct array manipulation per Coderabbit suggestion.
Browse files Browse the repository at this point in the history
  • Loading branch information
malexanderlim committed Nov 20, 2024
1 parent fcf0fba commit 46dba5e
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,16 @@ export default {
let formattedTranscript = "";

// Process each sentence maintaining chronological order
const allSentences = callTranscript.transcript.reduce((acc, segment) => {
const sentences = segment.sentences.map((sentence) => ({
...sentence,
speakerId: segment.speakerId,
topic: segment.topic,
}));
return [
...acc,
...sentences,
];
}, []);
const allSentences = [];
callTranscript.transcript.forEach((segment) => {
segment.sentences.forEach((sentence) => {
allSentences.push({
...sentence,
speakerId: segment.speakerId,
topic: segment.topic,
});
});
});

// Sort by start time
allSentences.sort((a, b) => a.start - b.start);
Expand Down

0 comments on commit 46dba5e

Please sign in to comment.