Fix QuickCreate AI request payload

This commit is contained in:
Christian 2026-03-18 10:25:47 +01:00
parent 73803f894b
commit 153eb728e2
2 changed files with 21 additions and 3 deletions

14
RELEASE_NOTES_v2.2.63.md Normal file
View File

@ -0,0 +1,14 @@
# Release Notes v2.2.63
Dato: 18. marts 2026
## Fixes
- Rettet QuickCreate AI-analyse request i frontend.
- `POST /api/v1/sag/analyze-quick-create` får nu korrekt payload med både `text` og `user_id` i body.
- Forbedret fejllog i frontend ved AI-fejl (inkl. HTTP status), så fejl ikke bliver skjult som generisk "Analysis failed".
## Berørte filer
- `app/shared/frontend/quick_create_modal.html`
- `RELEASE_NOTES_v2.2.63.md`

View File

@ -303,15 +303,19 @@
async function performAnalysis(text) {
try {
const userId = getUserId();
const response = await fetch(`/api/v1/sag/analyze-quick-create?user_id=${userId}`, {
const response = await fetch('/api/v1/sag/analyze-quick-create', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
credentials: 'include',
body: JSON.stringify({text})
body: JSON.stringify({
text,
user_id: parseInt(userId, 10)
})
});
if (!response.ok) {
throw new Error('Analysis failed');
const errorText = await response.text();
throw new Error(`Analysis failed (${response.status}): ${errorText || 'unknown error'}`);
}
const analysis = await response.json();