@ponydev/dsh-model-usage 1.0.6 → 1.0.8
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.
- package/CHANGELOG.md +13 -0
- package/assets/logos/opencode.svg +7 -0
- package/lib/adapters.js +10 -1
- package/lib/client.js +24 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.8 — 2026-10-20
|
|
4
|
+
|
|
5
|
+
### 新增
|
|
6
|
+
- OpenCode / OpenCode Go 官方 Logo(`opencode.ai/favicon.svg`)
|
|
7
|
+
|
|
8
|
+
### 修复
|
|
9
|
+
- 方形品牌标(Z.ai、Kimi、OpenRouter、MiniMax、OpenCode、xAI)改用**圆角方形**渲染,避免圆形裁切掉四角
|
|
10
|
+
|
|
11
|
+
## 1.0.7 — 2026-10-20
|
|
12
|
+
|
|
13
|
+
### 修复
|
|
14
|
+
- **凭据引用改为「路由派生优先」**:如 `opencode-go` → `OPENCODE_GO_API_KEY`(与 DSH Models 页的 `apiKeyEnv` 一致),修复已配置 Key 的供应商仍显示未配置/不显示的问题
|
|
15
|
+
|
|
3
16
|
## 1.0.6 — 2026-10-20
|
|
4
17
|
|
|
5
18
|
### 新增
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512"><svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="512" height="512" fill="#131010"></rect>
|
|
3
|
+
<path d="M320 224V352H192V224H320Z" fill="#5A5858"></path>
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M384 416H128V96H384V416ZM320 160H192V352H320V160Z" fill="white"></path>
|
|
5
|
+
</svg><style>@media (prefers-color-scheme: light) { :root { filter: none; } }
|
|
6
|
+
@media (prefers-color-scheme: dark) { :root { filter: none; } }
|
|
7
|
+
</style></svg>
|
package/lib/adapters.js
CHANGED
|
@@ -53,9 +53,18 @@ export async function fetchT(url, init, ms) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/** 按顺序解析凭据 ref:优先注入作用域的 credentials 服务,再回退环境变量 */
|
|
56
|
+
function routeKeyRef(route) {
|
|
57
|
+
const base = String(route || '').toUpperCase().replace(/[^A-Z0-9]+/g, '_').replace(/^_+|_+$/g, '')
|
|
58
|
+
return base ? base + '_API_KEY' : null
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
export async function resolveKey(env) {
|
|
57
62
|
const cred = env.credentials
|
|
58
|
-
|
|
63
|
+
// 优先按路由派生的引用(如 opencode-go → OPENCODE_GO_API_KEY,与 DSH Models 页 apiKeyEnv 一致)
|
|
64
|
+
const refs = [...(env.refs || [])]
|
|
65
|
+
const derived = routeKeyRef(env.route)
|
|
66
|
+
if (derived && !refs.includes(derived)) refs.unshift(derived)
|
|
67
|
+
for (const ref of refs) {
|
|
59
68
|
if (!ref) continue
|
|
60
69
|
if (cred && typeof cred.resolve === 'function') {
|
|
61
70
|
for (let attempt = 0; attempt < 2; attempt++) {
|
package/lib/client.js
CHANGED
|
@@ -445,35 +445,42 @@ window.__ModuleLoader__.load({
|
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
// ---------------------------------------------------------------- atoms
|
|
448
|
+
// [路由正则, slug, 形状]:方形品牌标用 rounded 避免圆形裁切
|
|
448
449
|
const LOGO_SLUGS = [
|
|
449
|
-
[/^deepseek/, 'deepseek'],
|
|
450
|
-
[/^(zai|glm|bigmodel|zhipu|chatglm)/, 'zai'],
|
|
451
|
-
[/^openai$/, 'openai'],
|
|
452
|
-
[/^anthropic/, 'anthropic'],
|
|
453
|
-
[/^(google-)?gemini/, 'googlegemini'],
|
|
454
|
-
[/^(moonshot|kimi|moonshotai)/, 'kimi'],
|
|
455
|
-
[/^openrouter/, 'openrouter'],
|
|
456
|
-
[/^minimax/, 'minimax'],
|
|
457
|
-
[/^
|
|
450
|
+
[/^deepseek/, 'deepseek', 'circle'],
|
|
451
|
+
[/^(zai|glm|bigmodel|zhipu|chatglm)/, 'zai', 'square'],
|
|
452
|
+
[/^openai$/, 'openai', 'circle'],
|
|
453
|
+
[/^anthropic/, 'anthropic', 'circle'],
|
|
454
|
+
[/^(google-)?gemini/, 'googlegemini', 'circle'],
|
|
455
|
+
[/^(moonshot|kimi|moonshotai)/, 'kimi', 'square'],
|
|
456
|
+
[/^openrouter/, 'openrouter', 'square'],
|
|
457
|
+
[/^minimax/, 'minimax', 'square'],
|
|
458
|
+
[/^opencode/, 'opencode', 'square'],
|
|
459
|
+
[/^xai/, 'xai', 'square'],
|
|
458
460
|
]
|
|
459
|
-
function
|
|
460
|
-
for (const [re, slug] of LOGO_SLUGS) if (re.test(route || '')) return slug
|
|
461
|
+
function logoSpec(route) {
|
|
462
|
+
for (const [re, slug, shape] of LOGO_SLUGS) if (re.test(route || '')) return { slug, shape }
|
|
461
463
|
return null
|
|
462
464
|
}
|
|
463
465
|
|
|
464
466
|
function Logo({ route, size = 24 }) {
|
|
465
467
|
const [failed, setFailed] = useState(false)
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
468
|
+
const spec = logoSpec(route)
|
|
469
|
+
if (spec && !failed) {
|
|
470
|
+
const square = spec.shape === 'square'
|
|
468
471
|
return h('span', {
|
|
469
472
|
className: 'dmu-logo',
|
|
470
|
-
style:
|
|
473
|
+
style: square
|
|
474
|
+
? { width: size, height: size, borderRadius: Math.max(4, Math.round(size * 0.26)), background: 'transparent' }
|
|
475
|
+
: { width: size, height: size, background: 'var(--dsw-alias-bg-layer-1,#fff)', border: '1px solid var(--dsw-alias-border-l1,#e3e7ed)' },
|
|
471
476
|
title: route || '',
|
|
472
477
|
},
|
|
473
478
|
h('img', {
|
|
474
|
-
src: 'model-usage/logo/' + slug + '.svg',
|
|
475
|
-
alt: route || '',
|
|
476
|
-
|
|
479
|
+
src: 'model-usage/logo/' + spec.slug + '.svg',
|
|
480
|
+
alt: route || '',
|
|
481
|
+
width: square ? size : size - 6,
|
|
482
|
+
height: square ? size : size - 6,
|
|
483
|
+
style: { display: 'block', margin: 'auto', objectFit: 'contain', borderRadius: square ? Math.max(4, Math.round(size * 0.26)) : 0 },
|
|
477
484
|
onError: () => setFailed(true),
|
|
478
485
|
}))
|
|
479
486
|
}
|