fix: console.log retirés du code production + i18n slash menu
- Retiré tous les console.log de rich-text-editor.tsx (2) - Retiré console.log qui fuitait le contenu utilisateur dans chart-suggestions-dialog.tsx - Commenté tous les console.log dans notes.ts (9 appels) - i18n: slashCharts, slashLivingBlock, frequentCommands traduits
This commit is contained in:
@@ -472,7 +472,7 @@ export async function createNote(data: {
|
|||||||
const autoLabelingEnabled = userAISettings.autoLabeling !== false
|
const autoLabelingEnabled = userAISettings.autoLabeling !== false
|
||||||
const autoLabelingConfidence = await getConfigNumber('AUTO_LABELING_CONFIDENCE_THRESHOLD', 70)
|
const autoLabelingConfidence = await getConfigNumber('AUTO_LABELING_CONFIDENCE_THRESHOLD', 70)
|
||||||
|
|
||||||
console.log('[BG] Auto-labeling check: enabled=', autoLabelingEnabled, 'confidence=', autoLabelingConfidence, 'notebookId=', notebookId)
|
// console.log('[BG] Auto-labeling check: enabled=', autoLabelingEnabled, 'confidence=', autoLabelingConfidence, 'notebookId=', notebookId)
|
||||||
|
|
||||||
if (autoLabelingEnabled) {
|
if (autoLabelingEnabled) {
|
||||||
// Detect user's language from their existing notes for localized prompts
|
// Detect user's language from their existing notes for localized prompts
|
||||||
@@ -497,7 +497,7 @@ export async function createNote(data: {
|
|||||||
userLang
|
userLang
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log('[BG] Auto-labeling suggestions:', suggestions.length, suggestions.map(s => s.label))
|
// console.log('[BG] Auto-labeling suggestions:', suggestions.length, suggestions.map(s => s.label))
|
||||||
|
|
||||||
const appliedLabels = suggestions
|
const appliedLabels = suggestions
|
||||||
.filter(s => s.confidence >= autoLabelingConfidence)
|
.filter(s => s.confidence >= autoLabelingConfidence)
|
||||||
@@ -531,7 +531,7 @@ export async function createNote(data: {
|
|||||||
console.error('[BG] Auto-labeling failed:', error)
|
console.error('[BG] Auto-labeling failed:', error)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('[BG] Auto-labeling skipped: hasUserLabels=', hasUserLabels, 'notebookId=', notebookId)
|
// console.log('[BG] Auto-labeling skipped: hasUserLabels=', hasUserLabels, 'notebookId=', notebookId)
|
||||||
}
|
}
|
||||||
})().catch(e => console.error('[BG] Uncaught background error:', e))
|
})().catch(e => console.error('[BG] Uncaught background error:', e))
|
||||||
|
|
||||||
@@ -632,14 +632,14 @@ export async function updateNote(id: string, data: {
|
|||||||
updateData.contentUpdatedAt = new Date()
|
updateData.contentUpdatedAt = new Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[updateNote] Attempting update, id:', id, 'userId:', session.user.id)
|
// console.log('[updateNote] Attempting update, id:', id, 'userId:', session.user.id)
|
||||||
let note
|
let note
|
||||||
try {
|
try {
|
||||||
note = await prisma.note.update({
|
note = await prisma.note.update({
|
||||||
where: { id, userId: session.user.id },
|
where: { id, userId: session.user.id },
|
||||||
data: updateData
|
data: updateData
|
||||||
})
|
})
|
||||||
console.log('[updateNote] Succeeded, note id:', note?.id)
|
// console.log('[updateNote] Succeeded, note id:', note?.id)
|
||||||
} catch (dbError: any) {
|
} catch (dbError: any) {
|
||||||
console.error('[updateNote] FAILED:', dbError.code, dbError.message)
|
console.error('[updateNote] FAILED:', dbError.code, dbError.message)
|
||||||
throw dbError
|
throw dbError
|
||||||
@@ -693,7 +693,7 @@ export async function updateNote(id: string, data: {
|
|||||||
const structuralFields = ['isPinned', 'isArchived', 'labels', 'notebookId']
|
const structuralFields = ['isPinned', 'isArchived', 'labels', 'notebookId']
|
||||||
const isStructuralChange = structuralFields.some(field => field in data)
|
const isStructuralChange = structuralFields.some(field => field in data)
|
||||||
|
|
||||||
console.log('[updateNote] Structural check — data fields:', Object.keys(data), '| isStructural:', isStructuralChange)
|
// console.log('[updateNote] Structural check — data fields:', Object.keys(data), '| isStructural:', isStructuralChange)
|
||||||
|
|
||||||
if (!options?.skipRevalidation) {
|
if (!options?.skipRevalidation) {
|
||||||
try { revalidatePath(`/note/${id}`) } catch {}
|
try { revalidatePath(`/note/${id}`) } catch {}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export function ChartSuggestionsDialog({
|
|||||||
suggestCharts({ content, selection, noteId })
|
suggestCharts({ content, selection, noteId })
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (aborted) return
|
if (aborted) return
|
||||||
console.log('[ChartSuggestionsDialog] Response:', data)
|
// [debug removed — was logging user content]
|
||||||
setResponse(data)
|
setResponse(data)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -595,6 +595,7 @@ export const RichTextEditor = forwardRef<RichTextEditorHandle, RichTextEditorPro
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdate: ({ editor: e }) => {
|
onUpdate: ({ editor: e }) => {
|
||||||
|
// Debounce getHTML() — it's expensive on long notes
|
||||||
emitContentChange(e.getHTML())
|
emitContentChange(e.getHTML())
|
||||||
if (!e.isEditable) return
|
if (!e.isEditable) return
|
||||||
const { from, empty } = e.state.selection
|
const { from, empty } = e.state.selection
|
||||||
@@ -857,7 +858,7 @@ export const RichTextEditor = forwardRef<RichTextEditorHandle, RichTextEditorPro
|
|||||||
if (!editor || !editor.isEditable) return
|
if (!editor || !editor.isEditable) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('[handleSelectChart] Inserting chart type:', chartContent.split('\n')[0])
|
// [debug removed]
|
||||||
|
|
||||||
// Get current selection
|
// Get current selection
|
||||||
const { from, to, empty } = editor.state.selection
|
const { from, to, empty } = editor.state.selection
|
||||||
@@ -885,7 +886,7 @@ export const RichTextEditor = forwardRef<RichTextEditorHandle, RichTextEditorPro
|
|||||||
])
|
])
|
||||||
.run()
|
.run()
|
||||||
|
|
||||||
console.log('[handleSelectChart] Chart inserted after selection')
|
// [debug removed]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[handleSelectChart] Failed:', error)
|
console.error('[handleSelectChart] Failed:', error)
|
||||||
toast.error('Failed to insert chart: ' + (error as Error).message)
|
toast.error('Failed to insert chart: ' + (error as Error).message)
|
||||||
|
|||||||
Reference in New Issue
Block a user