maomaobj commited on
Commit
3ea6e3d
·
verified ·
1 Parent(s): 29fc693

Design a WeChat mini program UI page for a smart home assistant chat interface, named "问管家". The assistant helps users solve issues with household appliances and furniture. Layout: 1. Top greeting section with avatar and welcome text: "Hi,有什么想问智能管家的吗?" 2. Main conversation area with alternating chat bubbles (user on right, AI assistant on left) 3. Each AI response supports: - Multi-step text answers - Embedded icons or small illustrations - Follow-up suggestion buttons ("预约上门", "购买耗材", "猜你还想问") 4. Bottom input bar includes: - Text input - Voice button - Submit icon Style: - Clean, modern chat layout - White/light background with soft shadow cards - Warm tones for assistant replies - Rounded corners, bubble UI - Consistent with previous page color palette Add quick-access history above input area. - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +402 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Home3
3
- emoji: 👁
4
- colorFrom: red
5
- colorTo: green
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: home3
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,402 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>问管家 - 智能家居助手</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');
11
+
12
+ body {
13
+ font-family: 'Noto Sans SC', sans-serif;
14
+ background-color: #f5f5f5;
15
+ }
16
+
17
+ .chat-bubble-ai {
18
+ background: linear-gradient(135deg, #fff9f0 0%, #fff0e0 100%);
19
+ border-radius: 18px 18px 18px 4px;
20
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
21
+ }
22
+
23
+ .chat-bubble-user {
24
+ background: linear-gradient(135deg, #e6f7ff 0%, #d0ebff 100%);
25
+ border-radius: 18px 18px 4px 18px;
26
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
27
+ }
28
+
29
+ .suggestion-btn {
30
+ transition: all 0.2s ease;
31
+ }
32
+
33
+ .suggestion-btn:hover {
34
+ transform: translateY(-2px);
35
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
36
+ }
37
+
38
+ .appliance-icon {
39
+ width: 40px;
40
+ height: 40px;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ border-radius: 12px;
45
+ background: rgba(255,255,255,0.7);
46
+ box-shadow: 0 2px 4px rgba(0,0,0,0.05);
47
+ }
48
+
49
+ .history-chip {
50
+ transition: all 0.2s ease;
51
+ cursor: pointer;
52
+ }
53
+
54
+ .history-chip:hover {
55
+ background-color: #e6f7ff;
56
+ transform: scale(1.05);
57
+ }
58
+
59
+ .pulse {
60
+ animation: pulse 2s infinite;
61
+ }
62
+
63
+ @keyframes pulse {
64
+ 0% { opacity: 0.5; }
65
+ 50% { opacity: 1; }
66
+ 100% { opacity: 0.5; }
67
+ }
68
+
69
+ .typing-indicator span {
70
+ animation: bounce 1.5s infinite;
71
+ display: inline-block;
72
+ }
73
+
74
+ .typing-indicator span:nth-child(2) {
75
+ animation-delay: 0.2s;
76
+ }
77
+
78
+ .typing-indicator span:nth-child(3) {
79
+ animation-delay: 0.4s;
80
+ }
81
+
82
+ @keyframes bounce {
83
+ 0%, 100% { transform: translateY(0); }
84
+ 50% { transform: translateY(-5px); }
85
+ }
86
+ </style>
87
+ </head>
88
+ <body class="flex flex-col h-screen bg-gray-50">
89
+ <!-- Header Section -->
90
+ <header class="bg-white py-4 px-4 shadow-sm">
91
+ <div class="flex items-center">
92
+ <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">
93
+ <i class="fas fa-home"></i>
94
+ </div>
95
+ <div class="ml-3">
96
+ <h1 class="text-lg font-bold text-gray-800">问管家</h1>
97
+ <p class="text-sm text-gray-500">Hi,有什么想问智能管家的吗?</p>
98
+ </div>
99
+ </div>
100
+ </header>
101
+
102
+ <!-- Main Chat Area -->
103
+ <main class="flex-1 overflow-y-auto p-4 pb-20" id="chatContainer">
104
+ <!-- Initial greeting message -->
105
+ <div class="flex mb-4">
106
+ <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">
107
+ <i class="fas fa-robot"></i>
108
+ </div>
109
+ <div class="ml-3 max-w-[80%]">
110
+ <div class="chat-bubble-ai px-4 py-3">
111
+ <p class="text-gray-800">您好!我是您的智能家居管家,随时为您解决家电、家具问题。请问今天有什么需要帮助的吗?</p>
112
+ </div>
113
+ <div class="flex flex-wrap gap-2 mt-2">
114
+ <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">
115
+ 空调不制冷
116
+ </button>
117
+ <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">
118
+ 洗衣机漏水
119
+ </button>
120
+ <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">
121
+ 电视无信号
122
+ </button>
123
+ </div>
124
+ </div>
125
+ </div>
126
+
127
+ <!-- Example conversation -->
128
+ <div class="flex justify-end mb-4">
129
+ <div class="max-w-[80%]">
130
+ <div class="chat-bubble-user px-4 py-3">
131
+ <p class="text-gray-800">我家的冰箱最近声音很大,是什么原因?</p>
132
+ </div>
133
+ </div>
134
+ </div>
135
+
136
+ <div class="flex mb-4">
137
+ <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">
138
+ <i class="fas fa-robot"></i>
139
+ </div>
140
+ <div class="ml-3 max-w-[80%]">
141
+ <div class="chat-bubble-ai px-4 py-3">
142
+ <p class="text-gray-800 mb-2">冰箱噪音大可能有以下几个原因:</p>
143
+ <div class="flex items-center mb-2">
144
+ <div class="appliance-icon mr-2 text-orange-500">
145
+ <i class="fas fa-fan"></i>
146
+ </div>
147
+ <p class="text-gray-800">1. 压缩机风扇有异物或灰尘积累</p>
148
+ </div>
149
+ <div class="flex items-center mb-2">
150
+ <div class="appliance-icon mr-2 text-orange-500">
151
+ <i class="fas fa-cube"></i>
152
+ </div>
153
+ <p class="text-gray-800">2. 冰箱放置不平稳产生共振</p>
154
+ </div>
155
+ <div class="flex items-center">
156
+ <div class="appliance-icon mr-2 text-orange-500">
157
+ <i class="fas fa-snowflake"></i>
158
+ </div>
159
+ <p class="text-gray-800">3. 制冷剂流动声音(正常现象)</p>
160
+ </div>
161
+ </div>
162
+ <div class="mt-3">
163
+ <p class="text-xs text-gray-500 mb-2">建议操作:</p>
164
+ <div class="flex flex-wrap gap-2">
165
+ <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">
166
+ 查看解决步骤
167
+ </button>
168
+ <button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
169
+ 预约上门
170
+ </button>
171
+ <button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
172
+ 购买耗材
173
+ </button>
174
+ </div>
175
+ </div>
176
+ <div class="mt-3">
177
+ <p class="text-xs text-gray-500 mb-2">猜你还想问:</p>
178
+ <div class="flex flex-wrap gap-2">
179
+ <button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
180
+ 如何清洁冰箱?
181
+ </button>
182
+ <button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
183
+ 冰箱温度设置
184
+ </button>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <!-- Typing indicator example -->
191
+ <div class="flex mb-4 hidden" id="typingIndicator">
192
+ <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">
193
+ <i class="fas fa-robot"></i>
194
+ </div>
195
+ <div class="ml-3 max-w-[80%]">
196
+ <div class="chat-bubble-ai px-4 py-3">
197
+ <div class="typing-indicator">
198
+ <span>•</span>
199
+ <span>•</span>
200
+ <span>•</span>
201
+ </div>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ </main>
206
+
207
+ <!-- Quick Access History -->
208
+ <div class="px-4 py-2 bg-white border-t border-gray-200">
209
+ <div class="flex overflow-x-auto pb-2 space-x-2 hide-scrollbar">
210
+ <div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
211
+ 空调清洗服务
212
+ </div>
213
+ <div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
214
+ 智能锁设置
215
+ </div>
216
+ <div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
217
+ 洗衣机故障E3
218
+ </div>
219
+ <div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
220
+ 电视投屏方法
221
+ </div>
222
+ <div class="history-chip bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
223
+ 净水器滤芯更换
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+ <!-- Input Area -->
229
+ <footer class="bg-white border-t border-gray-200 p-3">
230
+ <div class="flex items-center">
231
+ <button class="w-10 h-10 rounded-full bg-gray-100 flex items-center justify-center text-gray-500 mr-2">
232
+ <i class="fas fa-plus"></i>
233
+ </button>
234
+ <div class="flex-1 bg-gray-100 rounded-full flex items-center px-3">
235
+ <input
236
+ type="text"
237
+ id="messageInput"
238
+ placeholder="输入您的问题..."
239
+ class="flex-1 bg-transparent py-2 text-gray-700 focus:outline-none"
240
+ >
241
+ <button class="text-gray-400 hover:text-gray-600 p-2">
242
+ <i class="far fa-smile"></i>
243
+ </button>
244
+ </div>
245
+ <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">
246
+ <i class="fas fa-microphone"></i>
247
+ </button>
248
+ <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">
249
+ <i class="fas fa-paper-plane"></i>
250
+ </button>
251
+ </div>
252
+ </footer>
253
+
254
+ <script>
255
+ document.addEventListener('DOMContentLoaded', function() {
256
+ const chatContainer = document.getElementById('chatContainer');
257
+ const messageInput = document.getElementById('messageInput');
258
+ const sendButton = document.getElementById('sendButton');
259
+ const voiceButton = document.getElementById('voiceButton');
260
+ const typingIndicator = document.getElementById('typingIndicator');
261
+
262
+ // Scroll to bottom of chat
263
+ function scrollToBottom() {
264
+ chatContainer.scrollTop = chatContainer.scrollHeight;
265
+ }
266
+
267
+ // Add a new message to the chat
268
+ function addMessage(text, isUser = true) {
269
+ const messageDiv = document.createElement('div');
270
+ messageDiv.classList.add('flex', 'mb-4');
271
+
272
+ if (isUser) {
273
+ messageDiv.classList.add('justify-end');
274
+ messageDiv.innerHTML = `
275
+ <div class="max-w-[80%]">
276
+ <div class="chat-bubble-user px-4 py-3">
277
+ <p class="text-gray-800">${text}</p>
278
+ </div>
279
+ </div>
280
+ `;
281
+ } else {
282
+ messageDiv.innerHTML = `
283
+ <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">
284
+ <i class="fas fa-robot"></i>
285
+ </div>
286
+ <div class="ml-3 max-w-[80%]">
287
+ <div class="chat-bubble-ai px-4 py-3">
288
+ <p class="text-gray-800">${text}</p>
289
+ </div>
290
+ </div>
291
+ `;
292
+ }
293
+
294
+ chatContainer.appendChild(messageDiv);
295
+ scrollToBottom();
296
+ }
297
+
298
+ // Simulate AI response
299
+ function simulateAIResponse(userMessage) {
300
+ // Show typing indicator
301
+ typingIndicator.classList.remove('hidden');
302
+ scrollToBottom();
303
+
304
+ // Hide typing indicator after delay and show response
305
+ setTimeout(() => {
306
+ typingIndicator.classList.add('hidden');
307
+
308
+ // Simple response based on keywords
309
+ let response = "我理解您的问题了,让我为您查找最佳解决方案...";
310
+
311
+ if (userMessage.includes('空调') || userMessage.includes('冷气')) {
312
+ response = "关于空调问题,可能是滤网堵塞或制冷剂不足。建议先清洁滤网,如果问题持续,可能需要专业检修。需要我为您预约上门服务吗?";
313
+ } else if (userMessage.includes('冰箱') || userMessage.includes('冷藏')) {
314
+ response = "冰箱问题通常与温度设置或密封条有关。请检查密封条是否完好,并确保温度设置在2-8℃之间。需要更详细的指导吗?";
315
+ } else if (userMessage.includes('洗衣机') || userMessage.includes('洗衣')) {
316
+ response = "洗衣机异常可能是由于不平衡��载或排水管堵塞。请尝试重新分布衣物并检查排水管。这里有详细的故障排除指南。";
317
+ }
318
+
319
+ addMessage(response, false);
320
+
321
+ // Add suggestion buttons
322
+ const aiMessageDiv = chatContainer.lastElementChild;
323
+ const responseContainer = aiMessageDiv.querySelector('.ml-3');
324
+
325
+ const buttonsHTML = `
326
+ <div class="mt-3">
327
+ <div class="flex flex-wrap gap-2">
328
+ <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">
329
+ 查看解决步骤
330
+ </button>
331
+ <button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
332
+ 预约上门
333
+ </button>
334
+ <button class="suggestion-btn bg-white border border-orange-300 text-orange-500 text-xs px-3 py-1.5 rounded-full">
335
+ 购买耗材
336
+ </button>
337
+ </div>
338
+ </div>
339
+ <div class="mt-3">
340
+ <p class="text-xs text-gray-500 mb-2">猜你还想问:</p>
341
+ <div class="flex flex-wrap gap-2">
342
+ <button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
343
+ 如何清洁${userMessage.includes('空调') ? '空调' : userMessage.includes('冰箱') ? '冰箱' : '洗衣机'}?
344
+ </button>
345
+ <button class="suggestion-btn bg-gray-100 text-gray-700 text-xs px-3 py-1.5 rounded-full">
346
+ ${userMessage.includes('空调') ? '空调' : userMessage.includes('冰箱') ? '冰箱' : '洗衣机'}省电技巧
347
+ </button>
348
+ </div>
349
+ </div>
350
+ `;
351
+
352
+ responseContainer.innerHTML += buttonsHTML;
353
+ scrollToBottom();
354
+ }, 2000);
355
+ }
356
+
357
+ // Send message handler
358
+ function sendMessage() {
359
+ const message = messageInput.value.trim();
360
+ if (message) {
361
+ addMessage(message, true);
362
+ messageInput.value = '';
363
+ simulateAIResponse(message);
364
+ }
365
+ }
366
+
367
+ // Event listeners
368
+ sendButton.addEventListener('click', sendMessage);
369
+
370
+ messageInput.addEventListener('keypress', function(e) {
371
+ if (e.key === 'Enter') {
372
+ sendMessage();
373
+ }
374
+ });
375
+
376
+ // Voice button animation
377
+ voiceButton.addEventListener('mousedown', function() {
378
+ this.classList.add('pulse');
379
+ });
380
+
381
+ voiceButton.addEventListener('mouseup', function() {
382
+ this.classList.remove('pulse');
383
+ // Simulate voice input
384
+ addMessage("空调制冷效果不好怎么办?", true);
385
+ simulateAIResponse("空调制冷效果不好怎么办?");
386
+ });
387
+
388
+ // Suggestion button handling
389
+ document.addEventListener('click', function(e) {
390
+ if (e.target.classList.contains('suggestion-btn')) {
391
+ const text = e.target.textContent.trim();
392
+ addMessage(text, true);
393
+ simulateAIResponse(text);
394
+ }
395
+ });
396
+
397
+ // Initial scroll to bottom
398
+ scrollToBottom();
399
+ });
400
+ </script>
401
+ <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>
402
+ </html>