Clarify empty AI reply errors
This commit is contained in:
parent
b712a0a9cb
commit
a6b6a22de7
2 changed files with 9 additions and 2 deletions
|
|
@ -3753,7 +3753,11 @@ import { bindMenuDismiss, dismissOrRemove } from './escMenuStack.js';
|
||||||
await _streamEmailBodyText(textarea, newBody);
|
await _streamEmailBodyText(textarea, newBody);
|
||||||
if (uiModule) uiModule.showToast(`AI draft inserted (${data.model_used || 'AI'})`);
|
if (uiModule) uiModule.showToast(`AI draft inserted (${data.model_used || 'AI'})`);
|
||||||
} else {
|
} else {
|
||||||
if (uiModule) uiModule.showError(data.error || 'Failed to generate reply');
|
const rawMsg = data.error || 'Failed to generate reply';
|
||||||
|
const msg = /empty response/i.test(rawMsg)
|
||||||
|
? 'AI reply failed: AI returned empty response.'
|
||||||
|
: rawMsg;
|
||||||
|
if (uiModule) uiModule.showError(msg);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (uiModule) uiModule.showError('Failed to generate AI reply');
|
if (uiModule) uiModule.showError('Failed to generate AI reply');
|
||||||
|
|
|
||||||
|
|
@ -804,7 +804,10 @@ async function _openEmail(em, itemEl, preloadedData = null, mode = 'reply', note
|
||||||
if (result.success && result.reply) {
|
if (result.success && result.reply) {
|
||||||
aiSuggestedBody = _cleanAiReplyText(result.reply);
|
aiSuggestedBody = _cleanAiReplyText(result.reply);
|
||||||
} else {
|
} else {
|
||||||
const _msg = result.error || 'AI reply could not be generated';
|
const _rawMsg = result.error || 'AI reply could not be generated';
|
||||||
|
const _msg = /empty response/i.test(_rawMsg)
|
||||||
|
? 'AI returned empty response.'
|
||||||
|
: _rawMsg;
|
||||||
console.error('AI reply generation failed:', _msg);
|
console.error('AI reply generation failed:', _msg);
|
||||||
import('./ui.js').then(m => m.showError && m.showError('AI reply failed: ' + _msg)).catch(() => {});
|
import('./ui.js').then(m => m.showError && m.showError('AI reply failed: ' + _msg)).catch(() => {});
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue