Update AgentDashboard.tsx
This commit is contained in:
@@ -321,10 +321,15 @@ export const AgentDashboard: React.FC<AgentDashboardProps> = ({
|
||||
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<AgentDashboardProps> = ({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* API KEY FIELD */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">API Key</label>
|
||||
<input
|
||||
type="password"
|
||||
placeholder="Inserisci la tua API Key..."
|
||||
className="w-full border border-gray-300 rounded-md px-3 py-2 bg-white text-gray-900 font-mono"
|
||||
value={tempSettings.aiConfig.apiKey}
|
||||
onChange={(e) => setTempSettings({...tempSettings, aiConfig: {...tempSettings.aiConfig, apiKey: e.target.value}})}
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">La chiave non verrà mostrata in chiaro dopo il salvataggio.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user