import React, { useState } from 'react'; import { Sparkles, X, ShieldAlert, CheckCircle, RefreshCw } from 'lucide-react'; interface AiAdvisorModalProps { isOpen: boolean; onClose: () => void; initialData?: any; } export const AiAdvisorModal: React.FC = ({ isOpen, onClose, initialData }) => { const [reportText, setReportText] = useState(null); const [isLoading, setIsLoading] = useState(false); if (!isOpen) return null; const handleGenerateReport = async () => { setIsLoading(true); setReportText(null); try { const response = await fetch('/api/ml-advisor', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(initialData || { compoundName: 'Doxorubicin', smiles: 'CC1C(C(CC(O1)OC2CC(CC3=C(C4=C(C(=C23)O)C(=O)C5=C(C4=O)C=CC=C5OC)O)(C(=O)CO)O)N)O', organScores: { liver: 0.65, heart: 0.96, kidney: 0.58, brain: 0.22, lung: 0.35 }, tanimoto: 0.82, mcUncertainty: 0.03, useTissueConditioning: true }) }); const data = await response.json(); setReportText(data.advice || 'Report generated successfully.'); } catch (err: any) { setReportText(`Error generating report: ${err.message}`); } finally { setIsLoading(false); } }; return (
{/* Modal Header */}

Gemini Preclinical AI Safety Synthesis

Tissue-Conditioned Organ Toxicity Analysis & Wet-Lab Guidance

{/* Content Body */}
{!reportText && !isLoading && (

Click below to synthesize an automated preclinical toxicity evaluation for {initialData?.compoundName || 'Doxorubicin'} using Gemini 2.5 Flash.

)} {isLoading && (
Analyzing GTEx V8 transcriptomic profiles & SMILES toxicophore subgraphs...
)} {reportText && (
{reportText}
)}
{/* Modal Footer */}
Powered by Gemini 2.5 Flash & EpiADR-Net v2.1 {reportText && ( )}
); };