@dsh-plus/llm-pi 0.1.12 → 0.1.13
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/lib/client.js +44 -20
- package/package.json +2 -2
- package/src/client/fields.tsx +3 -1
- package/src/client/styles.ts +1 -1
- package/src/client/views/providers.tsx +3 -1
package/lib/client.js
CHANGED
|
@@ -6,6 +6,25 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
let react = require("react");
|
|
9
|
+
//#region ../shared/src/client/icons.tsx
|
|
10
|
+
/** 官方 IconChevronDownOutline14 的同构实现(path 数据逐字一致)。 */
|
|
11
|
+
function ChevronDownIcon(props) {
|
|
12
|
+
const size = props.size ?? 14;
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
14
|
+
width: size,
|
|
15
|
+
height: size,
|
|
16
|
+
className: props.className,
|
|
17
|
+
viewBox: "0 0 14 14",
|
|
18
|
+
fill: "none",
|
|
19
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
22
|
+
d: "M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z",
|
|
23
|
+
fill: "currentColor"
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
9
28
|
//#region ../shared/src/client/card.tsx
|
|
10
29
|
const IDLE_STATUS = {
|
|
11
30
|
kind: "idle",
|
|
@@ -41,10 +60,7 @@ window.__ModuleLoader__.load({
|
|
|
41
60
|
className: `${p}-pending`,
|
|
42
61
|
children: props.dirtyLabel
|
|
43
62
|
}) : null,
|
|
44
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
45
|
-
className: `${p}-chevron${props.open ? ` ${p}-chevronOpen` : ""}`,
|
|
46
|
-
children: "▾"
|
|
47
|
-
})
|
|
63
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, { className: `${p}-chevron${props.open ? ` ${p}-chevronOpen` : ""}` })
|
|
48
64
|
]
|
|
49
65
|
}), props.open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
50
66
|
className: `${p}-body`,
|
|
@@ -110,6 +126,11 @@ window.__ModuleLoader__.load({
|
|
|
110
126
|
]
|
|
111
127
|
});
|
|
112
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* 勾选行:自绘圆角扁平开关(switch),对齐官方 WebUI 无原生 checkbox 的
|
|
131
|
+
* 设计语言(官方选择类控件全走胶囊/菜单,见 cardCss 的 -switch 规则)。
|
|
132
|
+
* 语义保持 checkbox(无障碍树与表单语义不变),视觉自绘。
|
|
133
|
+
*/
|
|
113
134
|
function CheckRow(props) {
|
|
114
135
|
const p = props.prefix ?? "dshp";
|
|
115
136
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -117,6 +138,8 @@ window.__ModuleLoader__.load({
|
|
|
117
138
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
118
139
|
id: props.id,
|
|
119
140
|
type: "checkbox",
|
|
141
|
+
role: "switch",
|
|
142
|
+
"aria-checked": props.checked,
|
|
120
143
|
checked: props.checked,
|
|
121
144
|
disabled: props.disabled === true,
|
|
122
145
|
onChange: (event) => props.onEdit(event.target.checked)
|
|
@@ -265,7 +288,7 @@ window.__ModuleLoader__.load({
|
|
|
265
288
|
.${prefix}-headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}
|
|
266
289
|
.${prefix}-name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}
|
|
267
290
|
.${prefix}-description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}
|
|
268
|
-
.${prefix}-chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s;
|
|
291
|
+
.${prefix}-chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s;display:inline-flex}
|
|
269
292
|
.${prefix}-chevronOpen{transform:rotate(180deg)}
|
|
270
293
|
.${prefix}-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}
|
|
271
294
|
.${prefix}-statusBadge{white-space:nowrap;border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}
|
|
@@ -279,16 +302,24 @@ window.__ModuleLoader__.load({
|
|
|
279
302
|
.${prefix}-badge{white-space:nowrap;border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}
|
|
280
303
|
.${prefix}-badgeSet{background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary)}
|
|
281
304
|
.${prefix}-badgeUnset{color:var(--dsw-alias-label-tertiary)}
|
|
282
|
-
.${prefix}-input{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px}
|
|
305
|
+
.${prefix}-input{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;transition:border-color .18s,background .18s}
|
|
306
|
+
.${prefix}-input:hover:not(:disabled):not(:focus-visible){border-color:var(--dsw-alias-label-dimmed)}
|
|
283
307
|
.${prefix}-input:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}
|
|
284
308
|
.${prefix}-input:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}
|
|
285
309
|
.${prefix}-inputInvalid{border-color:var(--dsw-alias-label-error)}
|
|
286
|
-
.${prefix}-select{appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--dsw-alias-label-
|
|
310
|
+
.${prefix}-select{appearance:none;background:var(--dsw-alias-bg-module-platform);border:none;cursor:pointer;background-image:linear-gradient(45deg,transparent 50%,var(--dsw-alias-label-secondary) 50%),linear-gradient(135deg,var(--dsw-alias-label-secondary) 50%,transparent 50%);background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%;background-size:5px 5px;background-repeat:no-repeat;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;height:34px;box-sizing:border-box;border-radius:8px;padding:0 30px 0 12px;transition:background-color .18s}
|
|
311
|
+
.${prefix}-select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}
|
|
287
312
|
.${prefix}-hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}
|
|
288
313
|
.${prefix}-invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}
|
|
289
|
-
.${prefix}-checkRow{align-items:center;gap:
|
|
290
|
-
.${prefix}-checkRow
|
|
291
|
-
|
|
314
|
+
.${prefix}-checkRow{align-items:center;gap:10px;display:flex;padding:6px 0}
|
|
315
|
+
.${prefix}-checkRow label{color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.5;cursor:pointer;flex:1;min-width:0}
|
|
316
|
+
/* 自绘圆角扁平开关(官方 UI 无可见原生 checkbox,选择类全走胶囊/菜单) */
|
|
317
|
+
.${prefix}-checkRow input{appearance:none;-webkit-appearance:none;position:relative;box-sizing:border-box;background:var(--dsw-alias-bg-module-platform);border:none;border-radius:999px;width:34px;height:20px;flex:none;cursor:pointer;transition:background .18s;margin:0}
|
|
318
|
+
.${prefix}-checkRow input::after{content:"";position:absolute;top:2px;left:2px;background:var(--dsw-alias-label-primary);border-radius:999px;width:16px;height:16px;transition:left .18s cubic-bezier(.4,0,.2,1)}
|
|
319
|
+
.${prefix}-checkRow input:checked{background:var(--dsw-alias-brand-primary)}
|
|
320
|
+
.${prefix}-checkRow input:checked::after{left:16px;background:var(--dsw-alias-bg-base)}
|
|
321
|
+
.${prefix}-checkRow input:disabled{opacity:.4;cursor:default}
|
|
322
|
+
.${prefix}-checkRow input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:2px}
|
|
292
323
|
.${prefix}-groupLabel{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:600;padding:12px 0 2px;margin:0}
|
|
293
324
|
.${prefix}-readOnly{color:var(--dsw-alias-label-tertiary);margin:12px 0 0;font-size:12px;line-height:1.5}
|
|
294
325
|
.${prefix}-warn{color:var(--dsw-alias-label-error);margin:12px 0 0;font-size:12px;line-height:1.5}
|
|
@@ -306,7 +337,6 @@ window.__ModuleLoader__.load({
|
|
|
306
337
|
.${prefix}-header{padding:12px 12px}
|
|
307
338
|
.${prefix}-input,.${prefix}-select{font-size:16px;height:40px}
|
|
308
339
|
.${prefix}-checkRow{min-height:44px;padding:8px 0}
|
|
309
|
-
.${prefix}-checkRow input{width:18px;height:18px;flex:none}
|
|
310
340
|
.${prefix}-footer{position:sticky;bottom:0;background:var(--dsw-alias-bg-layer-2);margin:0 -10px;padding:10px 10px 6px;border-top:1px solid var(--dsw-alias-border-l2);border-bottom-left-radius:12px;border-bottom-right-radius:12px}
|
|
311
341
|
.${prefix}-status{flex-basis:100%;flex:none}
|
|
312
342
|
.${prefix}-btn{min-height:44px;flex:1;min-width:96px}
|
|
@@ -663,10 +693,7 @@ ${extra}
|
|
|
663
693
|
id: props.id,
|
|
664
694
|
"aria-expanded": open,
|
|
665
695
|
onClick: () => setOpen(!open),
|
|
666
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
667
|
-
className: `lpc-chevron${open ? " lpc-chevronOpen" : ""}`,
|
|
668
|
-
children: "▾"
|
|
669
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
696
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, { className: `lpc-chevron${open ? " lpc-chevronOpen" : ""}` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
670
697
|
className: "lpc-collapseTitle",
|
|
671
698
|
children: props.title
|
|
672
699
|
})]
|
|
@@ -1612,10 +1639,7 @@ ${extra}
|
|
|
1612
1639
|
"aria-expanded": open,
|
|
1613
1640
|
onClick: () => setOpen(!open),
|
|
1614
1641
|
children: [
|
|
1615
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
1616
|
-
className: `lpc-chevron${open ? " lpc-chevronOpen" : ""}`,
|
|
1617
|
-
children: "▾"
|
|
1618
|
-
}),
|
|
1642
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChevronDownIcon, { className: `lpc-chevron${open ? " lpc-chevronOpen" : ""}` }),
|
|
1619
1643
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1620
1644
|
className: "lpc-routeKey",
|
|
1621
1645
|
children: route
|
|
@@ -2136,7 +2160,7 @@ ${extra}
|
|
|
2136
2160
|
const PLUGIN_ID = "@dsh-plus/llm-pi";
|
|
2137
2161
|
const cardCssAll = cardCss("lpc", `
|
|
2138
2162
|
.lpc-input{width:100%;box-sizing:border-box}
|
|
2139
|
-
.lpc-select{appearance:none}
|
|
2163
|
+
.lpc-select{appearance:none;cursor:pointer;background-image:linear-gradient(45deg,transparent 50%,var(--dsw-alias-label-secondary) 50%),linear-gradient(135deg,var(--dsw-alias-label-secondary) 50%,transparent 50%);background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%;background-size:5px 5px;background-repeat:no-repeat;padding-right:30px}
|
|
2140
2164
|
.lpc-textarea{height:auto;min-height:72px;padding:8px 12px;line-height:1.5;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;resize:vertical}
|
|
2141
2165
|
.lpc-checkRow{padding:3px 0}
|
|
2142
2166
|
.lpc-statusRow{color:var(--dsw-alias-label-tertiary);margin:6px 0 0;font-size:12px;line-height:1.6;word-break:break-all}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-plus/llm-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "dsh-plus service+ui plugin: 基于 PiAiAdapter 的自定义 LLM 路由(全量 compat、模型继承、models.dev 目录兜底)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"https-proxy-agent": "^7.0.6",
|
|
36
|
-
"@dsh-plus/shared": "0.1.
|
|
36
|
+
"@dsh-plus/shared": "0.1.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@deepseek-ai/cordis": "^4.0.1",
|
package/src/client/fields.tsx
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* 本文件的 SelectField 是 llm-pi 的窄变体(readonly string[] 选项 + 未设置项)。
|
|
5
5
|
* @module llm-pi/client/fields
|
|
6
6
|
*/
|
|
7
|
+
|
|
8
|
+
import { ChevronDownIcon } from '@dsh-plus/shared/client'
|
|
7
9
|
import { type ReactElement, useEffect, useState } from 'react'
|
|
8
10
|
|
|
9
11
|
import type { HeaderPair } from './draft.ts'
|
|
@@ -32,7 +34,7 @@ export function CollapseSection(props: CollapseSectionProps): ReactElement {
|
|
|
32
34
|
aria-expanded={open}
|
|
33
35
|
onClick={() => setOpen(!open)}
|
|
34
36
|
>
|
|
35
|
-
<
|
|
37
|
+
<ChevronDownIcon className={`lpc-chevron${open ? ' lpc-chevronOpen' : ''}`} />
|
|
36
38
|
<span className="lpc-collapseTitle">{props.title}</span>
|
|
37
39
|
</button>
|
|
38
40
|
{open ? <div className="lpc-collapseBody">{props.children}</div> : null}
|
package/src/client/styles.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const PLUGIN_ID = '@dsh-plus/llm-pi'
|
|
|
12
12
|
|
|
13
13
|
const extraCss = `
|
|
14
14
|
.lpc-input{width:100%;box-sizing:border-box}
|
|
15
|
-
.lpc-select{appearance:none}
|
|
15
|
+
.lpc-select{appearance:none;cursor:pointer;background-image:linear-gradient(45deg,transparent 50%,var(--dsw-alias-label-secondary) 50%),linear-gradient(135deg,var(--dsw-alias-label-secondary) 50%,transparent 50%);background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%;background-size:5px 5px;background-repeat:no-repeat;padding-right:30px}
|
|
16
16
|
.lpc-textarea{height:auto;min-height:72px;padding:8px 12px;line-height:1.5;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;resize:vertical}
|
|
17
17
|
.lpc-checkRow{padding:3px 0}
|
|
18
18
|
.lpc-statusRow{color:var(--dsw-alias-label-tertiary);margin:6px 0 0;font-size:12px;line-height:1.6;word-break:break-all}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* 支持新增 route(输入键名)与删除 route。
|
|
5
5
|
* @module llm-pi/client/views/providers
|
|
6
6
|
*/
|
|
7
|
+
|
|
8
|
+
import { ChevronDownIcon } from '@dsh-plus/shared/client'
|
|
7
9
|
import { type ReactElement, useState } from 'react'
|
|
8
10
|
|
|
9
11
|
import type { ProviderDraft } from '../draft.ts'
|
|
@@ -111,7 +113,7 @@ export function ProviderSection(props: ProviderSectionProps): ReactElement {
|
|
|
111
113
|
aria-expanded={open}
|
|
112
114
|
onClick={() => setOpen(!open)}
|
|
113
115
|
>
|
|
114
|
-
<
|
|
116
|
+
<ChevronDownIcon className={`lpc-chevron${open ? ' lpc-chevronOpen' : ''}`} />
|
|
115
117
|
<span className="lpc-routeKey">{route}</span>
|
|
116
118
|
{summary !== '' ? <span className="lpc-routeApi">{summary}</span> : null}
|
|
117
119
|
</button>
|