Add error reporting to bulk AI summary generation

Surface actual API error messages in the admin UI instead of just
showing a generic failure count. This helps diagnose issues with
the OpenRouter API configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Terence Ong
2026-04-07 15:21:49 +07:00
parent 99aa2ca06d
commit 67f932a9e5
4 changed files with 48 additions and 2 deletions

View File

@@ -626,7 +626,11 @@ class Peptide_News_Admin {
if (remaining === 0) {
$result.text('Done! ' + totalProcessed + ' article(s) summarized.');
} else {
$result.text(totalProcessed + ' summarized. ' + remaining + ' could not be processed — check the debug log.');
var errMsg = totalProcessed + ' summarized. ' + remaining + ' could not be processed.';
if (response.data.errors && response.data.errors.length > 0) {
errMsg += ' Error: ' + response.data.errors[0];
}
$result.text(errMsg);
}
}
} else {