fix: organisateur IA — apply tag utilise syncNoteLabels au lieu de properties
All checks were successful
CI / Lint, Unit Tests & Build (push) Successful in 5m1s
CI / Deploy production (on server) (push) Successful in 1m2s

- applyTag faisait un PATCH sur /api/notes/[id]/properties avec { tags: [...] }
  mais l'API properties attend { properties: { propId: value } }
- Maintenant: PATCH /api/ai/organize-notebook qui appelle syncNoteLabels()
- Les tags sont appliqués comme LABELS (système existant) sur les notes
- Merge avec labels existants (n'écrase pas)
This commit is contained in:
Antigravity
2026-06-19 21:06:17 +00:00
parent 2ec31a3de5
commit 6084077b54
3 changed files with 48 additions and 9 deletions

View File

@@ -53,15 +53,14 @@ export function NotebookOrganizerDialog({
const applyTag = async (tagName: string, noteIds: string[]) => {
try {
for (const noteId of noteIds) {
await fetch(`/api/notes/${noteId}/properties`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tags: [tagName] }),
}).catch(() => {})
}
const res = await fetch('/api/ai/organize-notebook', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'apply_tag', tagName, noteIds, notebookId }),
})
if (!res.ok) throw new Error('Failed')
setAppliedTags(prev => new Set(prev).add(tagName))
toast.success(t('wizard.tagApplied') || `Tag "${tagName}" appliqué à ${noteIds.length} notes`)
toast.success(t('structuredViews.tagApplied') || `Tag "${tagName}" appliqué à ${noteIds.length} notes`)
} catch {
toast.error('Erreur')
}