fix: wrong title suggestion API URL (404) + per-note history check
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 42s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-28 22:24:05 +02:00
parent b92f6384a4
commit 6f2b0279ff
2 changed files with 7 additions and 4 deletions

View File

@@ -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,

View File

@@ -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 }),