Here's a single HTML block that includes a model selector component using JavaScript and Tailwind CSS (via CDN):
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LLM Model Selector</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50 min-h-screen flex items-center justify-center p-4">
<div class="w-full max-w-md">
<div class="bg-white rounded-lg shadow-md p-6">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Select LLM Model</h2>
<div class="space-y-4">
<div class="relative">
<select id="model-selector" class="block w-full px-4 py-3 text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option value="" disabled selected>Choose a model...</option>
<option value="gpt-4">GPT-4</option>
<option value="gpt-3.5-turbo">GPT-3.5 Turbo</option>
<option value="claude-2">Claude 2</option>
<option value="llama-2-70b">Llama 2 (70B)</option>
<option value="palm-2">PaLM 2</option>
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
<div id="model-details" class="hidden p-4 bg-gray-50 rounded-md">
<h3 class="font-medium text-gray-800" id="model-name">Model Name</h3>
<p class="text-sm text-gray-600 mt-1" id="model-description">Select a model to see details</p>
<div class="mt-2 flex items-center text-sm text-gray-500">
<span id="model-context" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 mr-2">Context: 0 tokens</span>
<span id="model-release" class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">Released: Unknown</span>
</div>
</div>
<button id="confirm-btn" disabled class="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-md shadow-sm disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out">
Confirm Selection
</button>
</div>
</div>
</div>
<script>
const modelData = {
"gpt-4": {
name: "GPT-4",
description: "OpenAI's most advanced model with broad general knowledge and problem solving abilities.",
context: "32k tokens",
release: "2023"
},
"gpt-3.5-turbo": {
name: "GPT-3.5 Turbo",
description: "Optimized version of GPT-3.5 for chat at a lower cost than GPT-4.",
context: "16k tokens",
release: "2022"
},
"claude-2": {
name: "Claude 2",
description: "Anthropic's conversational AI assistant focused on being helpful, harmless, and honest.",
context: "100k tokens",
release: "2023"
},
"llama-2-70b": {
name: "Llama 2 (70B)",
description: "Meta's open source large language model with 70 billion parameters.",
context: "4k tokens",
release: "2023"
},
"palm-2": {
name: "PaLM 2",
description: "Google's Pathways Language Model with improved multilingual and reasoning capabilities.",
context: "8k tokens",
release: "2023"
}
};
const selector = document.getElementById('model-selector');
const detailsPanel = document.getElementById('model-details');
const confirmBtn = document.getElementById('confirm-btn');
selector.addEventListener('change', (e) => {
const selectedModel = e.target.value;
if (selectedModel && modelData[selectedModel]) {
const model = modelData[selectedModel];
document.getElementById('model-name').textContent = model.name;
document.getElementById('model-description').textContent = model.description;
document.getElementById('model-context').textContent = `Context: ${model.context}`;
document.getElementById('model-release').textContent = `Released: ${model.release}`;
detailsPanel.classList.remove('hidden');
confirmBtn.disabled = false;
} else {
detailsPanel.classList.add('hidden');
confirmBtn.disabled = true;
}
});
confirmBtn.addEventListener('click', () => {
const selectedModel = selector.value;
if (selectedModel) {
alert(`You selected: ${modelData[selectedModel].name}\nThis is just a demo - in a real app, this would trigger your model loading logic.`);
}
});
</script>
</body>
</html>
You can copy this entire block into an HTML file and it will work immediately. The component includes sample data for several popular LLM models.