Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +509 -19
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 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: mm
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: red
|
| 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,509 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>WeChat Web</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 |
+
/* 自定义滚动条 */
|
| 11 |
+
.custom-scrollbar::-webkit-scrollbar {
|
| 12 |
+
width: 6px;
|
| 13 |
+
}
|
| 14 |
+
.custom-scrollbar::-webkit-scrollbar-track {
|
| 15 |
+
background: #f1f1f1;
|
| 16 |
+
}
|
| 17 |
+
.custom-scrollbar::-webkit-scrollbar-thumb {
|
| 18 |
+
background: #c1c1c1;
|
| 19 |
+
border-radius: 3px;
|
| 20 |
+
}
|
| 21 |
+
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
| 22 |
+
background: #a8a8a8;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/* 聊天气泡 */
|
| 26 |
+
.message-bubble {
|
| 27 |
+
max-width: 70%;
|
| 28 |
+
word-wrap: break-word;
|
| 29 |
+
}
|
| 30 |
+
.message-bubble.sent {
|
| 31 |
+
background-color: #95ec69;
|
| 32 |
+
border-radius: 8px 0 8px 8px;
|
| 33 |
+
}
|
| 34 |
+
.message-bubble.received {
|
| 35 |
+
background-color: white;
|
| 36 |
+
border-radius: 0 8px 8px 8px;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/* 动画效果 */
|
| 40 |
+
@keyframes fadeIn {
|
| 41 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 42 |
+
to { opacity: 1; transform: translateY(0); }
|
| 43 |
+
}
|
| 44 |
+
.fade-in {
|
| 45 |
+
animation: fadeIn 0.3s ease-out forwards;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/* 输入框占位符样式 */
|
| 49 |
+
.input-placeholder::placeholder {
|
| 50 |
+
color: #999;
|
| 51 |
+
font-size: 14px;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* 未读消息小红点 */
|
| 55 |
+
.unread-badge {
|
| 56 |
+
position: absolute;
|
| 57 |
+
top: -5px;
|
| 58 |
+
right: -5px;
|
| 59 |
+
width: 16px;
|
| 60 |
+
height: 16px;
|
| 61 |
+
background-color: #f56c6c;
|
| 62 |
+
border-radius: 50%;
|
| 63 |
+
color: white;
|
| 64 |
+
font-size: 10px;
|
| 65 |
+
display: flex;
|
| 66 |
+
align-items: center;
|
| 67 |
+
justify-content: center;
|
| 68 |
+
}
|
| 69 |
+
</style>
|
| 70 |
+
</head>
|
| 71 |
+
<body class="bg-gray-100 h-screen flex items-center justify-center">
|
| 72 |
+
<div class="container mx-auto shadow-2xl rounded-lg overflow-hidden" style="width: 900px; height: 650px;">
|
| 73 |
+
<div class="flex h-full">
|
| 74 |
+
<!-- 左侧联系人列表 -->
|
| 75 |
+
<div class="w-1/3 bg-white border-r border-gray-200 flex flex-col">
|
| 76 |
+
<!-- 顶部搜索栏 -->
|
| 77 |
+
<div class="p-3 bg-gray-50 border-b border-gray-200">
|
| 78 |
+
<div class="relative">
|
| 79 |
+
<input type="text" placeholder="搜索" class="w-full py-2 pl-10 pr-4 bg-white rounded-full text-sm focus:outline-none border border-gray-200 input-placeholder">
|
| 80 |
+
<i class="fas fa-search absolute left-3 top-2.5 text-gray-400"></i>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<!-- 联系人列表 -->
|
| 85 |
+
<div class="flex-1 overflow-y-auto custom-scrollbar" id="contactList">
|
| 86 |
+
<!-- 联系人项将通过JavaScript动态生成 -->
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<!-- 底部导航 -->
|
| 90 |
+
<div class="flex justify-around items-center p-2 bg-gray-50 border-t border-gray-200">
|
| 91 |
+
<button class="p-2 text-gray-600 hover:text-green-500 transition-colors">
|
| 92 |
+
<i class="fas fa-comment-alt text-xl"></i>
|
| 93 |
+
</button>
|
| 94 |
+
<button class="p-2 text-gray-600 hover:text-green-500 transition-colors">
|
| 95 |
+
<i class="fas fa-address-book text-xl"></i>
|
| 96 |
+
</button>
|
| 97 |
+
<button class="p-2 text-gray-600 hover:text-green-500 transition-colors">
|
| 98 |
+
<i class="fas fa-compass text-xl"></i>
|
| 99 |
+
</button>
|
| 100 |
+
<button class="p-2 text-gray-600 hover:text-green-500 transition-colors">
|
| 101 |
+
<i class="fas fa-user-circle text-xl"></i>
|
| 102 |
+
</button>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<!-- 右侧聊天区域 -->
|
| 107 |
+
<div class="w-2/3 flex flex-col bg-gray-100">
|
| 108 |
+
<!-- 聊天顶部信息栏 -->
|
| 109 |
+
<div class="p-3 bg-gray-50 border-b border-gray-200 flex items-center justify-between">
|
| 110 |
+
<div class="flex items-center">
|
| 111 |
+
<div class="relative">
|
| 112 |
+
<img src="https://randomuser.me/api/portraits/women/12.jpg" alt="头像" class="w-10 h-10 rounded-full">
|
| 113 |
+
<span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></span>
|
| 114 |
+
</div>
|
| 115 |
+
<div class="ml-3">
|
| 116 |
+
<div class="font-semibold" id="chatTitle">李小红</div>
|
| 117 |
+
<div class="text-xs text-gray-500">在线</div>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
<div class="flex items-center space-x-4">
|
| 121 |
+
<button class="text-gray-600 hover:text-green-500">
|
| 122 |
+
<i class="fas fa-phone-alt"></i>
|
| 123 |
+
</button>
|
| 124 |
+
<button class="text-gray-600 hover:text-green-500">
|
| 125 |
+
<i class="fas fa-video"></i>
|
| 126 |
+
</button>
|
| 127 |
+
<button class="text-gray-600 hover:text-green-500">
|
| 128 |
+
<i class="fas fa-search"></i>
|
| 129 |
+
</button>
|
| 130 |
+
<button class="text-gray-600 hover:text-green-500">
|
| 131 |
+
<i class="fas fa-ellipsis-v"></i>
|
| 132 |
+
</button>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
|
| 136 |
+
<!-- 聊天消息区域 -->
|
| 137 |
+
<div class="flex-1 p-4 overflow-y-auto custom-scrollbar bg-gray-50" id="messageArea">
|
| 138 |
+
<!-- 时间分隔线 -->
|
| 139 |
+
<div class="flex items-center justify-center my-4">
|
| 140 |
+
<div class="h-px bg-gray-300 flex-1"></div>
|
| 141 |
+
<span class="px-2 text-xs text-gray-500 bg-gray-50 rounded-full">今天</span>
|
| 142 |
+
<div class="h-px bg-gray-300 flex-1"></div>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
<!-- 消息将通过JavaScript动态生成 -->
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<!-- 底部输入区域 -->
|
| 149 |
+
<div class="p-3 bg-white border-t border-gray-200">
|
| 150 |
+
<!-- 工具栏 -->
|
| 151 |
+
<div class="flex items-center justify-between mb-2">
|
| 152 |
+
<div class="flex space-x-3">
|
| 153 |
+
<button class="text-gray-500 hover:text-green-500">
|
| 154 |
+
<i class="far fa-smile"></i>
|
| 155 |
+
</button>
|
| 156 |
+
<button class="text-gray-500 hover:text-green-500">
|
| 157 |
+
<i class="fas fa-paperclip"></i>
|
| 158 |
+
</button>
|
| 159 |
+
<button class="text-gray-500 hover:text-green-500">
|
| 160 |
+
<i class="fas fa-image"></i>
|
| 161 |
+
</button>
|
| 162 |
+
<button class="text-gray-500 hover:text-green-500">
|
| 163 |
+
<i class="fas fa-camera"></i>
|
| 164 |
+
</button>
|
| 165 |
+
</div>
|
| 166 |
+
<button class="text-gray-500 hover:text-green-500">
|
| 167 |
+
<i class="fas fa-ellipsis-h"></i>
|
| 168 |
+
</button>
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
<!-- 输入框 -->
|
| 172 |
+
<div class="relative">
|
| 173 |
+
<textarea id="messageInput" placeholder="输入消息" class="w-full p-3 border border-gray-200 rounded-lg focus:outline-none focus:border-green-400 resize-none input-placeholder" rows="2" style="min-height: 40px;"></textarea>
|
| 174 |
+
<button id="sendButton" class="absolute right-3 bottom-3 text-gray-400 hover:text-green-500">
|
| 175 |
+
<i class="fas fa-paper-plane"></i>
|
| 176 |
+
</button>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
</div>
|
| 182 |
+
|
| 183 |
+
<script>
|
| 184 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 185 |
+
// 模拟联系人数据
|
| 186 |
+
const contacts = [
|
| 187 |
+
{
|
| 188 |
+
id: 1,
|
| 189 |
+
name: '李小红',
|
| 190 |
+
avatar: 'https://randomuser.me/api/portraits/women/12.jpg',
|
| 191 |
+
lastMessage: '好的,明天见!',
|
| 192 |
+
time: '12:30',
|
| 193 |
+
unread: 3,
|
| 194 |
+
online: true
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
id: 2,
|
| 198 |
+
name: '张小明',
|
| 199 |
+
avatar: 'https://randomuser.me/api/portraits/men/32.jpg',
|
| 200 |
+
lastMessage: '项目文档我已经发给你了',
|
| 201 |
+
time: '昨天',
|
| 202 |
+
unread: 0,
|
| 203 |
+
online: false
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
id: 3,
|
| 207 |
+
name: '王丽丽',
|
| 208 |
+
avatar: 'https://randomuser.me/api/portraits/women/44.jpg',
|
| 209 |
+
lastMessage: '周末一起去爬山吗?',
|
| 210 |
+
time: '昨天',
|
| 211 |
+
unread: 1,
|
| 212 |
+
online: true
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
id: 4,
|
| 216 |
+
name: '技术交流群',
|
| 217 |
+
avatar: 'https://randomuser.me/api/portraits/lego/3.jpg',
|
| 218 |
+
lastMessage: '张三: 这个问题可以这样解决...',
|
| 219 |
+
time: '周一',
|
| 220 |
+
unread: 5,
|
| 221 |
+
online: false
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
id: 5,
|
| 225 |
+
name: '赵老师',
|
| 226 |
+
avatar: 'https://randomuser.me/api/portraits/men/22.jpg',
|
| 227 |
+
lastMessage: '作业记得按时提交',
|
| 228 |
+
time: '周日',
|
| 229 |
+
unread: 0,
|
| 230 |
+
online: false
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
id: 6,
|
| 234 |
+
name: '刘阿姨',
|
| 235 |
+
avatar: 'https://randomuser.me/api/portraits/women/65.jpg',
|
| 236 |
+
lastMessage: '谢谢你的帮助!',
|
| 237 |
+
time: '上周',
|
| 238 |
+
unread: 0,
|
| 239 |
+
online: false
|
| 240 |
+
}
|
| 241 |
+
];
|
| 242 |
+
|
| 243 |
+
// 模拟消息数据
|
| 244 |
+
const messages = {
|
| 245 |
+
1: [
|
| 246 |
+
{
|
| 247 |
+
id: 1,
|
| 248 |
+
sender: 'other',
|
| 249 |
+
content: '嗨,最近怎么样?',
|
| 250 |
+
time: '12:20'
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
id: 2,
|
| 254 |
+
sender: 'me',
|
| 255 |
+
content: '还不错,你呢?',
|
| 256 |
+
time: '12:22'
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
id: 3,
|
| 260 |
+
sender: 'other',
|
| 261 |
+
content: '我也挺好的,明天有空一起吃饭吗?',
|
| 262 |
+
time: '12:25'
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
id: 4,
|
| 266 |
+
sender: 'me',
|
| 267 |
+
content: '好啊,几点?在哪里?',
|
| 268 |
+
time: '12:27'
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
id: 5,
|
| 272 |
+
sender: 'other',
|
| 273 |
+
content: '晚上6点,老地方见吧',
|
| 274 |
+
time: '12:28'
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
id: 6,
|
| 278 |
+
sender: 'me',
|
| 279 |
+
content: '没问题,明天见!',
|
| 280 |
+
time: '12:29'
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
id: 7,
|
| 284 |
+
sender: 'other',
|
| 285 |
+
content: '好的,明天见!',
|
| 286 |
+
time: '12:30'
|
| 287 |
+
}
|
| 288 |
+
],
|
| 289 |
+
2: [
|
| 290 |
+
{
|
| 291 |
+
id: 1,
|
| 292 |
+
sender: 'other',
|
| 293 |
+
content: '项目文档我已经发给你了',
|
| 294 |
+
time: '昨天 15:30'
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
id: 2,
|
| 298 |
+
sender: 'me',
|
| 299 |
+
content: '收到了,我看看',
|
| 300 |
+
time: '昨天 15:35'
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
id: 3,
|
| 304 |
+
sender: 'other',
|
| 305 |
+
content: '有什么问题随时问我',
|
| 306 |
+
time: '昨天 15:36'
|
| 307 |
+
}
|
| 308 |
+
],
|
| 309 |
+
3: [
|
| 310 |
+
{
|
| 311 |
+
id: 1,
|
| 312 |
+
sender: 'other',
|
| 313 |
+
content: '周末一起去爬山吗?',
|
| 314 |
+
time: '昨天 10:20'
|
| 315 |
+
}
|
| 316 |
+
]
|
| 317 |
+
};
|
| 318 |
+
|
| 319 |
+
// 当前选中的联系人ID
|
| 320 |
+
let currentContactId = 1;
|
| 321 |
+
|
| 322 |
+
// 渲染联系人列表
|
| 323 |
+
function renderContacts() {
|
| 324 |
+
const contactList = document.getElementById('contactList');
|
| 325 |
+
contactList.innerHTML = '';
|
| 326 |
+
|
| 327 |
+
contacts.forEach(contact => {
|
| 328 |
+
const contactItem = document.createElement('div');
|
| 329 |
+
contactItem.className = `flex items-center p-3 border-b border-gray-100 cursor-pointer hover:bg-gray-50 ${contact.id === currentContactId ? 'bg-gray-100' : ''}`;
|
| 330 |
+
contactItem.dataset.id = contact.id;
|
| 331 |
+
|
| 332 |
+
contactItem.innerHTML = `
|
| 333 |
+
<div class="relative">
|
| 334 |
+
<img src="${contact.avatar}" alt="头像" class="w-12 h-12 rounded-full">
|
| 335 |
+
${contact.online ? '<span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></span>' : ''}
|
| 336 |
+
</div>
|
| 337 |
+
<div class="ml-3 flex-1">
|
| 338 |
+
<div class="flex justify-between items-center">
|
| 339 |
+
<div class="font-semibold">${contact.name}</div>
|
| 340 |
+
<div class="text-xs text-gray-500">${contact.time}</div>
|
| 341 |
+
</div>
|
| 342 |
+
<div class="text-sm text-gray-500 truncate">${contact.lastMessage}</div>
|
| 343 |
+
</div>
|
| 344 |
+
${contact.unread > 0 ? `<div class="unread-badge">${contact.unread}</div>` : ''}
|
| 345 |
+
`;
|
| 346 |
+
|
| 347 |
+
contactItem.addEventListener('click', () => {
|
| 348 |
+
currentContactId = contact.id;
|
| 349 |
+
renderContacts();
|
| 350 |
+
renderMessages();
|
| 351 |
+
document.getElementById('chatTitle').textContent = contact.name;
|
| 352 |
+
|
| 353 |
+
// 清除未读消息
|
| 354 |
+
if (contact.unread > 0) {
|
| 355 |
+
contact.unread = 0;
|
| 356 |
+
renderContacts();
|
| 357 |
+
}
|
| 358 |
+
});
|
| 359 |
+
|
| 360 |
+
contactList.appendChild(contactItem);
|
| 361 |
+
});
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
// 渲染消息列表
|
| 365 |
+
function renderMessages() {
|
| 366 |
+
const messageArea = document.getElementById('messageArea');
|
| 367 |
+
const currentMessages = messages[currentContactId] || [];
|
| 368 |
+
|
| 369 |
+
// 清空消息区域
|
| 370 |
+
messageArea.innerHTML = '';
|
| 371 |
+
|
| 372 |
+
// 添加时间分隔线
|
| 373 |
+
const timeDivider = document.createElement('div');
|
| 374 |
+
timeDivider.className = 'flex items-center justify-center my-4';
|
| 375 |
+
timeDivider.innerHTML = `
|
| 376 |
+
<div class="h-px bg-gray-300 flex-1"></div>
|
| 377 |
+
<span class="px-2 text-xs text-gray-500 bg-gray-50 rounded-full">今天</span>
|
| 378 |
+
<div class="h-px bg-gray-300 flex-1"></div>
|
| 379 |
+
`;
|
| 380 |
+
messageArea.appendChild(timeDivider);
|
| 381 |
+
|
| 382 |
+
// 添加消息
|
| 383 |
+
currentMessages.forEach(message => {
|
| 384 |
+
const messageDiv = document.createElement('div');
|
| 385 |
+
messageDiv.className = `fade-in mb-3 flex ${message.sender === 'me' ? 'justify-end' : 'justify-start'}`;
|
| 386 |
+
|
| 387 |
+
if (message.sender === 'me') {
|
| 388 |
+
messageDiv.innerHTML = `
|
| 389 |
+
<div class="message-bubble sent px-4 py-2 text-sm">
|
| 390 |
+
${message.content}
|
| 391 |
+
<div class="text-right mt-1 text-xs text-gray-600">${message.time}</div>
|
| 392 |
+
</div>
|
| 393 |
+
`;
|
| 394 |
+
} else {
|
| 395 |
+
const contact = contacts.find(c => c.id === currentContactId);
|
| 396 |
+
messageDiv.innerHTML = `
|
| 397 |
+
<img src="${contact.avatar}" alt="头像" class="w-8 h-8 rounded-full mr-2 self-end">
|
| 398 |
+
<div class="message-bubble received px-4 py-2 text-sm">
|
| 399 |
+
${message.content}
|
| 400 |
+
<div class="text-right mt-1 text-xs text-gray-600">${message.time}</div>
|
| 401 |
+
</div>
|
| 402 |
+
`;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
messageArea.appendChild(messageDiv);
|
| 406 |
+
});
|
| 407 |
+
|
| 408 |
+
// 滚动到底部
|
| 409 |
+
messageArea.scrollTop = messageArea.scrollHeight;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
// 发送消息
|
| 413 |
+
function sendMessage() {
|
| 414 |
+
const input = document.getElementById('messageInput');
|
| 415 |
+
const content = input.value.trim();
|
| 416 |
+
|
| 417 |
+
if (content) {
|
| 418 |
+
// 获取当前时间
|
| 419 |
+
const now = new Date();
|
| 420 |
+
const hours = now.getHours().toString().padStart(2, '0');
|
| 421 |
+
const minutes = now.getMinutes().toString().padStart(2, '0');
|
| 422 |
+
const timeStr = `${hours}:${minutes}`;
|
| 423 |
+
|
| 424 |
+
// 创建新消息
|
| 425 |
+
const newMessage = {
|
| 426 |
+
id: Date.now(),
|
| 427 |
+
sender: 'me',
|
| 428 |
+
content: content,
|
| 429 |
+
time: timeStr
|
| 430 |
+
};
|
| 431 |
+
|
| 432 |
+
// 添加到消息列表
|
| 433 |
+
if (!messages[currentContactId]) {
|
| 434 |
+
messages[currentContactId] = [];
|
| 435 |
+
}
|
| 436 |
+
messages[currentContactId].push(newMessage);
|
| 437 |
+
|
| 438 |
+
// 清空输入框
|
| 439 |
+
input.value = '';
|
| 440 |
+
|
| 441 |
+
// 重新渲染消息
|
| 442 |
+
renderMessages();
|
| 443 |
+
|
| 444 |
+
// 模拟回复
|
| 445 |
+
setTimeout(() => {
|
| 446 |
+
const contact = contacts.find(c => c.id === currentContactId);
|
| 447 |
+
const replyMessage = {
|
| 448 |
+
id: Date.now(),
|
| 449 |
+
sender: 'other',
|
| 450 |
+
content: getRandomReply(),
|
| 451 |
+
time: `${hours}:${(now.getMinutes() + 1).toString().padStart(2, '0')}`
|
| 452 |
+
};
|
| 453 |
+
|
| 454 |
+
messages[currentContactId].push(replyMessage);
|
| 455 |
+
renderMessages();
|
| 456 |
+
|
| 457 |
+
// 更新联系人列表的最后消息
|
| 458 |
+
contact.lastMessage = replyMessage.content;
|
| 459 |
+
contact.time = timeStr;
|
| 460 |
+
renderContacts();
|
| 461 |
+
}, 1000 + Math.random() * 2000);
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
// 随机回复
|
| 466 |
+
function getRandomReply() {
|
| 467 |
+
const replies = [
|
| 468 |
+
'好的',
|
| 469 |
+
'明白了',
|
| 470 |
+
'谢谢',
|
| 471 |
+
'我知道了',
|
| 472 |
+
'没问题',
|
| 473 |
+
'稍等',
|
| 474 |
+
'正在处理',
|
| 475 |
+
'一会回复你',
|
| 476 |
+
'这个主意不错',
|
| 477 |
+
'可以',
|
| 478 |
+
'不行',
|
| 479 |
+
'让我想想',
|
| 480 |
+
'明天再说吧',
|
| 481 |
+
'周末有空吗?',
|
| 482 |
+
'最近怎么样?'
|
| 483 |
+
];
|
| 484 |
+
return replies[Math.floor(Math.random() * replies.length)];
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
// 初始化
|
| 488 |
+
renderContacts();
|
| 489 |
+
renderMessages();
|
| 490 |
+
|
| 491 |
+
// 事件监听
|
| 492 |
+
document.getElementById('sendButton').addEventListener('click', sendMessage);
|
| 493 |
+
|
| 494 |
+
document.getElementById('messageInput').addEventListener('keypress', function(e) {
|
| 495 |
+
if (e.key === 'Enter' && !e.shiftKey) {
|
| 496 |
+
e.preventDefault();
|
| 497 |
+
sendMessage();
|
| 498 |
+
}
|
| 499 |
+
});
|
| 500 |
+
|
| 501 |
+
// 输入框自动调整高度
|
| 502 |
+
document.getElementById('messageInput').addEventListener('input', function() {
|
| 503 |
+
this.style.height = 'auto';
|
| 504 |
+
this.style.height = (this.scrollHeight) + 'px';
|
| 505 |
+
});
|
| 506 |
+
});
|
| 507 |
+
</script>
|
| 508 |
+
<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=cogobim591/mm" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 509 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
开发一个类似微信这样的网页版聊天软件,网站必须功能齐全高端专业实际
|