fix: when auto_continue is disabled via the .set auto_continue false command, it should strip the todo functions from the list of functions
This commit is contained in:
@@ -2041,11 +2041,15 @@ impl RequestContext {
|
|||||||
} else {
|
} else {
|
||||||
self.update_app_config(|app| app.auto_continue = value);
|
self.update_app_config(|app| app.auto_continue = value);
|
||||||
}
|
}
|
||||||
if value
|
let should_register = self.agent.is_none()
|
||||||
&& self.app.config.function_calling_support
|
&& self.app.config.function_calling_support
|
||||||
&& !self.tool_scope.functions.contains("todo__init")
|
&& self.auto_continue_config().enabled;
|
||||||
{
|
let already_registered = self.tool_scope.functions.contains("todo__init");
|
||||||
|
|
||||||
|
if should_register && !already_registered {
|
||||||
self.tool_scope.functions.append_todo_functions();
|
self.tool_scope.functions.append_todo_functions();
|
||||||
|
} else if !should_register && already_registered {
|
||||||
|
self.tool_scope.functions.remove_todo_functions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"max_auto_continues" => {
|
"max_auto_continues" => {
|
||||||
|
|||||||
@@ -357,6 +357,11 @@ impl Functions {
|
|||||||
self.declarations.extend(todo::todo_function_declarations());
|
self.declarations.extend(todo::todo_function_declarations());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn remove_todo_functions(&mut self) {
|
||||||
|
self.declarations
|
||||||
|
.retain(|f| !f.name.starts_with(TODO_FUNCTION_PREFIX));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn append_memory_functions(&mut self) {
|
pub fn append_memory_functions(&mut self) {
|
||||||
self.declarations
|
self.declarations
|
||||||
.extend(memory::memory_function_declarations());
|
.extend(memory::memory_function_declarations());
|
||||||
|
|||||||
Reference in New Issue
Block a user