Skip to content

Commit

Permalink
Merge pull request #179 from gkumbhat/fix_offsets
Browse files Browse the repository at this point in the history
🐛 Fix offset for standalone content results
  • Loading branch information
gkumbhat authored Aug 23, 2024
2 parents 52bc871 + 6e0b9f9 commit d1c16f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/orchestrator/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,14 @@ pub async fn detect_content(
let results = chunks
.into_iter()
.zip(response)
.flat_map(|(_chunk, response)| {
.flat_map(|(chunk, response)| {
response
.into_iter()
.filter_map(|resp| (resp.score >= threshold).then_some(resp))
.filter_map(|mut resp| {
resp.start += chunk.offset;
resp.end += chunk.offset;
(resp.score >= threshold).then_some(resp)
})
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
Expand Down

0 comments on commit d1c16f4

Please sign in to comment.