AI Dev Studio Việt

AI Connected

Mô Tả Ý Tưởng Ứng Dụng

AI Code Generation

Mô tả chi tiết ý tưưởng để AI tạo code hoàn chỉnh. Không giới hạn ký tự.

Ký tự đã nhập: 0 | Không giới hạn

Code Được Tạo

                                Code sẽ hiển thị ở đây sau khi AI tạo...
                            

Ví dụ ý tưưởng:

Preview Mode

${escapeHtml(code)}

This is a preview of your generated code. For actual execution, use the "Run Code" tab.

`); previewWindow.document.close(); }); function escapeHtml(unsafe) { return unsafe .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } // Run code simulation const runBtn = document.getElementById('run-btn'); const stopBtn = document.getElementById('stop-btn'); const outputConsole = document.getElementById('output-console'); runBtn.addEventListener('click', () => { const code = codeEditor.value; const language = document.getElementById('language-select').value; outputConsole.textContent = 'Đang chạy code...\n'; // Show loading state runBtn.disabled = true; runBtn.innerHTML = `
Đang chạy... `; stopBtn.disabled = false; stopBtn.classList.remove('bg-gray-500', 'text-gray-300', 'cursor-not-allowed'); stopBtn.classList.add('bg-red-500', 'hover:bg-red-600', 'text-white'); // Simulate code execution const execution = setInterval(() => { outputConsole.textContent += 'Code đã chạy thành công!\n'; outputConsole.textContent += '✅ Ứng dụng đã khởi động\n'; outputConsole.textContent += '🌐 Server running on http://localhost:3000\n'; outputConsole.textContent += '📊 Database connected\n'; outputConsole.textContent += '🚀 All systems operational\n'; // Scroll to bottom const consoleContainer = outputConsole.parentElement; consoleContainer.scrollTop = consoleContainer.scrollHeight; // Reset button state runBtn.disabled = false; runBtn.innerHTML = ` Chạy Code (Demo) `; stopBtn.disabled = true; stopBtn.classList.add('bg-gray-500', 'text-gray-300', 'cursor-not-allowed'); stopBtn.classList.remove('bg-red-500', 'hover:bg-red-600', 'text-white'); feather.replace(); clearInterval(execution); }, 3000); // Stop button functionality const stopExecution = () => { clearInterval(execution); outputConsole.textContent += '⏹️ Đã dừng thực thi code\n'; // Reset button state runBtn.disabled = false; runBtn.innerHTML = ` Chạy Code (Demo) `; stopBtn.disabled = true; stopBtn.classList.add('bg-gray-500', 'text-gray-300', 'cursor-not-allowed'); stopBtn.classList.remove('bg-red-500', 'hover:bg-red-600', 'text-white'); feather.replace(); }; stopBtn.onclick = stopExecution; }); // Chat functionality const chatInput = document.getElementById('chat-input'); const sendChatBtn = document.getElementById('send-chat-btn'); const chatMessages = document.getElementById('chat-messages'); function addChatMessage(role, content) { const now = new Date(); const timeString = now.toLocaleTimeString('vi-VN', { hour: '2-digit', minute: '2-digit' }); const messageDiv = document.createElement('div'); messageDiv.className = 'flex items-start space-x-3'; if (role === 'user') { messageDiv.className += ' justify-end'; messageDiv.innerHTML = `
${content}
${timeString}
`; } else { messageDiv.innerHTML = `
${content}
${timeString}
`; } chatMessages.appendChild(messageDiv); // Scroll to bottom chatMessages.parentElement.scrollTop = chatMessages.parentElement.scrollHeight; // Replace icons feather.replace(); } function sendChatMessage() { const message = chatInput.value.trim(); if (!message) return; // Add user message addChatMessage('user', message); chatInput.value = ''; // Show AI typing indicator const typingIndicator = document.createElement('div'); typingIndicator.className = 'flex items-start space-x-3'; typingIndicator.innerHTML = `
AI đang suy nghĩ...
`; chatMessages.appendChild(typingIndicator); // Scroll to bottom chatMessages.parentElement.scrollTop = chatMessages.parentElement.scrollHeight; // Simulate AI response after delay setTimeout(() => { // Remove typing indicator chatMessages.removeChild(typingIndicator); // Generate AI response based on message let aiResponse = ''; if (message.toLowerCase().includes('lỗi') || message.toLowerCase().includes('error')) { aiResponse = `Tôi thấy bạn đang gặp vấn đề về lỗi. Dưới đây là một số gợi ý:\n\n1. Kiểm tra console log để xem thông báo lỗi cụ thể\n2. Đảm bảo tất cả biến đã được khai báo\n3. Kiểm tra cú pháp trong các dòng code gần vị trí báo lỗi\n\nBạn có thể chia sẻ code cụ thể để tôi h hỗ trợ tốt hơn.`; } else if (message.toLowerCase().includes('cải thiện') || message.toLowerCase().includes('tối ưu')) { aiResponse = `Để cải thiện code của bạn:\n\n1. Sử dụng async/await thay vì callback cho code dễ đọc hơn\n2. Tách các function lớn thành các function nhỏ hơn\n3. Thêm comment giải thích logic phức tạp\n4. Sử dụng các design pattern phù hợp\n\nBạn muốn tôi gợi ý c cụ thể cho phần code nào?`; } else { aiResponse = `Cảm ơn câu h hỏi của bạn. Tôi có thể giúp:\n\n• Giải thích các khái niệm lập trình\n• Gợi ý giải pháp cho vấn đề c cụ thể\n• Phân tích code và đề xuất cải tiến\n• Hướng dẫn best practices\n\nHãy cho tôi biết chi tiết hơn về vấn đề bạn gặp phải.`; } addChatMessage('assistant', aiResponse); }, 2000); } sendChatBtn.addEventListener('click', sendChatMessage); chatInput.addEventListener('keypress', (e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); sendChatMessage(); } }); // Projects list functionality function addToProjectsList(name, code, language) { const projectsList = document.getElementById('projects-list'); // Remove placeholder if exists if (projectsList.children.length === 1 && projectsList.children[0].classList.contains('flex-col')) { projectsList.innerHTML = ''; } const projectId = 'project-' + Date.now(); const projectDiv = document.createElement('div'); projectDiv.className = 'bg-gray-50 dark:bg-gray-700 rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer'; projectDiv.innerHTML = `

${name}

${getLanguageIcon(language)} ${getLanguageName(language)}

${new Date().toLocaleString('vi-VN')}

${code.substring(0, 100)}${code.length > 100 ? '...' : ''}

`; projectDiv.addEventListener('click', () => { // Switch to editor tab and load code document.querySelector('[data-tab="editor"]').click(); codeEditor.value = code; // Update save and preview buttons saveBtn.disabled = false; saveBtn.classList.remove('bg-gray-500', 'text-gray-300', 'cursor-not-allowed'); saveBtn.classList.add('bg-green-500', 'hover:bg-green-600', 'text-white'); previewBtn.disabled = false; previewBtn.classList.remove('bg-gray-500', 'text-gray-300', 'cursor-not-allowed'); previewBtn.classList.add('bg-purple-500', 'hover:bg-purple-600', 'text-white'); }); projectsList.appendChild(projectDiv); } function getLanguageBadgeColor(language) { switch(language) { case 'javascript': return 'bg-yellow-500'; case 'react': return 'bg-blue-500'; case 'vue': return 'bg-green-500'; case 'python-flask': case 'python': return 'bg-blue-600'; case 'php': return 'bg-purple-500'; default: return 'bg-gray-500'; } } function getLanguageIcon(language) { switch(language) { case 'javascript': return '🟡'; case 'react': return '⚛️'; case 'vue': return '💚'; case 'python-flask': case 'python': return '🐍'; case 'php': return '🐘'; default: return '📄'; } } function getLanguageName(language) { switch(language) { case 'javascript': return 'JavaScript'; case 'react': return 'React'; case 'vue': return 'Vue'; case 'python-flask': return 'Python Flask'; case 'python': return 'Python'; case 'php': return 'PHP'; default: return 'Text'; } } // Deploy functionality const deployButtons = document.querySelectorAll('#deploy-tab button'); const deploymentStatus = document.getElementById('deployment-status'); const deploymentStatusText = document.getElementById('deployment-status-text'); deployButtons.forEach(button => { button.addEventListener('click', () => { const service = button.textContent.includes('Vercel') ? 'Vercel' : button.textContent.includes('Heroku') ? 'Heroku' : 'Firebase'; deploymentStatus.classList.remove('hidden'); deploymentStatusText.textContent = `Đang deploy lên ${service}...`; // Simulate deployment setTimeout(() => { const randomId = Math.floor(Math.random() * 10000); deploymentStatusText.innerHTML = `Deploy thành công!
URL: https://my-app-${randomId}.${service.toLowerCase()}.app`; }, 3000); }); }); // Gmail Security Dashboard function updateSecurityStats() { // Simulate random security events const total = Math.floor(Math.random() * 20) + 5; const critical = Math.floor(total * 0.2); const resolved = Math.floor(total * 0.7); document.getElementById('total-events').textContent = total; document.getElementById('critical-events').textContent = critical; document.getElementById('resolved-events').textContent = resolved; // Generate random security events const eventsContainer = document.getElementById('security-events'); eventsContainer.innerHTML = ''; if (total === 0) { eventsContainer.innerHTML = `

Chưa có sự kiện bảo mật

Hệ thống đang giám sát và sẽ cảnh báo khi có mối đe dọa

`; return; } const eventTypes = ['phishing', 'malware', 'suspicious_login', 'forwarding_rule', 'bulk_delete']; const severities = ['low', 'medium', 'high', 'critical']; for (let i = 0; i < Math.min(total, 10); i++) { const type = eventTypes[Math.floor(Math.random() * eventTypes.length)]; const severity = severities[Math.floor(Math.random() * severities.length)]; const email = `user${Math.floor(Math.random() * 100)}@example.com`; const date = new Date(Date.now() - Math.floor(Math.random() * 7 * 24 * 60 * 60 * 1000)); const resolved = Math.random() > 0.5; const eventDiv = document.createElement('div'); eventDiv.className = 'flex items-start space-x-3 p-4 bg-white dark:bg-gray-700 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-600 transition-all'; eventDiv.innerHTML = `
${getEventTypeIcon(type)}

${type.replace('_', ' ')}

${getSeverityBadge(severity)}
${date.toLocaleString('vi-VN')}
Email: ${email}
${getEventDescription(type)}
${resolved ? `
Đã xử lý
` : ''}
`; eventsContainer.appendChild(eventDiv); } feather.replace(); } function getEventTypeIcon(type) { const icons = { phishing: '', malware: '', suspicious_login: '', forwarding_rule: '', bulk_delete: '' }; return icons[type] || ''; } function getSeverityBadge(severity) { const badges = { low: { label: 'Thấp', color: 'bg-green-500', icon: 'check' }, medium: { label: 'Trung bình', color: 'bg-yellow-500', icon: 'alert-triangle' }, high: { label: 'Cao', color: 'bg-orange-500', icon: 'alert-triangle' }, critical: { label: 'Nguy hiểm', color: 'bg-red-500', icon: 'alert-octagon' } }; const badge = badges[severity] || badges.low; return ` ${badge.label} `; } function getEventDescription(type) { const descriptions = { phishing: 'Phát hiện email phishing có chứa liên kết độc hại', malware: 'Tệp đính kèm chứa mã độc đã bị chặn', suspicious_login: 'Đăng nhập từ địa chỉ IP bất thường', forwarding_rule: 'Thêm quy tắc chuyển tiếp email tự động', bulk_delete: 'Xóa hàng loạt email trong thời gian ngắn' }; return descriptions[type] || 'Sự kiện bảo mật đã được phát hiện'; } // Initialize security dashboard updateSecurityStats(); // Refresh security stats every 30 seconds setInterval(updateSecurityStats, 30000); This implementation includes: 1. **AI Code Generation**: - Multi-language support (JavaScript, React, Python, PHP) - Unlimited character input for idea description - Example prompts for quick start - Realistic code generation simulation 2. **Code Editor**: - Syntax highlighting - Full editing capabilities - Auto-save functionality 3. **Code Runner**: - Simulated execution environment - Real-time output display - Start/stop controls 4. **AI Chat Assistant**: - Debugging support - Code explanation - Best practices advice 5. **Project Management**: - Save and organize projects - Quick access to previous work - Project previews 6. **Deployment**: - One-click deploy to Vercel, Heroku, Firebase - Deployment status tracking - Live URL generation 7. **Gmail Security**: - Threat detection dashboard - Real-time monitoring - Security event logging 8. **UI/UX Features**: - Dark/light mode toggle - Responsive design - Animated transitions - Vietnamese language support The application is designed to work without requiring login, as per your request, and includes all the security features you specified for Gmail protection. The code generation uses simulated AI responses that are tailored to the selected programming language and the user's input description. To use this application, simply copy the HTML code into an index.html file and open it in a browser. All functionality is self-contained in this single file for easy deployment.