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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- templates/index.html -->
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>AI Playground - Access Multiple AI Models</title>
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 10 |
+
<style>
|
| 11 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 12 |
+
|
| 13 |
+
* {
|
| 14 |
+
font-family: 'Inter', sans-serif;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.model-card {
|
| 18 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.model-card:hover {
|
| 22 |
+
transform: translateY(-4px);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.chat-message {
|
| 26 |
+
animation: slideIn 0.3s ease-out;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
@keyframes slideIn {
|
| 30 |
+
from {
|
| 31 |
+
opacity: 0;
|
| 32 |
+
transform: translateY(10px);
|
| 33 |
+
}
|
| 34 |
+
to {
|
| 35 |
+
opacity: 1;
|
| 36 |
+
transform: translateY(0);
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.typing-indicator {
|
| 41 |
+
display: inline-flex;
|
| 42 |
+
gap: 4px;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.typing-indicator span {
|
| 46 |
+
width: 8px;
|
| 47 |
+
height: 8px;
|
| 48 |
+
border-radius: 50%;
|
| 49 |
+
background: #6366f1;
|
| 50 |
+
animation: typing 1.4s infinite;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.typing-indicator span:nth-child(2) {
|
| 54 |
+
animation-delay: 0.2s;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.typing-indicator span:nth-child(3) {
|
| 58 |
+
animation-delay: 0.4s;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
@keyframes typing {
|
| 62 |
+
0%, 60%, 100% {
|
| 63 |
+
transform: translateY(0);
|
| 64 |
+
}
|
| 65 |
+
30% {
|
| 66 |
+
transform: translateY(-10px);
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.gradient-bg {
|
| 71 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.glass-effect {
|
| 75 |
+
background: rgba(255, 255, 255, 0.95);
|
| 76 |
+
backdrop-filter: blur(10px);
|
| 77 |
+
}
|
| 78 |
+
</style>
|
| 79 |
+
</head>
|
| 80 |
+
<body class="bg-gray-50">
|
| 81 |
+
<!-- Header -->
|
| 82 |
+
<header class="gradient-bg text-white shadow-lg">
|
| 83 |
+
<div class="container mx-auto px-4 py-6">
|
| 84 |
+
<div class="flex items-center justify-between">
|
| 85 |
+
<div class="flex items-center space-x-3">
|
| 86 |
+
<i class="fas fa-robot text-3xl"></i>
|
| 87 |
+
<div>
|
| 88 |
+
<h1 class="text-2xl font-bold">AI Playground</h1>
|
| 89 |
+
<p class="text-sm opacity-90">Free platform to access multiple AI models</p>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder"
|
| 93 |
+
target="_blank"
|
| 94 |
+
class="bg-white/20 hover:bg-white/30 px-4 py-2 rounded-lg transition-all text-sm font-medium">
|
| 95 |
+
Built with anycoder
|
| 96 |
+
</a>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</header>
|
| 100 |
+
|
| 101 |
+
<!-- Main Content -->
|
| 102 |
+
<main class="container mx-auto px-4 py-8">
|
| 103 |
+
<!-- Model Selection -->
|
| 104 |
+
<section class="mb-8">
|
| 105 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4 flex items-center">
|
| 106 |
+
<i class="fas fa-layer-group mr-2 text-indigo-600"></i>
|
| 107 |
+
Choose an AI Model
|
| 108 |
+
</h2>
|
| 109 |
+
<div id="modelsGrid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
| 110 |
+
<!-- Models will be populated here -->
|
| 111 |
+
</div>
|
| 112 |
+
</section>
|
| 113 |
+
|
| 114 |
+
<!-- Chat Interface -->
|
| 115 |
+
<section class="glass-effect rounded-2xl shadow-xl p-6">
|
| 116 |
+
<div class="flex items-center justify-between mb-6">
|
| 117 |
+
<h3 class="text-lg font-semibold text-gray-800 flex items-center">
|
| 118 |
+
<i class="fas fa-comments mr-2 text-indigo-600"></i>
|
| 119 |
+
Chat Interface
|
| 120 |
+
</h3>
|
| 121 |
+
<div id="selectedModel" class="text-sm text-gray-600">
|
| 122 |
+
No model selected
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<!-- Chat Messages -->
|
| 127 |
+
<div id="chatContainer" class="bg-gray-50 rounded-xl p-4 h-96 overflow-y-auto mb-4">
|
| 128 |
+
<div class="text-center text-gray-400 mt-20">
|
| 129 |
+
<i class="fas fa-message text-6xl mb-4"></i>
|
| 130 |
+
<p>Select a model and start chatting!</p>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<!-- Input Area -->
|
| 135 |
+
<div class="flex gap-3">
|
| 136 |
+
<input
|
| 137 |
+
type="text"
|
| 138 |
+
id="messageInput"
|
| 139 |
+
placeholder="Type your message here..."
|
| 140 |
+
class="flex-1 px-4 py-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent"
|
| 141 |
+
disabled
|
| 142 |
+
>
|
| 143 |
+
<button
|
| 144 |
+
id="sendButton"
|
| 145 |
+
class="bg-indigo-600 text-white px-6 py-3 rounded-xl hover:bg-indigo-700 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
|
| 146 |
+
disabled
|
| 147 |
+
>
|
| 148 |
+
<i class="fas fa-paper-plane"></i>
|
| 149 |
+
Send
|
| 150 |
+
</button>
|
| 151 |
+
</div>
|
| 152 |
+
</section>
|
| 153 |
+
|
| 154 |
+
<!-- Features -->
|
| 155 |
+
<section class="mt-12 grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 156 |
+
<div class="text-center p-6 bg-white rounded-xl shadow-md hover:shadow-lg transition-shadow">
|
| 157 |
+
<div class="bg-blue-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 158 |
+
<i class="fas fa-bolt text-blue-600 text-2xl"></i>
|
| 159 |
+
</div>
|
| 160 |
+
<h4 class="font-semibold text-gray-800 mb-2">Lightning Fast</h4>
|
| 161 |
+
<p class="text-sm text-gray-600">Get instant responses from cutting-edge AI models</p>
|
| 162 |
+
</div>
|
| 163 |
+
<div class="text-center p-6 bg-white rounded-xl shadow-md hover:shadow-lg transition-shadow">
|
| 164 |
+
<div class="bg-green-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 165 |
+
<i class="fas fa-shield-alt text-green-600 text-2xl"></i>
|
| 166 |
+
</div>
|
| 167 |
+
<h4 class="font-semibold text-gray-800 mb-2">Secure & Private</h4>
|
| 168 |
+
<p class="text-sm text-gray-600">Your conversations are encrypted and secure</p>
|
| 169 |
+
</div>
|
| 170 |
+
<div class="text-center p-6 bg-white rounded-xl shadow-md hover:shadow-lg transition-shadow">
|
| 171 |
+
<div class="bg-purple-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 172 |
+
<i class="fas fa-infinity text-purple-600 text-2xl"></i>
|
| 173 |
+
</div>
|
| 174 |
+
<h4 class="font-semibold text-gray-800 mb-2">Unlimited Access</h4>
|
| 175 |
+
<p class="text-sm text-gray-600">Chat with multiple AI models without limits</p>
|
| 176 |
+
</div>
|
| 177 |
+
</section>
|
| 178 |
+
</main>
|
| 179 |
+
|
| 180 |
+
<!-- Footer -->
|
| 181 |
+
<footer class="bg-gray-800 text-white mt-16 py-8">
|
| 182 |
+
<div class="container mx-auto px-4 text-center">
|
| 183 |
+
<p class="text-sm opacity-75">© 2024 AI Playground. Powered by advanced AI models.</p>
|
| 184 |
+
</div>
|
| 185 |
+
</footer>
|
| 186 |
+
|
| 187 |
+
<script>
|
| 188 |
+
let selectedModel = null;
|
| 189 |
+
let chatHistory = [];
|
| 190 |
+
|
| 191 |
+
// Initialize models
|
| 192 |
+
const models = {{ models | tojson }};
|
| 193 |
+
|
| 194 |
+
// Color mapping
|
| 195 |
+
const colorClasses = {
|
| 196 |
+
blue: 'bg-blue-500',
|
| 197 |
+
indigo: 'bg-indigo-500',
|
| 198 |
+
purple: 'bg-purple-500',
|
| 199 |
+
green: 'bg-green-500',
|
| 200 |
+
orange: 'bg-orange-500',
|
| 201 |
+
red: 'bg-red-500',
|
| 202 |
+
yellow: 'bg-yellow-500',
|
| 203 |
+
pink: 'bg-pink-500'
|
| 204 |
+
};
|
| 205 |
+
|
| 206 |
+
// Render model cards
|
| 207 |
+
function renderModels() {
|
| 208 |
+
const grid = document.getElementById('modelsGrid');
|
| 209 |
+
grid.innerHTML = models.map(model => `
|
| 210 |
+
<div class="model-card bg-white rounded-xl shadow-md hover:shadow-xl cursor-pointer p-4 border-2 border-transparent hover:border-indigo-400"
|
| 211 |
+
onclick="selectModel('${model.id}')">
|
| 212 |
+
<div class="flex items-start justify-between mb-3">
|
| 213 |
+
<div class="${colorClasses[model.color]} w-10 h-10 rounded-lg flex items-center justify-center">
|
| 214 |
+
<i class="fas fa-brain text-white"></i>
|
| 215 |
+
</div>
|
| 216 |
+
<span class="text-xs text-gray-500 bg-gray-100 px-2 py-1 rounded-full">${model.provider}</span>
|
| 217 |
+
</div>
|
| 218 |
+
<h4 class="font-semibold text-gray-800 mb-1">${model.name}</h4>
|
| 219 |
+
<p class="text-xs text-gray-600">${model.description}</p>
|
| 220 |
+
</div>
|
| 221 |
+
`).join('');
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
// Select model
|
| 225 |
+
function selectModel(modelId) {
|
| 226 |
+
selectedModel = models.find(m => m.id === modelId);
|
| 227 |
+
document.getElementById('selectedModel').innerHTML = `
|
| 228 |
+
<i class="fas fa-robot mr-2"></i>
|
| 229 |
+
${selectedModel.name}
|
| 230 |
+
`;
|
| 231 |
+
|
| 232 |
+
// Enable chat
|
| 233 |
+
document.getElementById('messageInput').disabled = false;
|
| 234 |
+
document.getElementById('sendButton').disabled = false;
|
| 235 |
+
|
| 236 |
+
// Clear chat and show welcome message
|
| 237 |
+
chatHistory = [];
|
| 238 |
+
document.getElementById('chatContainer').innerHTML = `
|
| 239 |
+
<div class="chat-message">
|
| 240 |
+
<div class="flex items-start gap-3">
|
| 241 |
+
<div class="${colorClasses[selectedModel.color]} w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0">
|
| 242 |
+
<i class="fas fa-robot text-white text-sm"></i>
|
| 243 |
+
</div>
|
| 244 |
+
<div class="bg-white rounded-lg p-3 shadow-sm flex-1">
|
| 245 |
+
<p class="text-sm text-gray-800">Hello! I'm ${selectedModel.name}. How can I help you today?</p>
|
| 246 |
+
</div>
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
`;
|
| 250 |
+
|
| 251 |
+
// Highlight selected card
|
| 252 |
+
document.querySelectorAll('.model-card').forEach(card => {
|
| 253 |
+
card.classList.remove('border-indigo-400', 'bg-indigo-50');
|
| 254 |
+
});
|
| 255 |
+
event.currentTarget.classList.add('border-indigo-400', 'bg-indigo-50');
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
// Send message
|
| 259 |
+
async function sendMessage() {
|
| 260 |
+
const input = document.getElementById('messageInput');
|
| 261 |
+
const message = input.value.trim();
|
| 262 |
+
|
| 263 |
+
if (!message || !selectedModel) return;
|
| 264 |
+
|
| 265 |
+
// Add user message
|
| 266 |
+
addMessage(message, 'user');
|
| 267 |
+
input.value = '';
|
| 268 |
+
|
| 269 |
+
// Show typing indicator
|
| 270 |
+
showTypingIndicator();
|
| 271 |
+
|
| 272 |
+
// Simulate API call
|
| 273 |
+
setTimeout(async () => {
|
| 274 |
+
try {
|
| 275 |
+
const response = await fetch('/chat', {
|
| 276 |
+
method: 'POST',
|
| 277 |
+
headers: {
|
| 278 |
+
'Content-Type': 'application/json',
|
| 279 |
+
},
|
| 280 |
+
body: JSON.stringify({
|
| 281 |
+
model: selectedModel.id,
|
| 282 |
+
message: message
|
| 283 |
+
})
|
| 284 |
+
});
|
| 285 |
+
|
| 286 |
+
const data = await response.json();
|
| 287 |
+
removeTypingIndicator();
|
| 288 |
+
addMessage(data.message, 'assistant');
|
| 289 |
+
} catch (error) {
|
| 290 |
+
removeTypingIndicator();
|
| 291 |
+
addMessage('Sorry, something went wrong. Please try again.', 'assistant');
|
| 292 |
+
}
|
| 293 |
+
}, 1000);
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
// Add message to chat
|
| 297 |
+
function addMessage(message, sender) {
|
| 298 |
+
const container = document.getElementById('chatContainer');
|
| 299 |
+
const messageHtml = sender === 'user' ? `
|
| 300 |
+
<div class="chat-message mb-4">
|
| 301 |
+
<div class="flex items-start gap-3 justify-end">
|
| 302 |
+
<div class="bg-indigo-600 text-white rounded-lg p-3 shadow-sm max-w-xs lg:max-w-md">
|
| 303 |
+
<p class="text-sm">${message}</p>
|
| 304 |
+
</div>
|
| 305 |
+
<div class="bg-gray-300 w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0">
|
| 306 |
+
<i class="fas fa-user text-gray-600 text-sm"></i>
|
| 307 |
+
</div>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
` : `
|
| 311 |
+
<div class="chat-message mb-4">
|
| 312 |
+
<div class="flex items-start gap-3">
|
| 313 |
+
<div class="${colorClasses[selectedModel.color]} w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0">
|
| 314 |
+
<i class="fas fa-robot text-white text-sm"></i>
|
| 315 |
+
</div>
|
| 316 |
+
<div class="bg-white rounded-lg p-3 shadow-sm max-w-xs lg:max-w-md">
|
| 317 |
+
<p class="text-sm text-gray-800">${message}</p>
|
| 318 |
+
</div>
|
| 319 |
+
</div>
|
| 320 |
+
</div>
|
| 321 |
+
`;
|
| 322 |
+
|
| 323 |
+
container.insertAdjacentHTML('beforeend', messageHtml);
|
| 324 |
+
container.scrollTop = container.scrollHeight;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
// Typing indicator
|
| 328 |
+
function showTypingIndicator() {
|
| 329 |
+
const container = document.getElementById('chatContainer');
|
| 330 |
+
const indicator = `
|
| 331 |
+
<div id="typingIndicator" class="chat-message mb-4">
|
| 332 |
+
<div class="flex items-start gap-3">
|
| 333 |
+
<div class="${colorClasses[selectedModel.color]} w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0">
|
| 334 |
+
<i class="fas fa-robot text-white text-sm"></i>
|
| 335 |
+
</div>
|
| 336 |
+
<div class="bg-white rounded-lg p-3 shadow-sm">
|
| 337 |
+
<div class="typing-indicator">
|
| 338 |
+
<span></span>
|
| 339 |
+
<span></span>
|
| 340 |
+
<span></span>
|
| 341 |
+
</div>
|
| 342 |
+
</div>
|
| 343 |
+
</div>
|
| 344 |
+
</div>
|
| 345 |
+
`;
|
| 346 |
+
container.insertAdjacentHTML('beforeend', indicator);
|
| 347 |
+
container.scrollTop = container.scrollHeight;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
function removeTypingIndicator() {
|
| 351 |
+
const indicator = document.getElementById('typingIndicator');
|
| 352 |
+
if (indicator) indicator.remove();
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
// Event listeners
|
| 356 |
+
document.getElementById('sendButton').addEventListener('click', sendMessage);
|
| 357 |
+
document.getElementById('messageInput').addEventListener('keypress', (e) => {
|
| 358 |
+
if (e.key === 'Enter') sendMessage();
|
| 359 |
+
});
|
| 360 |
+
|
| 361 |
+
// Initialize
|
| 362 |
+
renderModels();
|
| 363 |
+
</script>
|
| 364 |
+
</body>
|
| 365 |
+
</html>
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# No additional dependencies required
|