diff --git a/components/AgentDashboard.tsx b/components/AgentDashboard.tsx index 3e11f03..081d308 100644 --- a/components/AgentDashboard.tsx +++ b/components/AgentDashboard.tsx @@ -321,10 +321,15 @@ export const AgentDashboard: React.FC = ({ showToast("Quota creazione articoli AI raggiunta. Impossibile generare nuovi suggerimenti.", 'error'); return; } + + if (!settings.aiConfig.apiKey) { + showToast("Chiave API mancante. Configura l'AI nelle impostazioni.", 'error'); + return; + } setIsAiAnalyzing(true); setAiSuggestion(null); - const suggestion = await generateNewKBArticle(tickets, articles); + const suggestion = await generateNewKBArticle(settings.aiConfig.apiKey, tickets, articles); setAiSuggestion(suggestion); setIsAiAnalyzing(false); }; @@ -828,6 +833,19 @@ export const AgentDashboard: React.FC = ({ /> + + {/* API KEY FIELD */} +
+ + setTempSettings({...tempSettings, aiConfig: {...tempSettings.aiConfig, apiKey: e.target.value}})} + /> +

La chiave non verrĂ  mostrata in chiaro dopo il salvataggio.

+
)}