Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(notes): prevent blank summaries for non-substantive recordings (#2201)
Chad Piha67dd247f2cde
diff --git a/src/helpers/builtinActions.js b/src/helpers/builtinActions.jsindex 604e95fcb..d865df1b4 100644--- a/src/helpers/builtinActions.js+++ b/src/helpers/builtinActions.js@@ -1,14 +1,14 @@// Built-in note actions. The database seeds any that are missing on startup and// only rewrites a row whose prompt still equals a previous default, so a user's-// edited prompt is never touched. Generate Notes keeps its original prompt and-// the generic system-prompt wrapper; the newer built-ins are complete+// edited prompt is never touched. Generate Notes uses the generic+// system-prompt wrapper; the newer built-ins are complete// instructions and are sent standalone (see STANDALONE_PROMPT_KEYS).export const GENERATE_NOTES_KEY = "notes.actions.builtin.generateNotes";export const DETAILED_NOTES_KEY = "notes.actions.builtin.detailedNotes";export const FOLLOW_UP_EMAIL_KEY = "notes.actions.builtin.followUpEmail";-const GENERATE_NOTES_PROMPT =+const GENERATE_NOTES_PROMPT_1_10_1 ="Transform the provided content into clean, well-structured notes in markdown. Preserve the user's intent and all substantive information. Remove filler, small talk, false starts, and redundant content. For personal notes, improve grammar and structure for readability. For meeting transcripts, extract key discussion points, decisions, action items, and follow-ups.";// Shipped in 1.10.0; kept so rows seeded with it upgrade. Its Owner/Due@@ -82,7 +82,7 @@ Return only the finished Markdown notes.`;// Action items must end in "— Owner" so the editor can turn owners into// mention chips (see tagActionItemOwners); a trailing due-date clause would// take the owner's place.-const DETAILED_NOTES_PROMPT = `Convert the provided material into accurate, comprehensive, easy-to-scan notes in Markdown. Priorities, in order: factual accuracy, preservation of specifics, complete coverage of substantive topics, clear decisions and action items, concise presentation.+const DETAILED_NOTES_PROMPT_1_10_1 = `Convert the provided material into accurate, comprehensive, easy-to-scan notes in Markdown. Priorities, in order: factual accuracy, preservation of specifics, complete coverage of substantive topics, clear decisions and action items, concise presentation.RULES:- Use only information supported by the material. Never invent facts, decisions, owners, deadlines, or names.@@ -113,6 +113,12 @@ Unresolved questions, dependencies, and requested follow-ups.Return only the finished Markdown notes.`;+// Omitting every unsupported section can otherwise produce a blank completion.+const NON_SUBSTANTIVE_NOTES_INSTRUCTIONS = `For material with no substantive discussion or notes (for example, only greetings, filler, or recording checks), return one brief factual sentence describing what was captured. If nothing meaningful can be summarized, say "No substantive content was captured." in the requested output language. This rule overrides the section structure and bullet counts above: do not return an empty response or invent topics, decisions, or action items. Consider both the transcript and any manual notes before applying this rule.`;++const GENERATE_NOTES_PROMPT = `${GENERATE_NOTES_PROMPT_1_10_1}\n\n${NON_SUBSTANTIVE_NOTES_INSTRUCTIONS}`;+const DETAILED_NOTES_PROMPT = `${DETAILED_NOTES_PROMPT_1_10_1}\n\n${NON_SUBSTANTIVE_NOTES_INSTRUCTIONS}`;+const FOLLOW_UP_EMAIL_PROMPT = `You are an expert at writing follow-up emails after meetings. Draft the follow-up email the user ("You") would send to the other participants, based only on the provided meeting material: meeting context, the user's manual notes, and the transcript.RULES:@@ -150,7 +156,7 @@ export const BUILTIN_ACTIONS = [description: "Clean up, structure, and enhance your notes",prompt: GENERATE_NOTES_PROMPT,// A pre-release build briefly shipped the detailed prompt under this key.- previousPrompts: [DETAILED_NOTES_PROMPT_1_10_0],+ previousPrompts: [DETAILED_NOTES_PROMPT_1_10_0, GENERATE_NOTES_PROMPT_1_10_1],icon: "sparkles",sortOrder: 0,},@@ -159,7 +165,7 @@ export const BUILTIN_ACTIONS = [name: "Detailed Notes",description: "Accurate, comprehensive meeting notes with decisions and action items",prompt: DETAILED_NOTES_PROMPT,- previousPrompts: [DETAILED_NOTES_PROMPT_1_10_0],+ previousPrompts: [DETAILED_NOTES_PROMPT_1_10_0, DETAILED_NOTES_PROMPT_1_10_1],icon: "sparkles",sortOrder: 1,},diff --git a/test/helpers/builtinActionsDatabase.test.js b/test/helpers/builtinActionsDatabase.test.jsnew file mode 100644index 000000000..5c32f1a04--- /dev/null+++ b/test/helpers/builtinActionsDatabase.test.js@@ -0,0 +1,74 @@+const test = require("node:test");+const assert = require("node:assert/strict");++const { createDb } = require("./harness/db.js");+const DatabaseManager = require("../../src/helpers/database.js");+const { BUILTIN_ACTIONS } = require("../../src/helpers/builtinActions.js");++const builtinRows = (db, translationKey) =>+ db.getActions().filter((row) => row.translation_key === translationKey);++// Opens the database again on the same userData directory, which reruns the+// startup seeding the way the next app launch would.+function relaunch(check) {+ const db = new DatabaseManager();+ try {+ check(db);+ } finally {+ db.db.close();+ }+}++test("no built-in lists its current prompt as a previous default", () => {+ for (const action of BUILTIN_ACTIONS) {+ assert.equal(action.previousPrompts.includes(action.prompt), false, action.name);+ }+});++for (const action of BUILTIN_ACTIONS) {+ const { translationKey, name } = action;++ test(`${name}: a fresh install seeds the current prompt`, (t) => {+ const db = createDb(t);+ if (!db) return;+ const rows = builtinRows(db, translationKey);+ assert.equal(rows.length, 1);+ assert.equal(rows[0].prompt, action.prompt);+ });++ action.previousPrompts.forEach((previousPrompt, index) => {+ const label = `${name}: previous default #${index + 1}`;++ test(`${label} upgrades once on launch`, (t) => {+ const db = createDb(t);+ if (!db) return;+ const { id } = builtinRows(db, translationKey)[0];+ db.db.prepare("UPDATE actions SET prompt = ? WHERE id = ?").run(previousPrompt, id);+ db.db.close();++ relaunch((upgraded) => {+ assert.equal(builtinRows(upgraded, translationKey)[0].prompt, action.prompt);+ });+ relaunch((steady) => {+ const rows = builtinRows(steady, translationKey);+ assert.equal(rows.length, 1);+ assert.equal(rows[0].id, id);+ assert.equal(rows[0].prompt, action.prompt);+ });+ });++ test(`${label} edited by the user survives launch`, (t) => {+ const db = createDb(t);+ if (!db) return;+ const edited = `${previousPrompt}\nAlways use numbered lists.`;+ db.db+ .prepare("UPDATE actions SET prompt = ? WHERE translation_key = ?")+ .run(edited, translationKey);+ db.db.close();++ relaunch((reopened) => {+ assert.equal(builtinRows(reopened, translationKey)[0].prompt, edited);+ });+ });+ });+}