assistant2: Factor out Thread::all_tools_finished
method (#26314)
This PR factors out a new `Thread::all_tools_finished` method to encapsulate some of the boilerplate in the `ThreadEvent::ToolFinished` event handler. This should make this event handler easier to replicate for the eval use-case. Release Notes: - N/A
This commit is contained in:
parent
f6345a6995
commit
bbe7c9a738
2 changed files with 10 additions and 7 deletions
|
@ -297,13 +297,7 @@ impl ActiveThread {
|
|||
});
|
||||
}
|
||||
ThreadEvent::ToolFinished { .. } => {
|
||||
let all_tools_finished = self
|
||||
.thread
|
||||
.read(cx)
|
||||
.pending_tool_uses()
|
||||
.into_iter()
|
||||
.all(|tool_use| tool_use.status.is_error());
|
||||
if all_tools_finished {
|
||||
if self.thread.read(cx).all_tools_finished() {
|
||||
let model_registry = LanguageModelRegistry::read_global(cx);
|
||||
if let Some(model) = model_registry.active_model() {
|
||||
self.thread.update(cx, |thread, cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue