File size: 19,276 Bytes
3ea6e3d | 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | <!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>问管家 - 智能家居助手</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');
body {
font-family: 'Noto Sans SC', sans-serif;
background-color: #f5f5f5;
}
.chat-bubble-ai {
background: linear-gradient(135deg, #fff9f0 0%, #fff0e0 100%);
border-radius: 18px 18px 18px 4px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.chat-bubble-user {
background: linear-gradient(135deg, #e6f7ff 0%, #d0ebff 100%);
border-radius: 18px 18px 4px 18px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.suggestion-btn {
transition: all 0.2s ease;
}
.suggestion-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.appliance-icon {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
background: rgba(255,255,255,0.7);
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.history-chip {
transition: all 0.2s ease;
cursor: pointer;
}
.history-chip:hover {
background-color: #e6f7ff;
transform: scale(1.05);
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 0.5; }
50% { opacity: 1; }
100% { opacity: 0.5; }
}
.typing-indicator span {
animation: bounce 1.5s infinite;
display: inline-block;
}
.typing-indicator span:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-5px); }
}
</style>
</head>
<body class="flex flex-col h-screen bg-gray-50">
<!-- Header Section -->
<header class="bg-white py-4 px-4 shadow-sm">
<div class="flex items-center">
<div class="w-12 h-12 rounded-full bg-gradient-to-r from-amber-400 to-orange-400 flex items-center justify-center text-white text-xl">
<i class="fas fa-home"></i>
</div>
<div class="ml-3">
<h1 class="text-lg font-bold text-gray-800">问管家</h1>
<p class="text-sm text-gray-500">Hi,有什么想问智能管家的吗?</p>
</div>
</div>
</header>
<!-- Main Chat Area -->
<main class="flex-1 overflow-y-auto p-4 pb-20" id="chatContainer">
<!-- Initial greeting message -->
<div class="flex mb-4">
<div class="w-10 h-10 rounded-full bg-gradient-to-r from-amber-400 to-orange-400 flex items-center justify-center text-white flex-shrink-0">
<i class="fas fa-robot"></i>
</div>
<div class="ml-3 max-w-[80%]">
<div class="chat-bubble-ai px-4 py-3">
<p class="text-gray-800">您好!我是您的智能家居管家,随时为您解决家电、家具问题。请问今天有什么需要帮助的吗?</p>
</div>
<div class="flex flex-wrap gap-2 mt-2">
<button class="suggestion-btn bg-gradient-to-r from-amber-400 to-orange-400 text-white text-xs px-3 py-1.5 rounded-full">
空调不制冷
</button>
<button class="suggestion-btn bg-gradient-to-r from-amber-400 to-orange-400 text-white text-xs px-3 py-1.5 rounded-full">
洗衣机漏水
</button>
<button class="suggestion-btn bg-gradient-to-r from-amber-400 to-orange-400 text-white text-xs px-3 py-1.5 rounded-full">
电视无信号
</button>
</div>
</div>
</div>
<!-- Example conversation -->
<div class="flex justify-end mb-4">
<div class="max-w-[80%]">
<div class="chat-bubble-user px-4 py-3">
<p class="text-gray-800">我家的冰箱最近声音很大,是什么原因?</p>
</div>
</div>
</div>
<div class="flex mb-4">
<div class="w-10 h-10 rounded-full bg-gradient-to-r from-amber-400 to-orange-400 flex items-center justify-center text-white flex-shrink-0">
<i class="fas fa-robot"></i>
</div>
<div class="ml-3 max-w-[80%]">
<div class="chat-bubble-ai px-4 py-3">
<p class="text-gray-800 mb-2">冰箱噪音大可能有以下几个原因:</p>
<div class="flex items-center mb-2">
<div class="appliance-icon mr-2 text-orange-500">
<i class="fas fa-fan"></i>
</div>
<p class="text-gray-800">1. 压缩机风扇有异物或灰尘积累</p>
</div>
<div class="flex items-center mb-2">
<div class="appliance-icon mr-2 text-orange-500">
<i class="fas fa-cube"></i>
</div>
<p class="text-gray-800">2. 冰箱放置不平稳产生共振</p>
</div>
<div class="flex items-center">
<div class="appliance-icon mr-2 text-orange-500">
<i class="fas fa-snowflake"></i>
</div>
<p class="text-gray-800">3. 制冷剂流动声音(正常现象)</p>
</div>
</div>
<div class="mt-3">
<p class="text-xs text-gray-500 mb-2">建议操作:</p>
<div class="flex flex-wrap gap-2">
<button class="suggestion-btn bg-gradient-to-r from-amber-400 to-orange-400 text-white text-xs px-3 py-1.5 rounded-full">
查看解决步骤
</button>
<button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
预约上门
</button>
<button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
购买耗材
</button>
</div>
</div>
<div class="mt-3">
<p class="text-xs text-gray-500 mb-2">猜你还想问:</p>
<div class="flex flex-wrap gap-2">
<button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
如何清洁冰箱?
</button>
<button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
冰箱温度设置
</button>
</div>
</div>
</div>
</div>
<!-- Typing indicator example -->
<div class="flex mb-4 hidden" id="typingIndicator">
<div class="w-10 h-10 rounded-full bg-gradient-to-r from-amber-400 to-orange-400 flex items-center justify-center text-white flex-shrink-0">
<i class="fas fa-robot"></i>
</div>
<div class="ml-3 max-w-[80%]">
<div class="chat-bubble-ai px-4 py-3">
<div class="typing-indicator">
<span>•</span>
<span>•</span>
<span>•</span>
</div>
</div>
</div>
</div>
</main>
<!-- Quick Access History -->
<div class="px-4 py-2 bg-white border-t border-gray-200">
<div class="flex overflow-x-auto pb-2 space-x-2 hide-scrollbar">
<div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
空调清洗服务
</div>
<div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
智能锁设置
</div>
<div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
洗衣机故障E3
</div>
<div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
电视投屏方法
</div>
<div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
净水器滤芯更换
</div>
</div>
</div>
<!-- Input Area -->
<footer class="bg-white border-t border-gray-200 p-3">
<div class="flex items-center">
<button class="w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-500 mr-2">
<i class="fas fa-plus"></i>
</button>
<div class="flex-1 bg-gray-100 rounded-full flex items-center px-3">
<input
type="text"
id="messageInput"
placeholder="输入您的问题..."
class="flex-1 bg-transparent py-2 text-gray-700 focus:outline-none"
>
<button class="text-gray-400 hover:text-gray-600 p-2">
<i class="far fa-smile"></i>
</button>
</div>
<button id="voiceButton" class="w-10 h-10 rounded-full bg-gradient-to-r from-amber-400 to-orange-400 flex items-center justify-center text-white ml-2">
<i class="fas fa-microphone"></i>
</button>
<button id="sendButton" class="w-10 h-10 rounded-full bg-gradient-to-r from-amber-400 to-orange-400 flex items-center justify-center text-white ml-2">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
const chatContainer = document.getElementById('chatContainer');
const messageInput = document.getElementById('messageInput');
const sendButton = document.getElementById('sendButton');
const voiceButton = document.getElementById('voiceButton');
const typingIndicator = document.getElementById('typingIndicator');
// Scroll to bottom of chat
function scrollToBottom() {
chatContainer.scrollTop = chatContainer.scrollHeight;
}
// Add a new message to the chat
function addMessage(text, isUser = true) {
const messageDiv = document.createElement('div');
messageDiv.classList.add('flex', 'mb-4');
if (isUser) {
messageDiv.classList.add('justify-end');
messageDiv.innerHTML = `
<div class="max-w-[80%]">
<div class="chat-bubble-user px-4 py-3">
<p class="text-gray-800">${text}</p>
</div>
</div>
`;
} else {
messageDiv.innerHTML = `
<div class="w-10 h-10 rounded-full bg-gradient-to-r from-amber-400 to-orange-400 flex items-center justify-center text-white flex-shrink-0">
<i class="fas fa-robot"></i>
</div>
<div class="ml-3 max-w-[80%]">
<div class="chat-bubble-ai px-4 py-3">
<p class="text-gray-800">${text}</p>
</div>
</div>
`;
}
chatContainer.appendChild(messageDiv);
scrollToBottom();
}
// Simulate AI response
function simulateAIResponse(userMessage) {
// Show typing indicator
typingIndicator.classList.remove('hidden');
scrollToBottom();
// Hide typing indicator after delay and show response
setTimeout(() => {
typingIndicator.classList.add('hidden');
// Simple response based on keywords
let response = "我理解您的问题了,让我为您查找最佳解决方案...";
if (userMessage.includes('空调') || userMessage.includes('冷气')) {
response = "关于空调问题,可能是滤网堵塞或制冷剂不足。建议先清洁滤网,如果问题持续,可能需要专业检修。需要我为您预约上门服务吗?";
} else if (userMessage.includes('冰箱') || userMessage.includes('冷藏')) {
response = "冰箱问题通常与温度设置或密封条有关。请检查密封条是否完好,并确保温度设置在2-8℃之间。需要更详细的指导吗?";
} else if (userMessage.includes('洗衣机') || userMessage.includes('洗衣')) {
response = "洗衣机异常可能是由于不平衡负载或排水管堵塞。请尝试重新分布衣物并检查排水管。这里有详细的故障排除指南。";
}
addMessage(response, false);
// Add suggestion buttons
const aiMessageDiv = chatContainer.lastElementChild;
const responseContainer = aiMessageDiv.querySelector('.ml-3');
const buttonsHTML = `
<div class="mt-3">
<div class="flex flex-wrap gap-2">
<button class="suggestion-btn bg-gradient-to-r from-amber-400 to-orange-400 text-white text-xs px-3 py-1.5 rounded-full">
查看解决步骤
</button>
<button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
预约上门
</button>
<button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
购买耗材
</button>
</div>
</div>
<div class="mt-3">
<p class="text-xs text-gray-500 mb-2">猜你还想问:</p>
<div class="flex flex-wrap gap-2">
<button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
如何清洁${userMessage.includes('空调') ? '空调' : userMessage.includes('冰箱') ? '冰箱' : '洗衣机'}?
</button>
<button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
${userMessage.includes('空调') ? '空调' : userMessage.includes('冰箱') ? '冰箱' : '洗衣机'}省电技巧
</button>
</div>
</div>
`;
responseContainer.innerHTML += buttonsHTML;
scrollToBottom();
}, 2000);
}
// Send message handler
function sendMessage() {
const message = messageInput.value.trim();
if (message) {
addMessage(message, true);
messageInput.value = '';
simulateAIResponse(message);
}
}
// Event listeners
sendButton.addEventListener('click', sendMessage);
messageInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
sendMessage();
}
});
// Voice button animation
voiceButton.addEventListener('mousedown', function() {
this.classList.add('pulse');
});
voiceButton.addEventListener('mouseup', function() {
this.classList.remove('pulse');
// Simulate voice input
addMessage("空调制冷效果不好怎么办?", true);
simulateAIResponse("空调制冷效果不好怎么办?");
});
// Suggestion button handling
document.addEventListener('click', function(e) {
if (e.target.classList.contains('suggestion-btn')) {
const text = e.target.textContent.trim();
addMessage(text, true);
simulateAIResponse(text);
}
});
// Initial scroll to bottom
scrollToBottom();
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=maomaobj/home3" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |