Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>DuckDuckGo AI Chatbot</title> | |
| <link | |
| href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" | |
| rel="stylesheet"> | |
| <style> | |
| :root { | |
| --bg-primary: #0a0a0f; | |
| --bg-secondary: #12121a; | |
| --bg-tertiary: #1a1a25; | |
| --bg-hover: #222230; | |
| --accent-primary: #de5833; | |
| --accent-secondary: #ff6b35; | |
| --accent-glow: rgba(222, 88, 51, 0.3); | |
| --text-primary: #f0f0f5; | |
| --text-secondary: #a0a0b0; | |
| --text-muted: #606070; | |
| --border-color: #2a2a3a; | |
| --success: #00d68f; | |
| --error: #ff4757; | |
| --warning: #ffa502; | |
| } | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; | |
| background: var(--bg-primary); | |
| color: var(--text-primary); | |
| min-height: 100vh; | |
| overflow-x: hidden; | |
| } | |
| /* Animated Background */ | |
| .bg-animation { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| z-index: 0; | |
| overflow: hidden; | |
| } | |
| .bg-animation::before { | |
| content: ''; | |
| position: absolute; | |
| top: -50%; | |
| left: -50%; | |
| width: 200%; | |
| height: 200%; | |
| background: | |
| radial-gradient(ellipse at 20% 20%, rgba(222, 88, 51, 0.08) 0%, transparent 50%), | |
| radial-gradient(ellipse at 80% 80%, rgba(255, 107, 53, 0.05) 0%, transparent 50%); | |
| animation: bgPulse 15s ease-in-out infinite; | |
| } | |
| @keyframes bgPulse { | |
| 0%, | |
| 100% { | |
| transform: translate(0, 0) rotate(0deg); | |
| } | |
| 50% { | |
| transform: translate(-5%, -5%) rotate(2deg); | |
| } | |
| } | |
| /* Floating Orbs */ | |
| .orb { | |
| position: absolute; | |
| border-radius: 50%; | |
| filter: blur(60px); | |
| opacity: 0.4; | |
| animation: float 20s ease-in-out infinite; | |
| } | |
| .orb-1 { | |
| width: 300px; | |
| height: 300px; | |
| background: var(--accent-primary); | |
| top: 10%; | |
| left: 10%; | |
| animation-delay: 0s; | |
| } | |
| .orb-2 { | |
| width: 200px; | |
| height: 200px; | |
| background: #ff6b35; | |
| bottom: 20%; | |
| right: 15%; | |
| animation-delay: -5s; | |
| } | |
| .orb-3 { | |
| width: 150px; | |
| height: 150px; | |
| background: #ff8c5a; | |
| top: 60%; | |
| left: 60%; | |
| animation-delay: -10s; | |
| } | |
| @keyframes float { | |
| 0%, | |
| 100% { | |
| transform: translate(0, 0) scale(1); | |
| } | |
| 25% { | |
| transform: translate(30px, -30px) scale(1.05); | |
| } | |
| 50% { | |
| transform: translate(-20px, 20px) scale(0.95); | |
| } | |
| 75% { | |
| transform: translate(20px, 30px) scale(1.02); | |
| } | |
| } | |
| /* Main Container */ | |
| .container { | |
| position: relative; | |
| z-index: 1; | |
| max-width: 900px; | |
| margin: 0 auto; | |
| padding: 20px; | |
| min-height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| /* Header */ | |
| header { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| padding: 20px 0; | |
| border-bottom: 1px solid var(--border-color); | |
| margin-bottom: 20px; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| gap: 12px; | |
| } | |
| .logo-icon { | |
| width: 40px; | |
| height: 40px; | |
| background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); | |
| border-radius: 12px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 20px; | |
| box-shadow: 0 4px 20px var(--accent-glow); | |
| } | |
| .logo-text { | |
| font-size: 1.4rem; | |
| font-weight: 700; | |
| background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary)); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| background-clip: text; | |
| } | |
| .logo-sub { | |
| font-size: 0.7rem; | |
| color: var(--text-muted); | |
| letter-spacing: 1px; | |
| text-transform: uppercase; | |
| } | |
| .header-actions { | |
| display: flex; | |
| gap: 10px; | |
| align-items: center; | |
| } | |
| .btn-icon { | |
| width: 40px; | |
| height: 40px; | |
| border-radius: 10px; | |
| border: 1px solid var(--border-color); | |
| background: var(--bg-secondary); | |
| color: var(--text-secondary); | |
| cursor: pointer; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| transition: all 0.3s ease; | |
| font-size: 16px; | |
| } | |
| .btn-icon:hover { | |
| background: var(--bg-hover); | |
| border-color: var(--accent-primary); | |
| color: var(--accent-primary); | |
| transform: translateY(-2px); | |
| } | |
| /* Built with link */ | |
| .built-with { | |
| font-size: 0.75rem; | |
| color: var(--text-muted); | |
| text-decoration: none; | |
| transition: color 0.3s ease; | |
| margin-right: 10px; | |
| } | |
| .built-with:hover { | |
| color: var(--accent-primary); | |
| } | |
| /* Chat Container */ | |
| .chat-container { | |
| flex: 1; | |
| display: flex; | |
| flex-direction: column; | |
| background: var(--bg-secondary); | |
| border-radius: 24px; | |
| border: 1px solid var(--border-color); | |
| overflow: hidden; | |
| box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); | |
| } | |
| /* Chat Header */ | |
| .chat-header { | |
| padding: 20px 24px; | |
| border-bottom: 1px solid var(--border-color); | |
| display: flex; | |
| align-items: center; | |
| gap: 12px; | |
| background: var(--bg-tertiary); | |
| } | |
| .status-indicator { | |
| width: 10px; | |
| height: 10px; | |
| background: var(--success); | |
| border-radius: 50%; | |
| animation: pulse 2s ease-in-out infinite; | |
| box-shadow: 0 0 10px var(--success); | |
| } | |
| @keyframes pulse { | |
| 0%, | |
| 100% { | |
| opacity: 1; | |
| transform: scale(1); | |
| } | |
| 50% { | |
| opacity: 0.7; | |
| transform: scale(1.2); | |
| } | |
| } | |
| .chat-title { | |
| font-weight: 600; | |
| font-size: 1rem; | |
| } | |
| .chat-subtitle { | |
| font-size: 0.8rem; | |
| color: var(--text-secondary); | |
| margin-left: auto; | |
| } | |
| /* Messages Area */ | |
| .messages { | |
| flex: 1; | |
| overflow-y: auto; | |
| padding: 24px; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 20px; | |
| scroll-behavior: smooth; | |
| } | |
| .messages::-webkit-scrollbar { | |
| width: 6px; | |
| } | |
| .messages::-webkit-scrollbar-track { | |
| background: transparent; | |
| } | |
| .messages::-webkit-scrollbar-thumb { | |
| background: var(--border-color); | |
| border-radius: 3px; | |
| } | |
| /* Message Styles */ | |
| .message { | |
| display: flex; | |
| gap: 12px; | |
| animation: messageIn 0.4s ease-out; | |
| } | |
| @keyframes messageIn { | |
| from { | |
| opacity: 0; | |
| transform: translateY(10px); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateY(0); | |
| } | |
| } | |
| .message.user { | |
| flex-direction: row-reverse; | |
| } | |
| .message-avatar { | |
| width: 36px; | |
| height: 36px; | |
| border-radius: 12px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 16px; | |
| flex-shrink: 0; | |
| } | |
| .message.user .message-avatar { | |
| background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); | |
| box-shadow: 0 4px 15px var(--accent-glow); | |
| } | |
| .message.bot .message-avatar { | |
| background: var(--bg-tertiary); | |
| border: 1px solid var(--border-color); | |
| } | |
| .message-content { | |
| max-width: 70%; | |
| padding: 14px 18px; | |
| border-radius: 18px; | |
| line-height: 1.6; | |
| font-size: 0.95rem; | |
| } | |
| .message.user .message-content { | |
| background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); | |
| color: white; | |
| border-bottom-right-radius: 4px; | |
| box-shadow: 0 4px 20px var(--accent-glow); | |
| } | |
| .message.bot .message-content { | |
| background: var(--bg-tertiary); | |
| border: 1px solid var(--border-color); | |
| border-bottom-left-radius: 4px; | |
| } | |
| .message-content p { | |
| margin-bottom: 10px; | |
| } | |
| .message-content p:last-child { | |
| margin-bottom: 0; | |
| } | |
| .message-content a { | |
| color: var(--accent-secondary); | |
| text-decoration: underline; | |
| } | |
| .message-content code { | |
| font-family: 'JetBrains Mono', monospace; | |
| background: var(--bg-primary); | |
| padding: 2px 6px; | |
| border-radius: 4px; | |
| font-size: 0.85rem; | |
| } | |
| .message-content pre { | |
| background: var(--bg-primary); | |
| padding: 12px; | |
| border-radius: 8px; | |
| overflow-x: auto; | |
| margin: 10px 0; | |
| } | |
| .message-content pre code { | |
| background: none; | |
| padding: 0; | |
| } | |
| .message-content ul, | |
| .message-content ol { | |
| margin-left: 20px; | |
| margin-bottom: 10px; | |
| } | |
| /* Source Attribution */ | |
| .source-info { | |
| display: flex; | |
| align-items: center; | |
| gap: 6px; | |
| margin-top: 12px; | |
| padding-top: 12px; | |
| border-top: 1px solid var(--border-color); | |
| font-size: 0.75rem; | |
| color: var(--text-muted); | |
| } | |
| .source-info svg { | |
| width: 12px; | |
| height: 12px; | |
| } | |
| /* Related Topics */ | |
| .related-topics { | |
| margin-top: 12px; | |
| padding-top: 12px; | |
| border-top: 1px solid var(--border-color); | |
| } | |
| .related-topics-title { | |
| font-size: 0.75rem; | |
| color: var(--text-muted); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| margin-bottom: 8px; | |
| } | |
| .topic-tags { | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: 6px; | |
| } | |
| .topic-tag { | |
| font-size: 0.8rem; | |
| padding: 4px 10px; | |
| background: var(--bg-primary); | |
| border: 1px solid var(--border-color); | |
| border-radius: 20px; | |
| cursor: pointer; | |
| transition: all 0.2s ease; | |
| } | |
| .topic-tag:hover { | |
| border-color: var(--accent-primary); | |
| color: var(--accent-primary); | |
| } | |
| /* Instant Answer Box */ | |
| .instant-answer { | |
| background: linear-gradient(135deg, rgba(222, 88, 51, 0.1), rgba(255, 107, 53, 0.05)); | |
| border: 1px solid var(--accent-primary); | |
| border-radius: 12px; | |
| padding: 12px 16px; | |
| margin-bottom: 12px; | |
| } | |
| .instant-answer-title { | |
| font-size: 0.7rem; | |
| color: var(--accent-primary); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| margin-bottom: 6px; | |
| display: flex; | |
| align-items: center; | |
| gap: 6px; | |
| } | |
| /* Typing Indicator */ | |
| .typing-indicator { | |
| display: flex; | |
| gap: 4px; | |
| padding: 8px 0; | |
| } | |
| .typing-indicator span { | |
| width: 8px; | |
| height: 8px; | |
| background: var(--text-muted); | |
| border-radius: 50%; | |
| animation: typing 1.4s infinite; | |
| } | |
| .typing-indicator span:nth-child(2) { | |
| animation-delay: 0.2s; | |
| } | |
| .typing-indicator span:nth-child(3) { | |
| animation-delay: 0.4s; | |
| } | |
| @keyframes typing { | |
| 0%, | |
| 60%, | |
| 100% { | |
| transform: translateY(0); | |
| } | |
| 30% { | |
| transform: translateY(-10px); | |
| } | |
| } | |
| /* Input Area */ | |
| .input-area { | |
| padding: 20px 24px; | |
| border-top: 1px solid var(--border-color); | |
| background: var(--bg-tertiary); | |
| } | |
| .input-wrapper { | |
| display: flex; | |
| gap: 12px; | |
| align-items: flex-end; | |
| background: var(--bg-primary); | |
| border: 1px solid var(--border-color); | |
| border-radius: 16px; | |
| padding: 8px; | |
| transition: border-color 0.3s ease, box-shadow 0.3s ease; | |
| } | |
| .input-wrapper:focus-within { | |
| border-color: var(--accent-primary); | |
| box-shadow: 0 0 20px var(--accent-glow); | |
| } | |
| .input-wrapper textarea { | |
| flex: 1; | |
| background: transparent; | |
| border: none; | |
| color: var(--text-primary); | |
| font-family: 'Inter', sans-serif; | |
| font-size: 0.95rem; | |
| padding: 12px; | |
| resize: none; | |
| max-height: 120px; | |
| line-height: 1.5; | |
| } | |
| .input-wrapper textarea:focus { | |
| outline: none; | |
| } | |
| .input-wrapper textarea::placeholder { | |
| color: var(--text-muted); | |
| } | |
| .btn-send { | |
| width: 44px; | |
| height: 44px; | |
| border-radius: 12px; | |
| border: none; | |
| background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); | |
| color: white; | |
| cursor: pointer; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| transition: all 0.3s ease; | |
| font-size: 18px; | |
| box-shadow: 0 4px 15px var(--accent-glow); | |
| } | |
| .btn-send:hover { | |
| transform: scale(1.05); | |
| box-shadow: 0 6px 25px var(--accent-glow); | |
| } | |
| .btn-send:active { | |
| transform: scale(0.95); | |
| } | |
| .btn-send:disabled { | |
| opacity: 0.5; | |
| cursor: not-allowed; | |
| transform: none; | |
| } | |
| /* Welcome Message */ | |
| .welcome-message { | |
| text-align: center; | |
| padding: 40px 20px; | |
| } | |
| .welcome-icon { | |
| width: 80px; | |
| height: 80px; | |
| margin: 0 auto 20px; | |
| background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); | |
| border-radius: 24px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 36px; | |
| box-shadow: 0 8px 30px var(--accent-glow); | |
| animation: float 6s ease-in-out infinite; | |
| } | |
| .welcome-title { | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| margin-bottom: 10px; | |
| } | |
| .welcome-text { | |
| color: var(--text-secondary); | |
| max-width: 400px; | |
| margin: 0 auto; | |
| } | |
| /* Suggestions */ | |
| .suggestions { | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: 8px; | |
| justify-content: center; | |
| margin-top: 24px; | |
| } | |
| .suggestion-btn { | |
| padding: 10px 18px; | |
| background: var(--bg-tertiary); | |
| border: 1px solid var(--border-color); | |
| border-radius: 24px; | |
| color: var(--text-secondary); | |
| font-size: 0.85rem; | |
| cursor: pointer; | |
| transition: all 0.3s ease; | |
| } | |
| .suggestion-btn:hover { | |
| background: var(--bg-hover); | |
| border-color: var(--accent-primary); | |
| color: var(--accent-primary); | |
| transform: translateY(-2px); | |
| } | |
| /* Error Message */ | |
| .error-content { | |
| border-left: 3px solid var(--error); | |
| } | |
| /* Loading State */ | |
| .loading { | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .loading-spinner { | |
| width: 16px; | |
| height: 16px; | |
| border: 2px solid var(--border-color); | |
| border-top-color: var(--accent-primary); | |
| border-radius: 50%; | |
| animation: spin 0.8s linear infinite; | |
| } | |
| @keyframes spin { | |
| to { | |
| transform: rotate(360deg); | |
| } | |
| } | |
| /* Responsive */ | |
| @media (max-width: 768px) { | |
| .container { | |
| padding: 10px; | |
| } | |
| header { | |
| padding: 15px 0; | |
| } | |
| .logo-sub { | |
| display: none; | |
| } | |
| .chat-header { | |
| padding: 15px 16px; | |
| } | |
| .messages { | |
| padding: 16px; | |
| gap: 16px; | |
| } | |
| .message-content { | |
| max-width: 85%; | |
| } | |
| .input-area { | |
| padding: 16px; | |
| } | |
| .chat-subtitle { | |
| display: none; | |
| } | |
| } | |
| @media (max-width: 480px) { | |
| .message-content { | |
| padding: 12px 14px; | |
| } | |
| .message-avatar { | |
| width: 32px; | |
| height: 32px; | |
| } | |
| .built-with { | |
| display: none; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="bg-animation"> | |
| <div class="orb orb-1"></div> | |
| <div class="orb orb-2"></div> | |
| <div class="orb orb-3"></div> | |
| </div> | |
| <div class="container"> | |
| <header> | |
| <div class="logo"> | |
| <div class="logo-icon">🦆</div> | |
| <div> | |
| <div class="logo-text">DuckAI</div> | |
| <div class="logo-sub">Powered by DuckDuckGo</div> | |
| </div> | |
| </div> | |
| <div class="header-actions"> | |
| <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="built-with">Built with | |
| anycoder</a> | |
| <button class="btn-icon" id="clearBtn" title="Clear Chat">🗑️</button> | |
| </div> | |
| </header> | |
| <div class="chat-container"> | |
| <div class="chat-header"> | |
| <div class="status-indicator"></div> | |
| <div class="chat-title">AI Assistant</div> | |
| <div class="chat-subtitle">Online • Instant Answers</div> | |
| </div> | |
| <div class="messages" id="messages"> | |
| <div class="welcome-message"> | |
| <div class="welcome-icon">🤖</div> | |
| <div class="welcome-title">Welcome to DuckAI</div> | |
| <div class="welcome-text">Ask me anything! I use DuckDuckGo's instant answers to provide you with fast, | |
| accurate information on a wide variety of topics.</div> | |
| <div class="suggestions"> | |
| <button class="suggestion-btn" onclick="sendMessage('What is artificial intelligence?')">What is AI?</button> | |
| <button class="suggestion-btn" onclick="sendMessage('Tell me about Python programming')">Python Programming</button> | |
| <button class="suggestion-btn" onclick="sendMessage('What is machine learning?')">Machine Learning</button> | |
| <button class="suggestion-btn" onclick="sendMessage('Who is Elon Musk?')">Who is Elon Musk?</button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="input-area"> | |
| <div class="input-wrapper"> | |
| <textarea | |
| id="userInput" | |
| placeholder="Type your message..." | |
| rows="1" | |
| onkeydown="handleKeyDown(event)" | |
| ></textarea> | |
| <button class="btn-send" id="sendBtn" onclick="sendUserMessage()"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
| <line x1="22" y1="2" x2="11" y2="13"></line> | |
| <polygon points="22 2 15 22 11 13 2 9 22 2"></polygon> | |
| </svg> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| </script> | |
| </body> | |
| </html> |