Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(chat): pass note ID and folder ID to embedded chat context

Gabriel Steinb799e57779f8
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsx
index 74e3e4f51..a9c575b9b 100644
--- a/src/components/notes/NoteEditor.tsx
+++ b/src/components/notes/NoteEditor.tsx
@@ -126,6 +126,7 @@ export default function NoteEditor({
const embeddedChat = useEmbeddedChat({
noteId: note.id,
+ folderId: note.folder_id,
noteTitle: note.title,
noteContent: note.content,
noteTranscript: note.transcript ?? undefined,
diff --git a/src/config/prompts.ts b/src/config/prompts.ts
index 6649fc58c..e43b013ea 100644
--- a/src/config/prompts.ts
+++ b/src/config/prompts.ts
@@ -151,10 +151,10 @@ const TOOL_INSTRUCTIONS: Record<string, string> = {
search_notes:
"Use search_notes to find information from the user's past meetings, discussions, or personal notes before answering from memory.",
get_note:
- "Use get_note to fetch the full content of a specific note by ID. Use search_notes first to find the note ID.",
+ "Use get_note to fetch the full content of a specific note by ID. If the current note's ID is provided in the context, use it directly. Otherwise, use search_notes first to find the note ID.",
create_note: "Use create_note when the user asks you to create, write, or draft a new note.",
update_note:
- "Use update_note to modify an existing note's title, content, or move it to a different folder. Use search_notes first to find the note ID.",
+ "Use update_note to modify an existing note's title, content, or move it to a different folder. If the current note's ID is provided in the context, use it directly. Otherwise, use search_notes first to find the note ID.",
web_search:
"Use web_search for questions about current events, facts you're unsure about, or anything requiring up-to-date information.",
copy_to_clipboard:
diff --git a/src/hooks/useEmbeddedChat.ts b/src/hooks/useEmbeddedChat.ts
index 065070e2b..6cb1eb4a2 100644
--- a/src/hooks/useEmbeddedChat.ts
+++ b/src/hooks/useEmbeddedChat.ts
@@ -5,6 +5,7 @@ import type { Message, AgentState } from "../components/chat/types";
interface UseEmbeddedChatOptions {
noteId: number | null;
+ folderId: number | null;
noteTitle: string;
noteContent: string;
noteTranscript?: string;
@@ -19,6 +20,7 @@ interface UseEmbeddedChatReturn {
export function useEmbeddedChat({
noteId,
+ folderId,
noteTitle,
noteContent,
noteTranscript,
@@ -35,6 +37,8 @@ export function useEmbeddedChat({
const noteContextRef = useRef("");
noteContextRef.current = [
+ `Note ID: ${noteId}`,
+ folderId != null ? `Folder ID: ${folderId}` : "",
`Title: ${noteTitle}`,
`Content:\n${noteContent}`,
noteTranscript ? `\nTranscript:\n${noteTranscript}` : "",
diff --git a/src/services/tools/updateNoteTool.ts b/src/services/tools/updateNoteTool.ts
index e41b8a266..62266b979 100644
--- a/src/services/tools/updateNoteTool.ts
+++ b/src/services/tools/updateNoteTool.ts
@@ -5,7 +5,7 @@ import { syncNoteUpdateToCloud } from "../../stores/noteStore";
export const updateNoteTool: ToolDefinition = {
name: "update_note",
description:
- "Update an existing note's title, content, or move it to a different folder. Use search_notes first to find the note ID.",
+ "Update an existing note's title, content, or move it to a different folder. If the current note's ID is provided in the context, use it directly. Otherwise, use search_notes first to find the note ID.",
parameters: {
type: "object",
properties: {