diff --git a/memento-note/app/actions/title-suggestions.ts b/memento-note/app/actions/title-suggestions.ts index 41dff0e..a55c58f 100644 --- a/memento-note/app/actions/title-suggestions.ts +++ b/memento-note/app/actions/title-suggestions.ts @@ -4,7 +4,7 @@ import { auth } from '@/auth' import { titleSuggestionService } from '@/lib/ai/services/title-suggestion.service' import { prisma } from '@/lib/prisma' import { revalidatePath } from 'next/cache' -import { createNoteHistorySnapshot, isNoteHistoryEnabledForUser } from '@/lib/note-history' +import { createNoteHistorySnapshot } from '@/lib/note-history' export interface GenerateTitlesResponse { suggestions: Array<{ @@ -84,8 +84,11 @@ export async function applyTitleSuggestion( }) try { - const historyEnabled = await isNoteHistoryEnabledForUser(session.user.id) - if (historyEnabled) { + const note = await prisma.note.findUnique({ + where: { id: noteId, userId: session.user.id }, + select: { historyEnabled: true }, + }) + if (note?.historyEnabled) { await createNoteHistorySnapshot({ noteId, userId: session.user.id, diff --git a/memento-note/components/note-inline-editor.tsx b/memento-note/components/note-inline-editor.tsx index 2470aed..f464b10 100644 --- a/memento-note/components/note-inline-editor.tsx +++ b/memento-note/components/note-inline-editor.tsx @@ -676,7 +676,7 @@ export function NoteInlineEditor({ e.preventDefault() setIsProcessingAI(true) try { - const res = await fetch('/api/ai/suggest-title', { + const res = await fetch('/api/ai/title-suggestions', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ content }),