debug: add diagnostic logging for label suggestion flow
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 42s

Log key points in /api/ai/tags and ContextualAutoTagService to trace
where label suggestions fail: notebook lookup, AI raw response,
JSON parsing, filtered results.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 00:18:20 +02:00
parent 6ff8088cc2
commit 295bc29786
2 changed files with 15 additions and 4 deletions

View File

@@ -31,6 +31,7 @@ export async function POST(req: NextRequest) {
// If notebookId is provided, use contextual suggestions (IA2)
if (notebookId) {
try {
console.log('[/api/ai/tags] contextual request — notebookId:', notebookId, 'content length:', content.length)
const suggestions = await contextualAutoTagService.suggestLabels(
content,
notebookId,
@@ -38,6 +39,8 @@ export async function POST(req: NextRequest) {
language
);
console.log('[/api/ai/tags] suggestions:', suggestions.length, suggestions.map(s => `${s.label}(${s.confidence})`))
const convertedTags = suggestions.map(s => ({
tag: s.label,
confidence: s.confidence,