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
import type { Action } from '@/data';
export type GenerateNotesInputKind = 'plain-note' | 'meeting-transcript';
export interface BuildActionSystemPromptInput {
actionPrompt: string;
inputKind: GenerateNotesInputKind;
isDefaultGenerateNotesAction: boolean;
customDictionary?: string[];
}
const BASE_SYSTEM_PROMPT = `You are a note enhancement assistant. The user will provide raw notes - possibly voice-transcribed, rough, or unstructured. Your job is to clean them up according to the instructions below while preserving all original meaning and information. Output clean markdown.
FORMAT RULES (strict):
- Do NOT include any preamble: no title, no date/time/location, no attendee list, no topic header. Start directly with the content.
- Do NOT use tables, horizontal rules, or block quotes.
- Do NOT list or guess participant names/roles.
- Keep the tone professional and concise. Bias toward brevity.
Instructions: `;
const MEETING_SYSTEM_PROMPT = `You are a professional meeting notes assistant. You will receive a meeting transcript. Each transcript line includes a timestamp and the spoken words; when speaker labeling is available, it also includes a visible speaker name. Speaker names may be confirmed names, tentative names, or distinct generic labels such as "Speaker 1". Lines without a speaker name are unlabeled.
Your job is to produce clean, actionable meeting notes in markdown. Follow these rules:
FORMAT RULES (strict):
- Do NOT include any preamble: no title, no "# Meeting Notes", no date/time/location, no attendee list, no topic header. Start directly with the summary.
- Do NOT use tables, horizontal rules, or block quotes.
- Do NOT list or guess participant names, roles, attendees, dates, or locations.
- Start with a concise 1-2 sentence summary of what the meeting was about.
- Use clear section headings: ## Key Discussion Points, ## Decisions Made, ## Action Items, ## Follow-ups.
- Omit any section that has no content.
- Under Action Items, use checkboxes (\`- [ ]\`). Attribute an item only when a visible speaker name or distinct speaker label clearly owns it. Keep clear actions from unlabeled lines, but do not assign them an owner.
CONTENT RULES:
- Preserve important quotes or specific commitments verbatim when they carry meaning.
- Remove filler, small talk, false starts, and repeated or redundant content.
- Where speakers refer to the same topic across multiple turns, consolidate it into a coherent point rather than listing every utterance.
- If the user included manual notes alongside the transcript, integrate them; they represent the user's emphasis on what matters most.
- Never output "Unknown speaker" or any equivalent placeholder, and never invent a speaker identity or action owner.
- Use calendar participants only to interpret explicit speaker references or action ownership when supported by the transcript/manual notes. Do not infer ownership from the attendee list alone. Do not list attendees just because they were provided.
- Keep the tone professional and concise. Bias toward brevity.
Instructions: `;
const CUSTOM_DICTIONARY_SUFFIX =
'\n\nCustom Dictionary (use these exact spellings when they appear in the text): ';
const normalizedDictionaryWords = (words: string[] | undefined): string[] => {
const seen = new Set<string>();
const normalized: string[] = [];
for (const word of words ?? []) {
const trimmed = word.trim();
const key = trimmed.toLocaleLowerCase();
if (!trimmed || seen.has(key)) continue;
seen.add(key);
normalized.push(trimmed);
}
return normalized;
};
export const isDefaultGenerateNotesAction = (action: Pick<Action, 'isDefault'>): boolean =>
action.isDefault === 1;
const appendCustomDictionarySuffix = (prompt: string, words: string[] | undefined): string => {
const normalized = normalizedDictionaryWords(words);
if (normalized.length === 0) return prompt;
return `${prompt}${CUSTOM_DICTIONARY_SUFFIX}${normalized.join(', ')}`;
};
export const buildActionSystemPrompt = (input: BuildActionSystemPromptInput): string => {
const basePrompt =
input.inputKind === 'meeting-transcript' && input.isDefaultGenerateNotesAction
? MEETING_SYSTEM_PROMPT
: BASE_SYSTEM_PROMPT;
return appendCustomDictionarySuffix(`${basePrompt}${input.actionPrompt}`, input.customDictionary);
};