fix: pass editorial brief to LLM prompt + improve missing API key error
- Add 'brief' field to GenerateContentRequest schema - Pass brief from router to generate_post_text service - Inject brief as mandatory instructions in LLM prompt with highest priority - Return structured error when LLM provider/API key not configured - Show dedicated warning banner with link to Settings when API key missing Fixes: content ignoring editorial brief, unhelpful API key error messages Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,13 @@ export default function ContentPage() {
|
||||
setGenerated(data)
|
||||
setEditText(data.text_content || '')
|
||||
} catch (err) {
|
||||
setError(err.message || 'Errore nella generazione')
|
||||
if (err.data?.missing_settings) {
|
||||
setError('__MISSING_SETTINGS__')
|
||||
} else if (err.data?.upgrade_required) {
|
||||
setError(err.data.message || 'Limite piano raggiunto. Passa a Pro.')
|
||||
} else {
|
||||
setError(err.message || 'Errore nella generazione')
|
||||
}
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -140,11 +146,23 @@ export default function ContentPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
{error && (error === '__MISSING_SETTINGS__' ? (
|
||||
<div style={{ padding: '1.25rem 1.5rem', backgroundColor: '#FFFBEB', border: '1px solid #FDE68A', borderLeft: '4px solid #F59E0B', marginBottom: '1rem' }}>
|
||||
<div style={{ fontWeight: 600, fontSize: '0.9rem', color: '#92400E', marginBottom: '0.5rem' }}>
|
||||
⚙ Provider AI non configurato
|
||||
</div>
|
||||
<p style={{ fontSize: '0.85rem', color: '#78350F', margin: '0 0 0.75rem', lineHeight: 1.6 }}>
|
||||
Per generare contenuti devi prima configurare un provider AI (Claude, OpenAI, Gemini...) e inserire la tua API key.
|
||||
</p>
|
||||
<Link to="/settings" style={{ ...btnPrimary, backgroundColor: '#F59E0B', textDecoration: 'none', fontSize: '0.82rem', padding: '0.5rem 1rem' }}>
|
||||
Vai alle Impostazioni →
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ padding: '0.75rem 1rem', backgroundColor: 'var(--error-light)', border: '1px solid #FED7D7', color: 'var(--error)', fontSize: '0.875rem', marginBottom: '1rem' }}>
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
))}
|
||||
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', gap: '1.25rem' }}>
|
||||
{/* Generation form */}
|
||||
|
||||
Reference in New Issue
Block a user