Update AgentDashboard.tsx
This commit is contained in:
@@ -322,9 +322,14 @@ export const AgentDashboard: React.FC<AgentDashboardProps> = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!settings.aiConfig.apiKey) {
|
||||||
|
showToast("Chiave API mancante. Configura l'AI nelle impostazioni.", 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIsAiAnalyzing(true);
|
setIsAiAnalyzing(true);
|
||||||
setAiSuggestion(null);
|
setAiSuggestion(null);
|
||||||
const suggestion = await generateNewKBArticle(tickets, articles);
|
const suggestion = await generateNewKBArticle(settings.aiConfig.apiKey, tickets, articles);
|
||||||
setAiSuggestion(suggestion);
|
setAiSuggestion(suggestion);
|
||||||
setIsAiAnalyzing(false);
|
setIsAiAnalyzing(false);
|
||||||
};
|
};
|
||||||
@@ -828,6 +833,19 @@ export const AgentDashboard: React.FC<AgentDashboardProps> = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user