-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
593 lines (550 loc) · 17.6 KB
/
Copy pathindex.html
File metadata and controls
593 lines (550 loc) · 17.6 KB
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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DeepSeek API 定价 · 时段计费面板</title>
<link rel="icon" type="image/webp" href="favicon.webp" />
<style>
:root {
--accent: #3aa0f0; /* 主蓝色:空闲时段 */
--accent-soft: rgba(74, 165, 245, 0.14);
--accent-line: rgba(74, 165, 245, 0.38);
--peak: #ffb020; /* 高峰琥珀色 */
--peak-soft: rgba(255, 176, 32, 0.12);
--peak-line: rgba(255, 176, 32, 0.36);
--bar: linear-gradient(90deg, #3fa9e8, #2f9fe6); /* 阶段进度条 */
--text: #e8f1f8;
--muted: #9db4c9; /* 蓝调中性灰 */
--dim: #7d93a9;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
"Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
color: var(--text);
background: #0a1610;
background-image: radial-gradient(1400px 900px at 50% 0%, #132c40 0%, #0e2233 48%, #0a1610 100%);
background-attachment: fixed;
display: flex;
align-items: center;
justify-content: center;
min-height: 100%;
padding: 18px;
-webkit-font-smoothing: antialiased;
}
/* ---------- 整体大面板 ---------- */
.app {
display: flex;
width: 100%;
min-height: 100vh;
max-width: 1560px;
background: linear-gradient(175deg, #16324a 0%, #11283c 55%, #0b1a2b 100%);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 24px;
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
overflow: hidden;
}
/* ---------- 左栏:状态区 ---------- */
.panel.left {
flex: 1 1 50%;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 36px 48px;
border-right: 1px solid rgba(255, 255, 255, 0.05);
}
/* 时钟 */
.clock-row {
display: flex;
align-items: baseline;
justify-content: center;
gap: 14px;
flex-wrap: wrap;
}
.clock {
font-size: 56px;
font-weight: 700;
letter-spacing: 0.5px;
line-height: 1;
font-variant-numeric: tabular-nums;
color: #ffffff;
text-shadow: 0 0 24px rgba(58, 160, 240, 0.22);
}
.clock-date {
font-size: 18px;
color: var(--muted);
letter-spacing: 0.5px;
font-variant-numeric: tabular-nums;
}
.status-line {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
margin-top: 14px;
font-size: 15px;
color: var(--text);
}
.status-line .dot {
width: 10px; height: 10px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 5px var(--accent-soft);
flex: 0 0 auto;
}
.time-note {
margin-top: 8px;
text-align: center;
font-size: 12px;
color: var(--dim);
}
/* 阶段进度条(语义不变) */
.window-block { margin-top: 24px; width: 100%; max-width: 460px; }
.window-bar {
display: flex;
align-items: center;
gap: 12px;
}
.bar-label {
font-size: 13px;
font-weight: 600;
color: var(--muted);
white-space: nowrap;
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 6px;
}
.bar-label .glyph {
width: 7px; height: 7px;
border-radius: 50%;
background: var(--accent);
display: inline-block;
}
.bar-label.now-peak { color: var(--peak); }
.bar-label.now-peak .glyph { background: var(--peak); }
.bar-track {
position: relative;
flex: 1 1 auto;
height: 10px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.09);
overflow: visible;
}
.bar-fill {
position: absolute;
top: 0; bottom: 0; left: 0;
border-radius: 999px;
background: var(--bar);
box-shadow: 0 0 14px rgba(63, 169, 232, 0.55);
transition: width 1s linear;
}
.playhead {
position: absolute;
top: 50%;
width: 12px; height: 12px;
background: #ffffff;
border: 2px solid rgba(0, 0, 0, 0.35);
border-radius: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
z-index: 3;
transition: left 1s linear;
}
.bar-countdown {
font-size: 13px;
color: var(--muted);
font-variant-numeric: tabular-nums;
white-space: nowrap;
flex: 0 0 auto;
}
/* 居中头像 + 名称 + 徽章 */
.mascot-wrap { margin-top: 24px; }
.avatar {
width: 150px; height: 150px;
border-radius: 18px;
overflow: hidden;
background: transparent;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.name {
margin-top: 16px;
text-align: center;
font-size: 34px;
font-weight: 800;
letter-spacing: 2px;
color: var(--accent);
}
.badge {
margin: 12px auto 0;
display: table;
font-size: 14px;
font-weight: 600;
color: var(--accent);
background: var(--accent-soft);
border: 1px solid var(--accent-line);
padding: 8px 22px;
border-radius: 999px;
}
.badge.peak {
color: var(--peak);
background: var(--peak-soft);
border-color: var(--peak-line);
}
/* ---------- 右栏:价格表 ---------- */
.panel.right {
flex: 1 1 50%;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 36px 48px;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}
.right-inner {
width: 100%;
max-width: 640px;
margin: auto;
display: flex;
flex-direction: column;
}
.table-title {
text-align: center;
font-size: 16px;
color: var(--muted);
letter-spacing: 0.3px;
}
.price-toggle {
display: flex;
justify-content: center;
gap: 6px;
margin-top: 14px;
}
.price-toggle button {
font-family: inherit;
font-size: 13px;
color: var(--dim);
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
padding: 6px 16px;
border-radius: 999px;
cursor: pointer;
transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.price-toggle button.on {
color: var(--accent);
border-color: var(--accent-line);
background: var(--accent-soft);
}
.price-toggle button:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* 表格放入浅色容器,与左侧同质感 */
.table-card {
margin-top: 16px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 16px;
padding: 10px 22px 14px;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
table {
width: 100%;
border-collapse: collapse;
font-variant-numeric: tabular-nums;
}
thead th {
font-size: 15px;
font-weight: 600;
color: var(--dim);
text-align: right;
padding: 16px 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
thead th:first-child { text-align: left; }
tbody td {
font-size: 20px;
text-align: right;
padding: 20px 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
tbody tr:last-child td { border-bottom: none; }
tbody td:first-child {
text-align: left;
color: var(--accent);
font-weight: 600;
font-size: 18px;
font-family: Menlo, Consolas, "Segoe UI Mono", monospace;
}
tbody td.num { color: var(--accent); font-weight: 600; }
.footer {
margin-top: 20px;
text-align: center;
font-size: 12px;
color: var(--dim);
}
/* 窄屏回退成上下堆叠 */
@media (max-width: 880px) {
body { padding: 12px; }
.app { flex-direction: column; min-height: auto; border-radius: 18px; }
.panel.left, .panel.right { flex: 1 1 auto; padding: 32px 22px; }
.panel.left { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.05); }
.clock { font-size: 44px; }
}
</style>
</head>
<body>
<div class="app">
<!-- 左栏:状态区 -->
<section class="panel left">
<div class="clock-row">
<div class="clock" id="clock">--:--:--</div>
<div class="clock-date" id="clockDate">---- --</div>
</div>
<div class="status-line">
<span class="dot"></span>
<span id="statusText">--</span>
</div>
<div class="time-note" id="timeNote">高峰时段:北京时间 周一至周五 9:00–12:00、14:00–18:00</div>
<div class="window-block">
<div class="window-bar">
<div class="bar-label" id="barLabel"><span class="glyph"></span>低谷时段</div>
<div class="bar-track">
<div class="bar-fill" id="barFill"></div>
<div class="playhead" id="playhead"></div>
</div>
<div class="bar-countdown" id="countdown">--</div>
</div>
</div>
<div class="mascot-wrap">
<div class="avatar">
<img id="mascotImg" src="mascot_valley.png" alt="梁文谷头像" />
</div>
</div>
<div class="name" id="name">梁文谷</div>
<div class="badge" id="badge">--</div>
</section>
<!-- 右栏:价格表 -->
<section class="panel right">
<div class="right-inner">
<div class="table-title" id="tableTitle">价格单位:元 / 百万 tokens</div>
<div class="price-toggle" id="priceToggle">
<button data-mode="auto" class="on">自动(跟随时段)</button>
<button data-mode="valley">空闲价</button>
<button data-mode="peak">高峰价</button>
</div>
<div class="table-card">
<table>
<thead>
<tr>
<th>模型</th>
<th>输入(缓存命中)</th>
<th>输入(缓存未命中)</th>
<th>输出</th>
</tr>
</thead>
<tbody id="priceRows"></tbody>
</table>
</div>
<div class="footer">数据来源:DeepSeek API 官方文档(api-docs.deepseek.com)</div>
</div>
</section>
</div>
<script>
(function () {
"use strict";
/* =========================================================
* 价格配置(单位:元 / 百万 tokens)
* 值取自 DeepSeek 官方定价:
* 空闲时段 = 高峰时段的一半
* 高峰时段 = 北京时间周一至周五 9:00–12:00、14:00–18:00
* ========================================================= */
var MODELS = [
{
name: "deepseek-v4-flash",
valley: { hit: 0.05, miss: 1.5, output: 4.5 },
peak: { hit: 0.10, miss: 3.0, output: 9.0 }
},
{
name: "deepseek-v4-pro",
valley: { hit: 0.15, miss: 4.5, output: 13.5 },
peak: { hit: 0.30, miss: 9.0, output: 27.0 }
},
{
name: "deepseek-v4-flash-vision-exp",
valley: { hit: 0.05, miss: 1.5, output: 4.5 },
peak: { hit: 0.10, miss: 3.0, output: 9.0 }
}
];
/* 高峰时段:北京时间周一至周五 9:00–12:00 与 14:00–18:00;其余时间均为空闲(谷)时段 */
var PEAK_WINDOWS = [
{ start: 9 * 60, end: 12 * 60 }, // 09:00 – 12:00
{ start: 14 * 60, end: 18 * 60 } // 14:00 – 18:00
];
var WEEK = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
var el = {
clock: document.getElementById("clock"),
clockDate: document.getElementById("clockDate"),
statusText: document.getElementById("statusText"),
barLabel: document.getElementById("barLabel"),
barFill: document.getElementById("barFill"),
playhead: document.getElementById("playhead"),
countdown: document.getElementById("countdown"),
badge: document.getElementById("badge"),
name: document.getElementById("name"),
mascotImg: document.getElementById("mascotImg"),
tableTitle: document.getElementById("tableTitle"),
rows: document.getElementById("priceRows")
};
var mode = "auto"; // auto | valley | peak
// 预加载两张头像,避免时段切换时闪烁
["mascot_valley.png", "mascot_peak.png"].forEach(function (src) {
var img = new Image();
img.src = src;
});
function pad(n) { return String(n).padStart(2, "0"); }
function isWeekend(d) {
var w = d.getDay();
return w === 0 || w === 6;
}
function minutesOfDay(d) {
return d.getHours() * 60 + d.getMinutes() + d.getSeconds() / 60;
}
// 高峰 = 周一至周五处于任一高峰窗口内;其余(含周末)一律为空闲(谷)
function isPeakTime(now) {
if (isWeekend(now)) return false;
var m = minutesOfDay(now);
for (var i = 0; i < PEAK_WINDOWS.length; i++) {
var w = PEAK_WINDOWS[i];
if (m >= w.start && m < w.end) return true;
}
return false;
}
function isValley(now) { return !isPeakTime(now); }
// 当前时刻所处阶段:'peak' | 'valley'
function phaseAt(d) {
if (isPeakTime(d)) return "peak";
return "valley";
}
// 真实阶段切换点只发生在工作日 9:00/12:00/14:00/18:00(其余时间空闲连续跨越午夜/周末)
function boundaryMins(day) {
if (isWeekend(day)) return [];
return [540, 720, 840, 1080]; // 9:00, 12:00, 14:00, 18:00
}
function mapDay(d, m0) {
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), Math.floor(m0 / 60), m0 % 60, 0);
}
// 相邻阶段边界:leftBoundary = 当前段开始时刻,rightBoundary = 当前段结束时刻
function boundaries(now) {
var d = new Date(now.getFullYear(), now.getMonth(), now.getDate());
var before = [], after = [];
for (var k = -7; k <= 7; k++) {
var day = new Date(d.getFullYear(), d.getMonth(), d.getDate() + k);
var ms = boundaryMins(day);
for (var i = 0; i < ms.length; i++) {
var t = mapDay(day, ms[i]);
if (t.getTime() <= now.getTime()) before.push(t);
else after.push(t);
}
}
if (before.length) before.sort(function (a, b) { return a - b; });
if (after.length) after.sort(function (a, b) { return a - b; });
var left = before.length ? before[before.length - 1] : null;
var right = after.length ? after[0] : null;
return { left: left, right: right };
}
function diffText(a, b) {
var ms = Math.max(0, b.getTime() - a.getTime());
var totalSec = Math.floor(ms / 1000);
var sec = totalSec % 60;
var totalMin = Math.floor(totalSec / 60);
var min = totalMin % 60;
var h = Math.floor(totalMin / 60) % 24;
var days = Math.floor(totalMin / 1440);
var parts = [];
if (days > 0) parts.push(days + "天");
if (h > 0 || days > 0) parts.push(h + "小时");
if (min > 0 || h > 0 || days > 0) parts.push(min + "分");
parts.push(sec + "秒");
return parts.join("");
}
function renderPrices(valley) {
var html = MODELS.map(function (m) {
var p = valley ? m.valley : m.peak;
function f(x) { return (Math.round(x * 100) / 100).toString(); }
return "<tr>" +
"<td>" + m.name + "</td>" +
'<td class="num">' + f(p.hit) + "</td>" +
'<td class="num">' + f(p.miss) + "</td>" +
'<td class="num">' + f(p.output) + "</td>" +
"</tr>";
}).join("");
el.rows.innerHTML = html;
}
function render() {
var now = new Date();
var valley = isValley(now);
var wk = isWeekend(now);
// 时钟 + 日期
el.clock.textContent = pad(now.getHours()) + ":" + pad(now.getMinutes()) + ":" + pad(now.getSeconds());
el.clockDate.textContent =
now.getFullYear() + "-" + pad(now.getMonth() + 1) + "-" + pad(now.getDate()) + " " + WEEK[now.getDay()];
// 状态行
el.statusText.textContent = wk
? "今日周末,全天按空闲(谷)时段计费"
: "今日工作日,高峰时段 09:00–12:00、14:00–18:00";
// 徽章 + 名字 + 头像
if (valley) {
el.badge.textContent = "当前处于空闲(谷)时段";
el.badge.classList.remove("peak");
el.barLabel.classList.remove("now-peak");
el.barLabel.innerHTML = '<span class="glyph"></span>低谷时段';
el.name.textContent = "梁文谷";
el.mascotImg.src = "mascot_valley.png";
} else {
el.badge.textContent = "当前处于高峰时段";
el.badge.classList.add("peak");
el.barLabel.classList.add("now-peak");
el.barLabel.innerHTML = '<span class="glyph"></span>高峰时段';
el.name.textContent = "梁文峰";
el.mascotImg.src = "mascot_peak.png";
}
// 进度条 = 从「本段开始」到「本段结束」的完成度;右侧倒计时到下一个阶段
var bd = boundaries(now);
var segStart = bd.left ? bd.left.getTime() : now.getTime();
var segEnd = bd.right ? bd.right.getTime() : now.getTime() + 1;
var total = segEnd - segStart;
var prog = total > 0 ? (now.getTime() - segStart) / total : 0;
prog = Math.max(0, Math.min(1, prog));
el.barFill.style.width = (prog * 100) + "%";
el.playhead.style.left = (prog * 100) + "%";
el.countdown.textContent = bd.right
? "距" + (phaseAt(bd.right) === "peak" ? "高峰时段" : "低谷时段") + "还有 " + diffText(now, bd.right)
: "--";
// 价格表
var showValley = mode === "valley" || (mode === "auto" && valley);
el.tableTitle.textContent = "价格单位:元 / 百万 tokens(" + (showValley ? "空闲时段" : "高峰时段") + ")";
renderPrices(showValley);
}
// 价格切换
document.getElementById("priceToggle").addEventListener("click", function (e) {
var b = e.target.closest("button");
if (!b) return;
mode = b.dataset.mode;
document.querySelectorAll("#priceToggle button").forEach(function (x) { x.classList.remove("on"); });
b.classList.add("on");
render();
});
render();
setInterval(render, 1000);
})();
</script>
</body>
</html>