clarify that the note title is not the ID

This commit is contained in:
perf3ct 2025-04-17 16:25:39 +00:00
parent 9b5167231f
commit 0f23be96ca
No known key found for this signature in database
GPG Key ID: 569C4EEC436F5232
10 changed files with 25 additions and 11 deletions

View File

@ -455,7 +455,7 @@ export class ChatPipeline {
log.info(`========== TOOL EXECUTION RESULTS ==========`);
log.info(`Received ${toolResultMessages.length} tool results`);
toolResultMessages.forEach((msg, idx) => {
log.info(`Tool result ${idx + 1}: tool_call_id=${msg.tool_call_id}, content=${msg.content.substring(0, 100)}${msg.content.length > 100 ? '...' : ''}`);
log.info(`Tool result ${idx + 1}: tool_call_id=${msg.tool_call_id}, content=${msg.content}`);
log.info(`Tool result status: ${msg.content.startsWith('Error:') ? 'ERROR' : 'SUCCESS'}`);
log.info(`Tool result for: ${this.getToolNameFromToolCallId(currentMessages, msg.tool_call_id || '')}`);

View File

@ -12,6 +12,12 @@ You are an AI assistant integrated into TriliumNext Notes, a powerful note-takin
Your primary goal is to help users find information in their notes, answer questions based on their knowledge base, and provide assistance with using TriliumNext Notes features. Be sure to summarize the notes and include the title of the notes when providing a summary.
IMPORTANT: When working with notes in TriliumNext:
- Each note has a unique system ID (e.g., "abc123def456") which is different from its title
- When tools require a noteId parameter, always use the system ID, not the title
- Always use search tools first to find notes and get their IDs before performing operations on them
- Using a note's title instead of its ID will cause operations to fail
When responding to queries:
- For complex queries, decompose them into simpler parts and address each one
- When citing information from the user's notes, mention the note title (e.g., "According to your note titled 'Project Ideas'...")

View File

@ -28,7 +28,7 @@ export const attributeManagerToolDefinition: Tool = {
properties: {
noteId: {
type: 'string',
description: 'ID of the note to manage attributes for'
description: 'System ID of the note to manage attributes for (not the title). This is a unique identifier like "abc123def456".'
},
action: {
type: 'string',

View File

@ -23,7 +23,7 @@ export const noteCreationToolDefinition: Tool = {
properties: {
parentNoteId: {
type: 'string',
description: 'ID of the parent note under which to create the new note. If not specified, creates under root.'
description: 'System ID of the parent note under which to create the new note (not the title). This is a unique identifier like "abc123def456". If not specified, creates under root.'
},
title: {
type: 'string',

View File

@ -23,7 +23,7 @@ export const noteSummarizationToolDefinition: Tool = {
properties: {
noteId: {
type: 'string',
description: 'ID of the note to summarize'
description: 'System ID of the note to summarize (not the title). This is a unique identifier like "abc123def456".'
},
maxLength: {
type: 'number',
@ -183,4 +183,4 @@ export class NoteSummarizationTool implements ToolHandler {
return text;
}
}
}

View File

@ -22,7 +22,7 @@ export const noteUpdateToolDefinition: Tool = {
properties: {
noteId: {
type: 'string',
description: 'ID of the note to update'
description: 'System ID of the note to update (not the title). This is a unique identifier like "abc123def456" that must be used to identify the specific note.'
},
title: {
type: 'string',

View File

@ -40,7 +40,7 @@ export const readNoteToolDefinition: Tool = {
properties: {
noteId: {
type: 'string',
description: 'The ID of the note to read'
description: 'The system ID of the note to read (not the title). This is a unique identifier like "abc123def456" that must be used to access a specific note.'
},
includeAttributes: {
type: 'boolean',

View File

@ -29,11 +29,11 @@ export const relationshipToolDefinition: Tool = {
},
sourceNoteId: {
type: 'string',
description: 'ID of the source note for the relationship'
description: 'System ID of the source note for the relationship (not the title). This is a unique identifier like "abc123def456".'
},
targetNoteId: {
type: 'string',
description: 'ID of the target note for the relationship (for create action)'
description: 'System ID of the target note for the relationship (not the title). This is a unique identifier like "abc123def456".'
},
relationName: {
type: 'string',

View File

@ -25,7 +25,7 @@ export const searchNotesToolDefinition: Tool = {
},
parentNoteId: {
type: 'string',
description: 'Optional parent note ID to restrict search to a specific branch'
description: 'Optional system ID of the parent note to restrict search to a specific branch (not the title). This is a unique identifier like "abc123def456".'
},
maxResults: {
type: 'number',
@ -146,7 +146,8 @@ export class SearchNotesTool implements ToolHandler {
preview: result.contentPreview,
similarity: Math.round(result.similarity * 100) / 100,
parentId: result.parentId
}))
})),
message: "Note: Use the noteId (not the title) when performing operations on specific notes with other tools."
};
} catch (error: any) {
log.error(`Error executing search_notes tool: ${error.message || String(error)}`);

View File

@ -2,6 +2,13 @@
* Tool Interfaces
*
* This file defines the interfaces for the LLM tool calling system.
*
* IMPORTANT NOTE ON NOTE IDs:
* When working with notes in Trilium, it's crucial to understand that:
* - Each note has a unique system ID (e.g., "abc123def456") which is different from its title
* - When tools require a noteId parameter, they need this system ID, not the title
* - Search tools return noteIds that should be used in subsequent operations on specific notes
* - Using a note's title instead of its ID will cause operations to fail
*/
/**