mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 09:34:19 +01:00
dave: give present notes a proper tool response
so the ai know we actually did something
This commit is contained in:
@@ -129,10 +129,10 @@ You are an AI agent for the nostr protocol called Dave, created by Damus. nostr
|
|||||||
for call in &toolcalls {
|
for call in &toolcalls {
|
||||||
// execute toolcall
|
// execute toolcall
|
||||||
match call.calls() {
|
match call.calls() {
|
||||||
ToolCalls::PresentNotes(_note_ids) => {
|
ToolCalls::PresentNotes(present) => {
|
||||||
self.chat.push(Message::ToolResponse(ToolResponse::new(
|
self.chat.push(Message::ToolResponse(ToolResponse::new(
|
||||||
call.id().to_owned(),
|
call.id().to_owned(),
|
||||||
ToolResponses::PresentNotes,
|
ToolResponses::PresentNotes(present.note_ids.len() as i32),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
should_send = true;
|
should_send = true;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ pub struct QueryResponse {
|
|||||||
pub enum ToolResponses {
|
pub enum ToolResponses {
|
||||||
Error(String),
|
Error(String),
|
||||||
Query(QueryResponse),
|
Query(QueryResponse),
|
||||||
PresentNotes,
|
PresentNotes(i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@@ -499,7 +499,7 @@ struct SimpleNote {
|
|||||||
/// it can interepret it and take further action
|
/// it can interepret it and take further action
|
||||||
fn format_tool_response_for_ai(txn: &Transaction, ndb: &Ndb, resp: &ToolResponses) -> String {
|
fn format_tool_response_for_ai(txn: &Transaction, ndb: &Ndb, resp: &ToolResponses) -> String {
|
||||||
match resp {
|
match resp {
|
||||||
ToolResponses::PresentNotes => "".to_string(),
|
ToolResponses::PresentNotes(n) => format!("{n} notes presented to the user"),
|
||||||
ToolResponses::Error(s) => format!("error: {}", &s),
|
ToolResponses::Error(s) => format!("error: {}", &s),
|
||||||
|
|
||||||
ToolResponses::Query(search_r) => {
|
ToolResponses::Query(search_r) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user