Spaces:
Runtime error
Runtime error
File size: 6,910 Bytes
94d93ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | <!DOCTYPE html>
<html>
<head>
<title>Arlo AI Agent - Manas Maskar</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 900px;
margin: 0 auto;
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
}
.header h1 { font-size: 2em; margin-bottom: 10px; }
.header p { opacity: 0.9; font-size: 0.9em; }
.developer {
background: rgba(255,255,255,0.1);
padding: 10px;
border-radius: 10px;
margin-top: 15px;
font-size: 0.85em;
}
.chat-container {
padding: 30px;
min-height: 400px;
max-height: 500px;
overflow-y: auto;
}
.message {
margin-bottom: 20px;
padding: 15px;
border-radius: 15px;
max-width: 80%;
}
.user-message {
background: #667eea;
color: white;
margin-left: auto;
text-align: right;
}
.assistant-message {
background: #f1f3f4;
color: #333;
}
.input-container {
padding: 20px;
background: #f8f9fa;
border-top: 1px solid #e0e0e0;
display: flex;
gap: 10px;
}
#questionInput {
flex: 1;
padding: 15px;
border: 2px solid #e0e0e0;
border-radius: 25px;
font-size: 1em;
outline: none;
transition: border 0.3s;
}
#questionInput:focus { border-color: #667eea; }
button {
padding: 15px 30px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 25px;
cursor: pointer;
font-weight: bold;
transition: transform 0.2s;
}
button:hover { transform: scale(1.05); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.loading { display: none; color: #667eea; padding: 10px; }
.examples {
padding: 20px;
background: #f8f9fa;
border-top: 1px solid #e0e0e0;
}
.examples h3 { margin-bottom: 10px; font-size: 1em; color: #666; }
.example-btn {
display: inline-block;
margin: 5px;
padding: 8px 15px;
background: white;
border: 1px solid #ddd;
border-radius: 15px;
cursor: pointer;
font-size: 0.85em;
transition: all 0.2s;
}
.example-btn:hover {
background: #667eea;
color: white;
border-color: #667eea;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>π Arlo AI Support Agent</h1>
<p>Powered by Retrieval-Augmented Generation (RAG)</p>
<div class="developer">
π¨βπ» Developed by <strong>Manas Maskar</strong> | Software Engineer & ML Specialist
</div>
</div>
<div class="examples">
<h3>Try these questions:</h3>
<span class="example-btn" onclick="askQuestion('Does Arlo support a trial plan?')">Trial Plan</span>
<span class="example-btn" onclick="askQuestion('What battery does Arlo Pro 3 use?')">Battery Info</span>
<span class="example-btn" onclick="askQuestion('How do I factory reset my camera?')">Factory Reset</span>
<span class="example-btn" onclick="askQuestion('What are Arlo Modes and Routines?')">Modes & Routines</span>
</div>
<div class="chat-container" id="chatContainer"></div>
<div class="input-container">
<input
type="text"
id="questionInput"
placeholder="Ask anything about Arlo products..."
onkeypress="if(event.key==='Enter') sendQuestion()"
/>
<button onclick="sendQuestion()" id="sendBtn">Send</button>
</div>
<div class="loading" id="loading">π€ Thinking...</div>
</div>
<script>
function addMessage(content, isUser) {
const chatContainer = document.getElementById('chatContainer');
const messageDiv = document.createElement('div');
messageDiv.className = `message ${isUser ? 'user-message' : 'assistant-message'}`;
messageDiv.innerHTML = content.replace(/\n/g, '<br>');
chatContainer.appendChild(messageDiv);
chatContainer.scrollTop = chatContainer.scrollHeight;
}
function askQuestion(question) {
document.getElementById('questionInput').value = question;
sendQuestion();
}
async function sendQuestion() {
const input = document.getElementById('questionInput');
const question = input.value.trim();
if (!question) return;
// Show user message
addMessage(question, true);
input.value = '';
// Show loading
const loading = document.getElementById('loading');
const sendBtn = document.getElementById('sendBtn');
loading.style.display = 'block';
sendBtn.disabled = true;
try {
const response = await fetch('/query', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ question })
});
const data = await response.json();
addMessage(data.answer, false);
} catch (error) {
addMessage('β Error: Could not process your question. Please try again.', false);
} finally {
loading.style.display = 'none';
sendBtn.disabled = false;
}
}
// Show welcome message
window.onload = () => {
addMessage('π Hello! I\'m the Arlo AI Support Agent. Ask me anything about Arlo cameras, subscriptions, setup, or troubleshooting!', false);
};
</script>
</body>
</html>
|