fix: force git reset on deploy + toast persistant de génération
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 23s
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 23s
- Remplace git pull par git fetch + git reset --hard origin/main dans le workflow CI pour éviter les conflits avec les fichiers locaux - Ajoute un toast Sonner persistant (duration: Infinity) dès le clic sur Générer, qui survit à la navigation et se met à jour en succès/erreur avec action directe (Télécharger / Ouvrir) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -121,7 +121,8 @@ jobs:
|
||||
|
||||
echo "=== Git pull ==="
|
||||
git config --global --add safe.directory /opt/memento
|
||||
git pull origin main
|
||||
git fetch origin main
|
||||
git reset --hard origin/main
|
||||
|
||||
echo "=== Building ==="
|
||||
docker compose build memento-note
|
||||
|
||||
@@ -271,6 +271,15 @@ export function ContextualAIChat({
|
||||
}
|
||||
setGenerateLoading(type)
|
||||
setGenerateResult(null)
|
||||
|
||||
// Persistent loading toast — survives navigation (Sonner is layout-level)
|
||||
const toastId = toast.loading(
|
||||
type === 'slides'
|
||||
? (t('ai.generate.toastLoading.slides') || '⏳ Génération de la présentation en cours…')
|
||||
: (t('ai.generate.toastLoading.diagram') || '⏳ Génération du diagramme en cours…'),
|
||||
{ duration: Infinity, description: t('ai.generate.toastLoadingDesc') || 'Vous pouvez naviguer librement, une notification apparaîtra.' }
|
||||
)
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/agents/run-for-note', {
|
||||
method: 'POST',
|
||||
@@ -282,16 +291,34 @@ export function ContextualAIChat({
|
||||
})
|
||||
const data = await res.json()
|
||||
if (!res.ok || !data.success) {
|
||||
toast.error(data.error || t('ai.generate.error') || 'Erreur lors de la génération')
|
||||
toast.error(data.error || t('ai.generate.error') || 'Erreur lors de la génération', { id: toastId })
|
||||
return
|
||||
}
|
||||
setGenerateResult({ type, canvasId: data.canvasId, noteId: data.noteId })
|
||||
toast.success(type === 'slides'
|
||||
? (t('ai.generate.slidesReady') || 'Présentation générée !')
|
||||
: (t('ai.generate.diagramReady') || 'Diagramme généré !')
|
||||
)
|
||||
|
||||
if (type === 'slides' && data.canvasId) {
|
||||
toast.success(t('ai.generate.slidesReady') || 'Présentation générée !', {
|
||||
id: toastId,
|
||||
duration: 10000,
|
||||
description: t('ai.generate.toastSuccessSlides') || 'Cliquez sur le bouton Télécharger dans le panneau IA.',
|
||||
action: { label: t('ai.generate.downloadPptx') || 'Télécharger', onClick: () => window.open(`/api/canvas/download?id=${data.canvasId}`, '_blank') },
|
||||
})
|
||||
} else if (type === 'diagram' && data.canvasId) {
|
||||
toast.success(t('ai.generate.diagramReady') || 'Diagramme généré !', {
|
||||
id: toastId,
|
||||
duration: 10000,
|
||||
description: t('ai.generate.toastSuccessDiagram') || 'Votre diagramme est disponible dans le Lab.',
|
||||
action: { label: t('ai.generate.openDiagram') || 'Ouvrir', onClick: () => window.location.href = `/lab?canvas=${data.canvasId}` },
|
||||
})
|
||||
} else {
|
||||
toast.success(type === 'slides'
|
||||
? (t('ai.generate.slidesReady') || 'Présentation générée !')
|
||||
: (t('ai.generate.diagramReady') || 'Diagramme généré !'),
|
||||
{ id: toastId }
|
||||
)
|
||||
}
|
||||
} catch {
|
||||
toast.error(t('ai.generate.error') || 'Erreur lors de la génération')
|
||||
toast.error(t('ai.generate.error') || 'Erreur lors de la génération', { id: toastId })
|
||||
} finally {
|
||||
setGenerateLoading(null)
|
||||
}
|
||||
|
||||
@@ -446,7 +446,14 @@
|
||||
"downloadPptx": "Download .pptx",
|
||||
"openDiagram": "Open in Lab",
|
||||
"error": "Error during generation",
|
||||
"noNoteId": "Save the note first"
|
||||
"noNoteId": "Save the note first",
|
||||
"toastLoading": {
|
||||
"slides": "⏳ Generating presentation…",
|
||||
"diagram": "⏳ Generating diagram…"
|
||||
},
|
||||
"toastLoadingDesc": "You can navigate freely, a notification will appear.",
|
||||
"toastSuccessSlides": "Click Download in the AI panel.",
|
||||
"toastSuccessDiagram": "Your diagram is available in the Lab."
|
||||
},
|
||||
"openAssistant": "Open AI Assistant",
|
||||
"poweredByMomento": "Powered by Momento AI",
|
||||
|
||||
@@ -446,7 +446,14 @@
|
||||
"downloadPptx": "Télécharger le .pptx",
|
||||
"openDiagram": "Ouvrir dans le Lab",
|
||||
"error": "Erreur lors de la génération",
|
||||
"noNoteId": "Enregistrez d'abord la note"
|
||||
"noNoteId": "Enregistrez d'abord la note",
|
||||
"toastLoading": {
|
||||
"slides": "⏳ Génération de la présentation en cours…",
|
||||
"diagram": "⏳ Génération du diagramme en cours…"
|
||||
},
|
||||
"toastLoadingDesc": "Vous pouvez naviguer librement, une notification apparaîtra.",
|
||||
"toastSuccessSlides": "Cliquez sur Télécharger dans le panneau IA.",
|
||||
"toastSuccessDiagram": "Votre diagramme est disponible dans le Lab."
|
||||
},
|
||||
"openAssistant": "Ouvrir IA Note",
|
||||
"poweredByMomento": "Propulsé par Momento AI",
|
||||
|
||||
Reference in New Issue
Block a user