assistant2: Clear all collections when clearing the ThreadStore (#22743)

This PR adds some missing calls to clear the sub-collections in the
`ThreadStore` when we call `ThreadStore::drain` or `ThreadStore::clear`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-01-06 18:00:13 -05:00 committed by GitHub
parent 3c430af31a
commit 5f7de2eb5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,15 +37,17 @@ impl ContextStore {
} }
pub fn drain(&mut self) -> Vec<Context> { pub fn drain(&mut self) -> Vec<Context> {
self.files.clear(); let context = self.context.drain(..).collect();
self.directories.clear(); self.clear();
self.context.drain(..).collect() context
} }
pub fn clear(&mut self) { pub fn clear(&mut self) {
self.context.clear(); self.context.clear();
self.files.clear(); self.files.clear();
self.directories.clear(); self.directories.clear();
self.threads.clear();
self.fetched_urls.clear();
} }
pub fn insert_file(&mut self, buffer: &Buffer) { pub fn insert_file(&mut self, buffer: &Buffer) {