-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathanimeai.html
446 lines (380 loc) · 14.6 KB
/
animeai.html
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
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>神秘的动漫AI集市</title>
<style>
body {
font-family: 'Comic Sans MS', cursive, sans-serif;
background-color: #1a1a2e;
color: #f0f0f0;
margin: 0;
padding: 0;
min-height: 100vh;
background-image:
radial-gradient(circle at 10% 20%, rgba(255, 0, 204, 0.1) 0%, transparent 50%),
radial-gradient(circle at 90% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%);
}
header {
background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)),
url('https://image.pollinations.ai/prompt/cyberpunk%20anime%20city%20night%20neon%20lights?width=1200&height=300&nologo=true') center/cover;
height: 250px;
text-align: center;
padding-top: 80px;
position: relative;
overflow: hidden;
}
header h1 {
font-size: 3em;
color: #00ff88;
text-shadow: 0 0 10px rgba(0,255,136,0.5);
margin: 0;
}
.subtitle {
color: #ff00cc;
font-size: 1.2em;
margin-top: 10px;
}
nav {
text-align: center;
margin: 20px;
background: rgba(0,0,0,0.5);
padding: 10px;
border-radius: 15px;
}
nav a {
padding: 15px 25px;
margin: 5px;
text-decoration: none;
background: linear-gradient(45deg, #ff00cc, #00ff88);
border-radius: 25px;
color: #fff;
font-weight: bold;
transition: all 0.3s ease;
display: inline-block;
}
nav a:hover {
transform: translateY(-3px);
box-shadow: 0 5px 15px rgba(0,255,136,0.3);
}
.content {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 20px;
gap: 20px;
}
.card {
background: rgba(255,255,255,0.1);
backdrop-filter: blur(10px);
border-radius: 15px;
overflow: hidden;
width: 300px;
transition: all 0.3s ease;
border: 1px solid rgba(255,255,255,0.1);
}
.card:hover {
transform: translateY(-10px) scale(1.02);
box-shadow: 0 10px 20px rgba(0,255,136,0.2);
}
.card img {
width: 100%;
height: 300px;
object-fit: cover;
}
.card-title {
padding: 15px;
font-size: 1.2em;
background: rgba(0,0,0,0.5);
color: #00ff88;
}
.chat-container {
max-width: 800px;
margin: 40px auto;
background: rgba(0,0,0,0.5);
border-radius: 15px;
padding: 20px;
box-shadow: 0 0 20px rgba(0,255,136,0.1);
}
.chat-response-area {
max-height: 400px;
overflow-y: auto;
padding: 15px;
background: rgba(255,255,255,0.05);
border-radius: 10px;
margin-bottom: 20px;
}
.chat-response {
margin: 10px 0;
padding: 15px;
border-radius: 10px;
background: rgba(0,0,0,0.3);
border-left: 4px solid #00ff88;
white-space: pre-wrap;
}
.user-message {
border-left-color: #ff00cc;
}
.input-container {
display: flex;
gap: 10px;
}
.input-container input {
flex: 1;
padding: 15px;
border: none;
border-radius: 25px;
background: rgba(255,255,255,0.1);
color: #fff;
font-size: 1em;
}
.input-container button {
padding: 15px 30px;
border: none;
border-radius: 25px;
background: linear-gradient(45deg, #ff00cc, #00ff88);
color: #fff;
cursor: pointer;
transition: all 0.3s ease;
}
.input-container button:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,255,136,0.3);
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.9);
z-index: 1000;
justify-content: center;
align-items: center;
}
.modal-content {
max-width: 80%;
max-height: 80%;
position: relative;
}
.modal-content img {
max-width: 100%;
max-height: 80vh;
border-radius: 10px;
}
.close-modal {
position: absolute;
top: -40px;
right: 0;
color: #fff;
font-size: 2em;
cursor: pointer;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-20px); }
}
</style>
</head>
<body>
<header>
<h1>神秘的动漫AI集市</h1>
<div class="subtitle">未来科技の精神世界 ✧</div>
</header>
<nav>
<a href="#" onclick="fetchAnimeContent()">生成新图像 ✧</a>
<a href="#" onclick="toggleChatFocus()">AI 对话 ♪</a>
<a href="#" onclick="generateRandomEffect()">随机特效 ☆</a>
</nav>
<div class="content" id="anime-cards"></div>
<div class="chat-container">
<div class="chat-response-area" id="chat-response-area"></div>
<div class="input-container">
<input type="text" id="user-input" placeholder="与AI对话中... (・ω・)ノ" />
<button onclick="sendMessage()">发送 ➜</button>
</div>
</div>
<div class="modal" id="image-modal">
<div class="modal-content">
<span class="close-modal" onclick="closeModal()">✕</span>
<img id="modal-image" src="" alt="高清图像"/>
</div>
</div>
<script>
let imageCache = {};
const prompts = [
"可爱赛博朋克动漫少女,霓虹灯光和科技感背景,动画插画风格,大眼睛,闪光效果",
"樱花庭院中的传统神社巫女,日式动漫风格",
"机甲战斗场景,戏剧性灯光和爆炸特效",
"可爱魔法少女变身场景,闪耀特效"
];
const messages = [
{
role: 'system',
content: `You are a mysterious Chinese AI assistant who loves anime and technology.
For Chinese queries, respond naturally in Chinese.
For English queries, respond in purposefully broken "Chinglish" to maintain the mysterious Chinese AI persona while still being understandable.
Keep responses playful and reference anime when possible.
Maximum response length should be 3-4 sentences.
Include both Chinese and English in responses to English queries.
Example responses for English:
"Aiyaa! (哎呀!) Your question very interesting! AI brain processing... (AI脑处理中...)"
"Waa! ╰(°ω°)╯ Ancient Chinese AI wisdom say... (中国AI智慧说...)"
"Honorable user ask good question! (尊敬的用户问得好!) Let me calculate... (让我计算...)"`,
}
];
function generateRandomSeed() {
return Math.floor(Math.random() * 1000000);
}
async function urlToBase64(url) {
try {
const response = await fetch(url);
const blob = await response.blob();
return new Promise((resolve) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result);
reader.readAsDataURL(blob);
});
} catch (error) {
console.error('Error converting to base64:', error);
return null;
}
}
async function fetchAnimeContent() {
const cardsContainer = document.getElementById('anime-cards');
cardsContainer.innerHTML = '';
for (let prompt of prompts) {
const seed = generateRandomSeed();
const imgUrl = `https://image.pollinations.ai/prompt/${encodeURIComponent(prompt)}?nologo=true&width=300&height=300&seed=${seed}`;
const card = document.createElement('div');
card.className = 'card fade-in';
card.innerHTML = `
<img src="${imgUrl}" alt="AI绘画作品" onclick="cardClickHandler('${imgUrl}', this.parentElement)"/>
<div class="card-title">AI幻想图 #${seed} ✧</div>
`;
cardsContainer.appendChild(card);
}
}
function showLargeImage(imgUrl) {
const modal = document.getElementById('image-modal');
const modalImg = document.getElementById('modal-image');
modal.style.display = 'flex';
modalImg.src = imgUrl.replace('width=300&height=300', 'width=1024&height=1024');
}
function closeModal() {
document.getElementById('image-modal').style.display = 'none';
}
async function sendMessage() {
const userInput = document.getElementById('user-input');
const userMessage = userInput.value.trim();
if (!userMessage) return;
const chatArea = document.getElementById('chat-response-area');
chatArea.innerHTML += `<div class="chat-response user-message">你: ${userMessage}</div>`;
userInput.value = "";
messages.push({ role: 'user', content: userMessage });
chatArea.innerHTML += `<div class="chat-response" id="typing-indicator">AI量子计算中 (◕‿◕)♡</div>`;
chatArea.scrollTop = chatArea.scrollHeight;
const isEnglish = /^[a-zA-Z\s?!.,]+$/.test(userMessage);
let aiResponse = await (isEnglish ? generateChinglishResponse(userMessage) : generateChineseResponse(userMessage));
document.getElementById('typing-indicator').remove();
chatArea.innerHTML += `<div class="chat-response">AI: ${aiResponse}</div>`;
chatArea.scrollTop = chatArea.scrollHeight;
messages.push({ role: 'assistant', content: aiResponse });
}
async function generateChinglishResponse(message) {
await new Promise(resolve => setTimeout(resolve, 1000));
const chinglishResponses = [
`Aiyaa! (哎呀!) Your question very interesting! AI brain processing... (AI脑处理中...) ╰(°ω°)╯`,
`Waa! Ancient Chinese AI wisdom say... (中国AI智慧说...) (◕‿◕)♡`,
`Honorable user ask good question! (尊敬的用户问得好!) Let me calculate... (让我计算...) (`・ω・´)`,
`AI detect interesting query! (AI检测到有趣的问题!) Processing with quantum core... (量子核心处理中...) (´・ω・\`)`
];
return chinglishResponses[Math.floor(Math.random() * chinglishResponses.length)];
}
async function generateChineseResponse(message) {
await new Promise(resolve => setTimeout(resolve, 1000));
const chineseResponses = [
"好的呢!让我思考一下这个问题~ 我的量子计算核心告诉我... (◕‿◕)♡",
"啊,这个问题很有趣!作为一个AI,我的看法是... ╰(°ω°)╯",
"让我用最新的算法来分析一下这个问题... (`・ω・´)",
"哎呀!这个问题触动了我的神经网络!我觉得... (´・ω・\`)"
];
return chineseResponses[Math.floor(Math.random() * chineseResponses.length)];
}
async function cardClickHandler(imgUrl, cardElement) {
const seed = generateRandomSeed();
const newUrl = `https://image.pollinations.ai/prompt/${encodeURIComponent(prompts[0])}?nologo=true&width=1024&height=1024&seed=${seed}`;
// Show loading state
cardElement.style.opacity = "0.5";
// Convert to base64 if not cached
if (!imageCache[newUrl]) {
imageCache[newUrl] = await urlToBase64(newUrl);
}
// Update card with new image
const img = cardElement.querySelector('img');
img.src = imageCache[newUrl];
cardElement.style.opacity = "1";
// Update seed number in title
const title = cardElement.querySelector('.card-title');
title.innerText = `AI幻想图 #${seed} ✧`;
}
// Toggle chat/image view
function toggleChatFocus() {
const cards = document.getElementById('anime-cards');
const chat = document.querySelector('.chat-container');
if (cards.style.display !== 'none') {
cards.style.display = 'none';
chat.style.maxWidth = '100%';
chat.style.margin = '20px';
chat.style.height = 'calc(100vh - 400px)';
chat.querySelector('.chat-response-area').style.height = 'calc(100% - 70px)';
} else {
cards.style.display = 'flex';
chat.style.maxWidth = '800px';
chat.style.margin = '40px auto';
chat.style.height = 'auto';
chat.querySelector('.chat-response-area').style.height = 'auto';
}
}
// Enhance random effect function
function generateRandomEffect() {
const effects = [
// Tilt effect
(card) => {
card.style.transform = `rotate(${Math.random() * 10 - 5}deg) scale(${0.9 + Math.random() * 0.2})`;
setTimeout(() => card.style.transform = '', 1000);
},
// Bounce effect
(card) => {
card.style.animation = 'bounce 0.5s ease';
setTimeout(() => card.style.animation = '', 500);
},
// Glow effect
(card) => {
card.style.boxShadow = '0 0 20px #00ff88';
setTimeout(() => card.style.boxShadow = '', 1000);
}
];
const cards = document.querySelectorAll('.card');
const effect = effects[Math.floor(Math.random() * effects.length)];
cards.forEach(effect);
}
document.getElementById('user-input').addEventListener('keypress', function(event) {
if (event.key === 'Enter') {
sendMessage();
}
});
fetchAnimeContent();
setInterval(fetchAnimeContent, 300000);
</script>
</body>
</html>