Download aichat.html from daltiboi/undefined: direct link, hf CLI and curl.
- Browser
- Download file 10.7 kB
-
https://huggingface.co/spaces/daltiboi/undefined/resolve/main/aichat.html
- Command line
-
hf download hf://spaces/daltiboi/undefined/aichat.html
-
curl -L -o aichat.html https://huggingface.co/spaces/daltiboi/undefined/resolve/main/aichat.html
10.7 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>BlockCraft Studio | AI Chat</title> | |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <style> | |
| .chat-container { | |
| scrollbar-width: thin; | |
| scrollbar-color: #334155 #1e293b; | |
| } | |
| .chat-container::-webkit-scrollbar { | |
| width: 8px; | |
| } | |
| .chat-container::-webkit-scrollbar-track { | |
| background: #1e293b; | |
| } | |
| .chat-container::-webkit-scrollbar-thumb { | |
| background-color: #334155; | |
| border-radius: 6px; | |
| } | |
| .ai-message { | |
| background: rgba(30, 41, 59, 0.8); | |
| border-left: 3px solid #3b82f6; | |
| } | |
| .user-message { | |
| background: rgba(30, 64, 59, 0.8); | |
| border-left: 3px solid #10b981; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-slate-900 text-gray-100 min-h-screen flex flex-col"> | |
| <!-- Navbar --> | |
| <nav class="bg-slate-800/80 border-b border-slate-700"> | |
| <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> | |
| <div class="flex items-center justify-between h-16"> | |
| <div class="flex items-center"> | |
| <div class="flex-shrink-0"> | |
| <div class="flex items-center"> | |
| <i data-feather="box" class="text-blue-400 mr-2"></i> | |
| <span class="text-xl font-bold bg-gradient-to-r from-blue-400 to-emerald-400 bg-clip-text text-transparent">BlockCraft Studio AI</span> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="flex items-center"> | |
| <a href="editor.html" class="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium flex items-center"> | |
| <i data-feather="arrow-left" class="mr-1 w-4 h-4"></i> | |
| Back to Editor | |
| </a> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <!-- Chat Container --> | |
| <div class="flex-1 overflow-hidden flex flex-col max-w-4xl mx-auto w-full p-4"> | |
| <!-- Chat Messages --> | |
| <div class="flex-1 overflow-y-auto chat-container space-y-4 mb-4"> | |
| <!-- AI Welcome Message --> | |
| <div class="ai-message rounded-lg p-4"> | |
| <div class="flex items-start space-x-3"> | |
| <div class="bg-blue-500/20 p-2 rounded-full"> | |
| <i data-feather="cpu" class="text-blue-400 w-5 h-5"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-bold text-white">BlockCraft AI</h4> | |
| <p class="text-gray-300 mt-1">Hi! I'm your Minecraft creation assistant. Tell me what you'd like to build and I'll help bring it to life! For example, you could say: "Create a medieval castle with a working drawbridge" or "Make a robot that shoots fireworks".</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Input Area --> | |
| <div class="bg-slate-800/80 border border-slate-700 rounded-lg p-4"> | |
| <form id="chatForm" class="flex space-x-2"> | |
| <input type="text" id="userMessage" placeholder="Describe what you want to build..." | |
| class="flex-1 bg-slate-700 border border-slate-600 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <button type="submit" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg flex items-center"> | |
| <i data-feather="send" class="w-4 h-4 mr-1"></i> | |
| Send | |
| </button> | |
| </form> | |
| <div class="flex justify-between mt-2"> | |
| <div class="text-xs text-gray-400"> | |
| Pro tip: Be as detailed as possible for best results | |
| </div> | |
| <button id="exampleBtn" class="text-xs text-blue-400 hover:text-blue-300"> | |
| <i data-feather="lightbulb" class="w-3 h-3 inline mr-1"></i> | |
| Show Examples | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Initialize Feather Icons | |
| feather.replace(); | |
| // Handle chat submission | |
| document.getElementById('chatForm').addEventListener('submit', async function(e) { | |
| e.preventDefault(); | |
| const input = document.getElementById('userMessage'); | |
| const message = input.value.trim(); | |
| if (!message) return; | |
| // Add user message to chat | |
| addMessage('user', message); | |
| input.value = ''; | |
| // Show AI typing indicator | |
| const chatContainer = document.querySelector('.chat-container'); | |
| const typingIndicator = document.createElement('div'); | |
| typingIndicator.className = 'ai-message rounded-lg p-4'; | |
| typingIndicator.innerHTML = ` | |
| <div class="flex items-start space-x-3"> | |
| <div class="bg-blue-500/20 p-2 rounded-full"> | |
| <i data-feather="cpu" class="text-blue-400 w-5 h-5"></i> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="typing-dots flex space-x-1"> | |
| <div class="w-2 h-2 bg-blue-400 rounded-full animate-bounce"></div> | |
| <div class="w-2 h-2 bg-blue-400 rounded-full animate-bounce" style="animation-delay: 0.2s"></div> | |
| <div class="w-2 h-2 bg-blue-400 rounded-full animate-bounce" style="animation-delay: 0.4s"></div> | |
| </div> | |
| </div> | |
| </div> | |
| `; | |
| chatContainer.appendChild(typingIndicator); | |
| chatContainer.scrollTop = chatContainer.scrollHeight; | |
| try { | |
| // Simulate API call delay | |
| await new Promise(resolve => setTimeout(resolve, 1500)); | |
| // Remove typing indicator | |
| typingIndicator.remove(); | |
| // Generate AI response (in a real app, this would call your NLP backend) | |
| const response = generateAIResponse(message); | |
| // Add AI response to chat | |
| addMessage('ai', response); | |
| } catch (error) { | |
| typingIndicator.remove(); | |
| addMessage('ai', "Sorry, I encountered an error. Please try again later."); | |
| console.error('AI request failed:', error); | |
| } | |
| }); | |
| // Add message to chat | |
| function addMessage(sender, content) { | |
| const chatContainer = document.querySelector('.chat-container'); | |
| const messageDiv = document.createElement('div'); | |
| messageDiv.className = sender === 'ai' ? 'ai-message rounded-lg p-4' : 'user-message rounded-lg p-4'; | |
| messageDiv.innerHTML = ` | |
| <div class="flex items-start space-x-3"> | |
| <div class="${sender === 'ai' ? 'bg-blue-500/20' : 'bg-emerald-500/20'} p-2 rounded-full"> | |
| <i data-feather="${sender === 'ai' ? 'cpu' : 'user'}" class="${sender === 'ai' ? 'text-blue-400' : 'text-emerald-400'} w-5 h-5"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-bold text-white">${sender === 'ai' ? 'BlockCraft AI' : 'You'}</h4> | |
| <p class="text-gray-300 mt-1">${content}</p> | |
| ${sender === 'ai' ? '<button class="mt-2 bg-blue-500 hover:bg-blue-600 text-white px-3 py-1 rounded text-xs flex items-center"><i data-feather="play" class="w-3 h-3 mr-1"></i> Apply to Editor</button>' : ''} | |
| </div> | |
| </div> | |
| `; | |
| chatContainer.appendChild(messageDiv); | |
| chatContainer.scrollTop = chatContainer.scrollHeight; | |
| feather.replace(); | |
| } | |
| // Generate mock AI response | |
| function generateAIResponse(prompt) { | |
| const responses = { | |
| 'castle': "I'll create a medieval castle with stone walls, towers, and a working drawbridge. Would you like me to add any specific details like banners or a moat?", | |
| 'robot': "Great choice! I'll generate a steampunk-style robot with glowing eyes and piston-powered limbs. Should it have any special abilities like shooting fireworks?", | |
| 'house': "I can build a modern house with large windows and a flat roof. Would you prefer a pool, garden, or any other features?", | |
| 'vehicle': "I'll design a customizable vehicle. Should it be a car, boat, or airplane? For Minecraft, I can make it move using redstone or command blocks.", | |
| 'default': "Thanks for your request! I'll generate a 3D model based on your description: \"" + prompt + "\". You'll be able to adjust the size, colors, and details in the editor." | |
| }; | |
| const lowerPrompt = prompt.toLowerCase(); | |
| if (lowerPrompt.includes('castle')) return responses.castle; | |
| if (lowerPrompt.includes('robot')) return responses.robot; | |
| if (lowerPrompt.includes('house') || lowerPrompt.includes('home')) return responses.house; | |
| if (lowerPrompt.includes('car') || lowerPrompt.includes('vehicle') || lowerPrompt.includes('boat') || lowerPrompt.includes('plane')) return responses.vehicle; | |
| return responses.default; | |
| } | |
| // Example button handler | |
| document.getElementById('exampleBtn').addEventListener('click', function() { | |
| const examples = [ | |
| "Create a steampunk airship with rotating propellers", | |
| "Build a wizard tower that shoots magical particles", | |
| "Design a modern mansion with a swimming pool", | |
| "Make a mech robot that can transform into a vehicle", | |
| "Generate a fantasy castle with floating islands" | |
| ]; | |
| const randomExample = examples[Math.floor(Math.random() * examples.length)]; | |
| document.getElementById('userMessage').value = randomExample; | |
| document.getElementById('userMessage').focus(); | |
| }); | |
| </script> | |
| </body> | |
| </html> |