Return an error from project index tool when embedding query fails (#11264)

Previously, a failure to embed the search query (due to a rate limit
error) would appear the same as if there were no results.

* Avoid repeatedly embedding the search query for each worktree
* Unify tasks for searching all worktree

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-05-01 12:15:44 -07:00 committed by GitHub
parent 4b767697af
commit 5831d80f51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 137 additions and 132 deletions

View file

@ -98,12 +98,9 @@ fn chunk_lines(text: &str) -> Vec<Chunk> {
chunk_ranges
.into_iter()
.map(|range| {
let mut hasher = Sha256::new();
hasher.update(&text[range.clone()]);
let mut digest = [0u8; 32];
digest.copy_from_slice(hasher.finalize().as_slice());
Chunk { range, digest }
.map(|range| Chunk {
digest: Sha256::digest(&text[range.clone()]).into(),
range,
})
.collect()
}