fix: substitui aiConfig indefinido por hasActiveKey no render do Exams.tsx eliminando a tela branca (ReferenceError)
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 2m14s
Details
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 2m14s
Details
This commit is contained in:
parent
727942b92c
commit
66754cd1c1
|
|
@ -20,6 +20,13 @@ const Exams: React.FC<ExamsProps> = ({ data, updateData }) => {
|
||||||
const [activeTab, setActiveTab] = useState<'ativos' | 'lixeira'>('ativos');
|
const [activeTab, setActiveTab] = useState<'ativos' | 'lixeira'>('ativos');
|
||||||
const { showAlert, showConfirm } = useDialog();
|
const { showAlert, showConfirm } = useDialog();
|
||||||
|
|
||||||
|
const activeProvider = data.aiConfig?.activeProvider || 'gemini';
|
||||||
|
const hasActiveKey =
|
||||||
|
(activeProvider === 'gemini' && !!data.aiConfig?.geminiKey) ||
|
||||||
|
(activeProvider === 'openai' && !!data.aiConfig?.openaiKey) ||
|
||||||
|
(activeProvider === 'claude' && !!data.aiConfig?.claudeKey) ||
|
||||||
|
(activeProvider === 'openrouter' && !!data.aiConfig?.openrouterKey);
|
||||||
|
|
||||||
const [showAIConfigModal, setShowAIConfigModal] = useState(false);
|
const [showAIConfigModal, setShowAIConfigModal] = useState(false);
|
||||||
const [aiForm, setAiForm] = useState({
|
const [aiForm, setAiForm] = useState({
|
||||||
activeProvider: data.aiConfig?.activeProvider || 'gemini',
|
activeProvider: data.aiConfig?.activeProvider || 'gemini',
|
||||||
|
|
@ -972,7 +979,7 @@ const Exams: React.FC<ExamsProps> = ({ data, updateData }) => {
|
||||||
Questão
|
Questão
|
||||||
</h4>
|
</h4>
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
{aiConfig.apiKey && (
|
{hasActiveKey && (
|
||||||
<button
|
<button
|
||||||
onClick={() => handleRegenerateQuestionAI(qIndex)}
|
onClick={() => handleRegenerateQuestionAI(qIndex)}
|
||||||
disabled={isGeneratingAI}
|
disabled={isGeneratingAI}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue