From 66754cd1c1c142e5cbc4cdef45b9031d89538fcc Mon Sep 17 00:00:00 2001 From: Sidney Date: Fri, 17 Jul 2026 22:15:39 -0300 Subject: [PATCH] fix: substitui aiConfig indefinido por hasActiveKey no render do Exams.tsx eliminando a tela branca (ReferenceError) --- manager/components/Exams.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/manager/components/Exams.tsx b/manager/components/Exams.tsx index 62c3439..daaf9b9 100644 --- a/manager/components/Exams.tsx +++ b/manager/components/Exams.tsx @@ -20,6 +20,13 @@ const Exams: React.FC = ({ data, updateData }) => { const [activeTab, setActiveTab] = useState<'ativos' | 'lixeira'>('ativos'); 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 [aiForm, setAiForm] = useState({ activeProvider: data.aiConfig?.activeProvider || 'gemini', @@ -972,7 +979,7 @@ const Exams: React.FC = ({ data, updateData }) => { Questão
- {aiConfig.apiKey && ( + {hasActiveKey && (