import { useState } from 'react';
import { ChevronDown, ChevronRight, Loader2, User, Sparkles } from 'lucide-react';
export default function NeonModelSelector({ models, selected, onSelectionChange, loading }) {
const [expandedModel, setExpandedModel] = useState(null);
const isModelSelected = (modelId, personaName) =>
selected.some(s => s.model_id === modelId && s.persona_name === personaName);
const togglePersona = (model, persona) => {
const key = { model_id: model.model_id, persona_name: persona.persona_name, system_prompt: persona.system_prompt || '' };
if (isModelSelected(model.model_id, persona.persona_name)) {
onSelectionChange(selected.filter(s => !(s.model_id === model.model_id && s.persona_name === persona.persona_name)));
} else {
onSelectionChange([...selected, key]);
}
};
const shortName = (name) => name.split('/').pop();
if (loading) {
return (
Neon.ai Models
Loading models...
);
}
return (
Neon.ai Models
Select model + persona for comparison
{[...models].sort((a, b) => shortName(a.name).localeCompare(shortName(b.name))).map(model => {
const isExpanded = expandedModel === model.model_id;
const activePersonas = model.personas.filter(p => p.enabled !== false);
const selectedCount = selected.filter(s => s.model_id === model.model_id).length;
return (
{isExpanded && (
{activePersonas.map(persona => {
const checked = isModelSelected(model.model_id, persona.persona_name);
return (
);
})}
)}
);
})}
);
}