dave: fix bugs

fixed some bugs i introduced during the refactor

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-04-14 16:13:40 -07:00
parent 39e2accbce
commit e5c3bb4fe9
4 changed files with 12 additions and 4 deletions

View File

@@ -320,12 +320,12 @@ You are an AI agent for the nostr protocol called Dave, created by Damus. nostr
let entry = all_tool_calls.entry(tool.index).or_default();
if let Some(id) = &tool.id {
entry.id().get_or_insert(id);
entry.id_mut().get_or_insert(id.clone());
}
if let Some(name) = tool.function.as_ref().and_then(|f| f.name.as_ref())
{
entry.name().get_or_insert(name);
entry.name_mut().get_or_insert(name.to_string());
}
if let Some(argchunk) =

View File

@@ -45,10 +45,18 @@ impl PartialToolCall {
self.id.as_deref()
}
pub fn id_mut(&mut self) -> &mut Option<String> {
&mut self.id
}
pub fn name(&self) -> Option<&str> {
self.name.as_deref()
}
pub fn name_mut(&mut self) -> &mut Option<String> {
&mut self.name
}
pub fn arguments(&self) -> Option<&str> {
self.arguments.as_deref()
}