{ box-sizing: border-box; margin: 0; padding: 0; } body { font-family: Arial, sans-serif; background-color: #f0f0f0; display: flex; justify-content: center; align-items: center; height: 100vh; width: 100%; overflow: hidden; } .container { width: 100%; max-width: 600px; } .chat { background-color: #fff; border-radius: 5px; box-shadow: 0 1px 10px rgba(0, 0, 0, 0.2); overflow: hidden; } .messages { height: 400px; overflow-y: scroll; padding: 15px; } .input-area { display: flex; padding: 15px; } .input-area input { flex-grow: 1; border: none; border-radius: 5px; padding: 10px; font-size: 14px; } .input-area button { background-color: #007bff; border: none; border-radius: 5px; color: #fff; font-size: 14px; padding: 10px; margin-left: 10px; } .message { margin-bottom: 10px; } .user, .ai { display: flex; align-items: flex-start; } .user .name, .ai .name { font-weight: bold; margin-right: 5px; } .user .text, .ai .text { background-color: #f1f1f1; border-radius: 5px; padding: 8px; } .user { justify-content: flex-end; } .user .name { order: 2; } .user .text { background-color: #007bff; color: #fff; order: 1; } $(document).ready(function () { const apiKey = 'YOUR_OPENAI_API_KEY'; const sendMessage = async (message) => { const response = await fetch('https://api.openai.com/v1/engines/davinci-codex/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}`, }, body: JSON.stringify