feat: photo quality improvements

- webcam capture resolution/quality configurable in admin settings (defaults 640x480 / 0.92)
- enhance photo modal in journal: original vs preview with sliders (brightness, contrast, saturation, sharpen) and auto-levels button
- new endpoint PUT /api/entries/:id/photo/enhance replaces photo, cleans old file and thumb
- sharper HEIC conversion (0.92) and webp thumbnails (85)
- worker: fail explicitly on empty AI response
This commit is contained in:
dev
2026-09-17 15:07:43 +03:00
parent 57e48a9d4f
commit 049df61e55
7 changed files with 354 additions and 11 deletions
+6 -1
View File
@@ -128,7 +128,12 @@ function createEntryAutoChecker({ pool, getSetting, logAudit, aiUrl, defaultProm
});
if (!res.ok) throw new Error(`AI service error: ${res.status}`);
const data = await res.json();
return (data.choices?.[0]?.message?.content || '').trim();
const choice = data.choices && data.choices[0];
const content = (choice && choice.message && choice.message.content || '').trim();
if (!content) {
throw new Error(`Модель вернула пустой ответ (finish_reason=${choice && choice.finish_reason || 'unknown'})`);
}
return content;
} finally {
clearTimeout(timer);
}