coding-proxy 0.5.2a5__py3-none-any.whl → 0.5.2a6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coding/proxy/server/dashboard.py +44 -61
- {coding_proxy-0.5.2a5.dist-info → coding_proxy-0.5.2a6.dist-info}/METADATA +1 -1
- {coding_proxy-0.5.2a5.dist-info → coding_proxy-0.5.2a6.dist-info}/RECORD +6 -6
- {coding_proxy-0.5.2a5.dist-info → coding_proxy-0.5.2a6.dist-info}/WHEEL +0 -0
- {coding_proxy-0.5.2a5.dist-info → coding_proxy-0.5.2a6.dist-info}/entry_points.txt +0 -0
- {coding_proxy-0.5.2a5.dist-info → coding_proxy-0.5.2a6.dist-info}/licenses/LICENSE +0 -0
coding/proxy/server/dashboard.py
CHANGED
|
@@ -11,86 +11,73 @@ from fastapi.responses import HTMLResponse, Response
|
|
|
11
11
|
|
|
12
12
|
from ..logging.db import TimePeriod
|
|
13
13
|
|
|
14
|
-
# ── 品牌图标:Tabler
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
|
|
14
|
+
# ── 品牌图标:Tabler prompt 核心笔划(> 与 _)+ 通透青绿圆环 ──────────────
|
|
15
|
+
# 设计(方案 d05):全透明底 + 青绿渐变细圆环(stroke 0.5,仅原 1/3,通透若隐)+
|
|
16
|
+
# 饱和青绿渐变 >_ 笔划(stroke 2.5)。极细环与饱和笔划形成权重对比,>_ 为绝对主角;
|
|
17
|
+
# 青绿(#22d3ee -> #2dd4bf)承载终端/代码语义,通透明快。基础笔划取自 Tabler prompt
|
|
18
|
+
# (chevron M5 7l5 5l-5 5 + 下划线 M13 17l6 0,下划线长 6 单位、不会小尺寸点化)。
|
|
19
|
+
# 渐变用 gradientUnits="userSpaceOnUse" + 绝对坐标:纯水平下划线包围盒高度为 0,若用
|
|
20
|
+
# 默认 objectBoundingBox 渐变会映射失效而不着色(下划线消失),userSpaceOnUse 规避。
|
|
21
|
+
# 单一事实源:_PROMPT_PATHS 与 _LOGO_DEFS 同时供 favicon SVG(f-string)与页面
|
|
22
|
+
# logo({{PROMPT}} / {{LOGO_DEFS}} 模板替换)消费。
|
|
23
|
+
_BRAND_FROM, _BRAND_TO = "#22d3ee", "#2dd4bf"
|
|
22
24
|
_LOGO_DEFS = (
|
|
23
|
-
'<defs><linearGradient id="cpBrand"
|
|
25
|
+
'<defs><linearGradient id="cpBrand" gradientUnits="userSpaceOnUse" '
|
|
26
|
+
'x1="4" y1="4" x2="20" y2="20">'
|
|
24
27
|
f'<stop offset="0" stop-color="{_BRAND_FROM}"/>'
|
|
25
28
|
f'<stop offset="1" stop-color="{_BRAND_TO}"/>'
|
|
26
29
|
"</linearGradient></defs>"
|
|
27
30
|
)
|
|
28
|
-
|
|
31
|
+
_PROMPT_PATHS = '<path d="M5 7l5 5l-5 5" /><path d="M13 17l6 0" />'
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
# ── Favicon (SVG, 现代浏览器主选) ──────────────────────────────────────────
|
|
32
35
|
def _build_favicon_svg() -> str:
|
|
33
|
-
"""生成 24×24 SVG favicon
|
|
36
|
+
"""生成 24×24 SVG favicon:通透青绿圆环 + 品牌渐变 prompt 笔划(方案 d05).
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
``
|
|
38
|
+
全透明底 + 青绿渐变细圆环(``r=11``、``stroke-width=0.5``、``stroke-opacity=.55``,
|
|
39
|
+
通透若隐)+ 饱和青绿渐变 ``>`` 与 ``_`` 笔划(``stroke-width=2.5``)。极细环与饱和
|
|
40
|
+
笔划形成权重对比,``>_`` 为视觉主角。独立 SVG 文档无 CSS 上下文,``currentColor``
|
|
41
|
+
不可靠,故渐变复用 ``_LOGO_DEFS``(userSpaceOnUse,规避水平下划线不着色)单一事实源。
|
|
38
42
|
"""
|
|
39
43
|
return (
|
|
40
44
|
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">'
|
|
41
45
|
f"{_LOGO_DEFS}"
|
|
42
|
-
'<
|
|
43
|
-
'stroke="
|
|
44
|
-
f'<g fill="none" stroke="url(#cpBrand)" stroke-width="2" '
|
|
45
|
-
f'stroke-linecap="round" stroke-linejoin="round">{
|
|
46
|
+
'<circle cx="12" cy="12" r="11" fill="none" stroke="url(#cpBrand)" '
|
|
47
|
+
'stroke-width="0.5" stroke-opacity=".55"/>'
|
|
48
|
+
f'<g fill="none" stroke="url(#cpBrand)" stroke-width="2.5" '
|
|
49
|
+
f'stroke-linecap="round" stroke-linejoin="round">{_PROMPT_PATHS}</g>'
|
|
46
50
|
"</svg>"
|
|
47
51
|
)
|
|
48
52
|
|
|
49
53
|
|
|
50
54
|
# ── Favicon (ICO, 32×32 光栅回退) ─────────────────────────────────────────
|
|
51
55
|
def _build_favicon() -> bytes:
|
|
52
|
-
"""程序化生成 32×32 ICO
|
|
56
|
+
"""程序化生成 32×32 ICO:全透明底 + 青绿渐变 prompt 笔划(旧浏览器/Safari 回退).
|
|
53
57
|
|
|
54
|
-
项目无 Pillow/cairosvg 等图像库,故以纯 Python
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
32px
|
|
58
|
+
项目无 Pillow/cairosvg 等图像库,故以纯 Python 按像素光栅化:全透明底 + 青绿渐变
|
|
59
|
+
(#22d3ee -> #2dd4bf)``>`` 折线与 ``_`` 下划线。沿用「全零 AND-mask + per-pixel
|
|
60
|
+
alpha」透明方案(现代渲染器按 alpha 通道处理透明)。方案 d05 的细圆环(0.5px)在
|
|
61
|
+
32px 下不足 1 像素、无法渲染,故 ICO 省略圆环、仅保留饱和 ``>_`` 笔划(符合「图标
|
|
62
|
+
为主角、环极弱」的设计意图),完整外观由 SVG 主版承载。
|
|
58
63
|
"""
|
|
59
64
|
import math
|
|
60
65
|
import struct
|
|
61
66
|
|
|
62
67
|
width = height = 32
|
|
63
|
-
radius = 8
|
|
64
68
|
scale = width / 24.0 # SVG 24 单位 -> 像素
|
|
65
69
|
|
|
66
|
-
#
|
|
67
|
-
r0, g0, b0 =
|
|
68
|
-
r1, g1, b1 =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def inside(x: int, y: int) -> bool:
|
|
73
|
-
"""满铺圆角方块(四角半径 radius)包含判定."""
|
|
74
|
-
cx = min(x, width - 1 - x)
|
|
75
|
-
cy = min(y, height - 1 - y)
|
|
76
|
-
if cx >= radius or cy >= radius:
|
|
77
|
-
return True
|
|
78
|
-
return (radius - cx) ** 2 + (radius - cy) ** 2 <= radius * radius
|
|
79
|
-
|
|
80
|
-
# 像素缓冲:[B, G, R, A],默认全透明
|
|
70
|
+
# 图标笔划青绿渐变:#22d3ee -> #2dd4bf(与 _LOGO_DEFS 同源)
|
|
71
|
+
r0, g0, b0 = 0x22, 0xD3, 0xEE
|
|
72
|
+
r1, g1, b1 = 0x2D, 0xD4, 0xBF
|
|
73
|
+
|
|
74
|
+
# 像素缓冲:[B, G, R, A],默认全透明(全透底,无容器填充)
|
|
81
75
|
buf: list[list[list[int]]] = [
|
|
82
76
|
[[0, 0, 0, 0] for _ in range(width)] for _ in range(height)
|
|
83
77
|
]
|
|
84
78
|
|
|
85
|
-
# 1) 浅底圆角背景(扁平 #f5f6fb)
|
|
86
|
-
for y in range(height):
|
|
87
|
-
for x in range(width):
|
|
88
|
-
if not inside(x, y):
|
|
89
|
-
continue
|
|
90
|
-
buf[y][x] = [tile_b, tile_g, tile_r, 255]
|
|
91
|
-
|
|
92
79
|
def brand_at(px: float, py: float) -> tuple[int, int, int]:
|
|
93
|
-
"""按对角参数 t 返回 (px,py)
|
|
80
|
+
"""按对角参数 t 返回 (px,py) 处的青绿渐变 RGB(与 SVG url(#cpBrand) 同向)."""
|
|
94
81
|
t = (px + py) / (width + height - 2)
|
|
95
82
|
return (
|
|
96
83
|
int(r0 + (r1 - r0) * t),
|
|
@@ -99,7 +86,7 @@ def _build_favicon() -> bytes:
|
|
|
99
86
|
)
|
|
100
87
|
|
|
101
88
|
def stamp(px: float, py: float) -> None:
|
|
102
|
-
"""以 (px, py) 为中心盖 ~3px
|
|
89
|
+
"""以 (px, py) 为中心盖 ~3px 青绿渐变方块(笔划加粗,保证小尺寸可辨识)."""
|
|
103
90
|
ix, iy = int(round(px)), int(round(py))
|
|
104
91
|
cr, cg, cb = brand_at(px, py)
|
|
105
92
|
for oy in (-1, 0, 1):
|
|
@@ -109,18 +96,18 @@ def _build_favicon() -> bytes:
|
|
|
109
96
|
buf[ny][nx] = [cb, cg, cr, 255]
|
|
110
97
|
|
|
111
98
|
def line(x0: float, y0: float, x1: float, y1: float) -> None:
|
|
112
|
-
"""稠密采样 + stamp
|
|
99
|
+
"""稠密采样 + stamp 形成青绿渐变粗线段."""
|
|
113
100
|
dist = math.hypot(x1 - x0, y1 - y0)
|
|
114
101
|
steps = max(1, int(dist * 3))
|
|
115
102
|
for i in range(steps + 1):
|
|
116
103
|
s = i / steps
|
|
117
104
|
stamp(x0 + (x1 - x0) * s, y0 + (y1 - y0) * s)
|
|
118
105
|
|
|
119
|
-
#
|
|
120
|
-
# > 折线 (
|
|
121
|
-
line(
|
|
122
|
-
line(
|
|
123
|
-
line(13 * scale,
|
|
106
|
+
# prompt 笔划(SVG 24 单位 -> 像素)
|
|
107
|
+
# > 折线 (5,7)->(10,12)->(5,17);_ 下划线 (13,17)->(19,17)
|
|
108
|
+
line(5 * scale, 7 * scale, 10 * scale, 12 * scale)
|
|
109
|
+
line(10 * scale, 12 * scale, 5 * scale, 17 * scale)
|
|
110
|
+
line(13 * scale, 17 * scale, 19 * scale, 17 * scale)
|
|
124
111
|
|
|
125
112
|
# 3) 打包 ICO(BMP bottom-up;全零 AND-mask,信任 per-pixel alpha 实现圆角透明)
|
|
126
113
|
pixel_rows: list[bytes] = []
|
|
@@ -222,13 +209,9 @@ _DASHBOARD_HTML = """<!DOCTYPE html>
|
|
|
222
209
|
.header-left { display: flex; align-items: center; gap: 12px; }
|
|
223
210
|
.logo {
|
|
224
211
|
width: 32px; height: 32px;
|
|
225
|
-
background: #f5f6fb;
|
|
226
|
-
border: 1px solid rgba(102,126,234,.18);
|
|
227
|
-
border-radius: 10px;
|
|
228
212
|
display: flex; align-items: center; justify-content: center;
|
|
229
|
-
box-shadow: 0 4px 12px rgba(102,126,234,.18);
|
|
230
213
|
}
|
|
231
|
-
.logo svg { width:
|
|
214
|
+
.logo svg { width: 28px; height: 28px; display: block; filter: drop-shadow(0 0 3px rgba(45,212,191,.3)); }
|
|
232
215
|
h1 { font-size: 18px; font-weight: 600; color: var(--text-primary); letter-spacing: -.3px; }
|
|
233
216
|
.header-right { display: flex; align-items: center; gap: 12px; }
|
|
234
217
|
.badge {
|
|
@@ -815,7 +798,7 @@ _DASHBOARD_HTML = """<!DOCTYPE html>
|
|
|
815
798
|
<body>
|
|
816
799
|
<header>
|
|
817
800
|
<div class="header-left">
|
|
818
|
-
<div class="logo"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="url(#cpBrand)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">{{LOGO_DEFS}}{{
|
|
801
|
+
<div class="logo"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="url(#cpBrand)" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">{{LOGO_DEFS}}<circle cx="12" cy="12" r="11" fill="none" stroke="url(#cpBrand)" stroke-width="0.5" stroke-opacity=".55"/><g>{{PROMPT}}</g></svg></div>
|
|
819
802
|
<h1>Coding Proxy Dashboard</h1>
|
|
820
803
|
<span class="badge" id="version-badge">v-.-.-</span>
|
|
821
804
|
</div>
|
|
@@ -2385,7 +2368,7 @@ function switchTab(name) {
|
|
|
2385
2368
|
</script>
|
|
2386
2369
|
</body>
|
|
2387
2370
|
</html>
|
|
2388
|
-
""".replace("{{
|
|
2371
|
+
""".replace("{{PROMPT}}", _PROMPT_PATHS).replace("{{LOGO_DEFS}}", _LOGO_DEFS)
|
|
2389
2372
|
|
|
2390
2373
|
|
|
2391
2374
|
# ── 数据计算工具 ──────────────────────────────────────────────────────────
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coding-proxy
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2a6
|
|
4
4
|
Summary: A High-Availability, Transparent, and Smart Multi-Vendor Proxy for Claude Code. Support Claude Plans, GitHub Copilot, Google Antigravity, ZAI/GLM, MiniMax, Qwen, Xiaomi, Kimi, Doubao...
|
|
5
5
|
Project-URL: Source Code, https://github.com/ThreeFish-AI/coding-proxy
|
|
6
6
|
Project-URL: User Guide, https://github.com/ThreeFish-AI/coding-proxy/blob/master/docs/user-guide.md
|
|
@@ -69,7 +69,7 @@ coding/proxy/routing/usage_parser.py,sha256=ZwPuMGtXAwdIOKrXLpdtA4nCmc83ViF6kw5J
|
|
|
69
69
|
coding/proxy/routing/usage_recorder.py,sha256=PHUHotCt3VaKkdJizMpPGsUOAj-f5qz9JKeiLEnFNgA,8779
|
|
70
70
|
coding/proxy/server/__init__.py,sha256=KeH7mEu36v9v27m3VgeSxSeFz9sLTJrxS_EVATJ7Vks,20
|
|
71
71
|
coding/proxy/server/app.py,sha256=3MYE8-Vsxpt1SVqTKReMKNREBsh_LHKIFq1B4jhfeL8,7121
|
|
72
|
-
coding/proxy/server/dashboard.py,sha256=
|
|
72
|
+
coding/proxy/server/dashboard.py,sha256=dSX7nm-FJAN6JjjKXnuNxa7W9lDorekQX0Grv2SXRZ4,104808
|
|
73
73
|
coding/proxy/server/factory.py,sha256=L0d0AA0fpkV-gynM85u1l5dXY1OQ5A_p_-PV0XlFGQs,10272
|
|
74
74
|
coding/proxy/server/responses.py,sha256=i0ugnLRNOdRYGHEWxkwsxR35ChmdMQsSaD8AjRluTn4,2167
|
|
75
75
|
coding/proxy/server/routes.py,sha256=5f9ONVckM3LG2AftBW6YahelhjkP6XlgaYSH7MvXUp4,22362
|
|
@@ -93,8 +93,8 @@ coding/proxy/vendors/native_anthropic.py,sha256=SxtM71PDci0gqLqiwCrFnT410SnSoD7F
|
|
|
93
93
|
coding/proxy/vendors/token_manager.py,sha256=s10t4Com0jNnKGkPyJ_HpG5SjHrCEJvfArEOAaPKA_k,4189
|
|
94
94
|
coding/proxy/vendors/xiaomi.py,sha256=E-GcmJBZh7GOtDFonxZmlf0hKRhrlrXzL0IxHFRYcRo,860
|
|
95
95
|
coding/proxy/vendors/zhipu.py,sha256=GaLaWssa4c1lcukQL4nOtzji8jxEUJFrZtFgOkXTKaM,11127
|
|
96
|
-
coding_proxy-0.5.
|
|
97
|
-
coding_proxy-0.5.
|
|
98
|
-
coding_proxy-0.5.
|
|
99
|
-
coding_proxy-0.5.
|
|
100
|
-
coding_proxy-0.5.
|
|
96
|
+
coding_proxy-0.5.2a6.dist-info/METADATA,sha256=nRowr8Fpf-4yMO2bNsrLZA0SMozGiU9CVBI6IFZyxPY,11346
|
|
97
|
+
coding_proxy-0.5.2a6.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
98
|
+
coding_proxy-0.5.2a6.dist-info/entry_points.txt,sha256=moIVzt5ho0Wk9B47LOo2SEAbhzuDDHWi-EfM30U0XBg,54
|
|
99
|
+
coding_proxy-0.5.2a6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
100
|
+
coding_proxy-0.5.2a6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|