fix: noms PlantNet en français (lang=fr) + sauvegarde image systématique sans plante liée

This commit is contained in:
2026-02-22 13:11:34 +01:00
parent 7361958fe2
commit 326158f680
2 changed files with 12 additions and 13 deletions

View File

@@ -184,18 +184,17 @@ async function saveAndLink() {
'/api/upload',
fd,
)
if (linkPlantId.value !== null) {
await axios.post('/api/media', {
entity_type: 'plante',
entity_id: linkPlantId.value,
url: uploaded.url,
thumbnail_url: uploaded.thumbnail_url,
identified_species: r.species,
identified_common: r.common_name,
identified_confidence: r.confidence,
identified_source: source.value,
})
}
// Toujours sauvegarder : lié à une plante si choisie, sinon dans la bibliothèque générale
await axios.post('/api/media', {
entity_type: linkPlantId.value !== null ? 'plante' : 'bibliotheque',
entity_id: linkPlantId.value ?? 0,
url: uploaded.url,
thumbnail_url: uploaded.thumbnail_url,
identified_species: r.species,
identified_common: r.common_name,
identified_confidence: r.confidence,
identified_source: source.value,
})
emit('identified', { ...r, imageUrl: uploaded.url, plantId: linkPlantId.value })
emit('close')
} finally {