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
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:
@@ -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,
|
||||
|
||||
@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user