@michengai/dsh-automation 0.1.7 → 0.1.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/lib/client.js +46 -23
- package/lib/client.js.map +2 -2
- package/package.json +8 -8
package/lib/client.js
CHANGED
|
@@ -922,16 +922,22 @@ function ModelPicker({
|
|
|
922
922
|
const modelLabel = selected === void 0 ? t("form.modelDefault") : selected.label;
|
|
923
923
|
const effortLabel = t(`form.effort.${effort}`);
|
|
924
924
|
const trigger = effort === "none" ? modelLabel : `${modelLabel} ${effortLabel}`;
|
|
925
|
+
const modelGroups = Array.from(models.reduce((groups, item) => {
|
|
926
|
+
const group = groups.get(item.provider) ?? [];
|
|
927
|
+
group.push(item);
|
|
928
|
+
groups.set(item.provider, group);
|
|
929
|
+
return groups;
|
|
930
|
+
}, /* @__PURE__ */ new Map()));
|
|
925
931
|
const open = (next) => {
|
|
926
932
|
setPane(next);
|
|
927
933
|
menu.setOpen(true);
|
|
928
934
|
};
|
|
929
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `dsh-st-select
|
|
935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `dsh-st-model-select${menu.open ? " is-open" : ""}`, ref: menu.root, children: [
|
|
930
936
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
931
937
|
"button",
|
|
932
938
|
{
|
|
933
939
|
type: "button",
|
|
934
|
-
className: "dsh-st-select-
|
|
940
|
+
className: "dsh-st-model-select-trigger",
|
|
935
941
|
onMouseDown: (event) => event.stopPropagation(),
|
|
936
942
|
onClick: () => {
|
|
937
943
|
if (menu.open) {
|
|
@@ -946,38 +952,54 @@ function ModelPicker({
|
|
|
946
952
|
]
|
|
947
953
|
}
|
|
948
954
|
),
|
|
949
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(MenuPopup, { open: menu.open, anchor: menu.root, menuRef: menu.menu, up: true, end: true, className: "dsh-st-select-menu is-
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(MenuPopup, { open: menu.open, anchor: menu.root, menuRef: menu.menu, up: true, end: true, className: "dsh-st-model-select-menu is-up is-end", children: [
|
|
950
956
|
pane === "root" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
951
957
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuRow, { kv: true, label: t("form.model"), hint: modelLabel, chevron: true, onClick: () => setPane("model") }),
|
|
952
958
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuRow, { kv: true, label: t("form.effort"), hint: effortLabel, chevron: true, onClick: () => setPane("effort") })
|
|
953
959
|
] }),
|
|
954
960
|
pane === "model" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
955
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
956
|
-
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
962
|
+
"button",
|
|
957
963
|
{
|
|
958
|
-
|
|
959
|
-
|
|
964
|
+
type: "button",
|
|
965
|
+
role: "menuitemradio",
|
|
966
|
+
"aria-checked": modelKey === "default",
|
|
967
|
+
className: "dsh-st-model-option",
|
|
960
968
|
onClick: () => {
|
|
961
969
|
onModelKey("default");
|
|
962
970
|
menu.setOpen(false);
|
|
963
|
-
}
|
|
971
|
+
},
|
|
972
|
+
children: [
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-st-model-option-copy", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-st-model-name", children: t("form.modelDefault") }) }),
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-st-model-check", children: modelKey === "default" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckOutlineIcon, { width: 16, height: 16 }) })
|
|
975
|
+
]
|
|
964
976
|
}
|
|
965
977
|
),
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
978
|
+
modelGroups.map(([provider, group]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { role: "group", "aria-label": provider, className: "dsh-st-model-group", children: [
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-st-model-group-title", children: provider }),
|
|
980
|
+
group.map((item) => {
|
|
981
|
+
const value = `${item.provider}::${item.model}`;
|
|
982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
983
|
+
"button",
|
|
984
|
+
{
|
|
985
|
+
type: "button",
|
|
986
|
+
role: "menuitemradio",
|
|
987
|
+
"aria-checked": value === modelKey,
|
|
988
|
+
className: "dsh-st-model-option",
|
|
989
|
+
title: item.label,
|
|
990
|
+
onClick: () => {
|
|
991
|
+
onModelKey(value);
|
|
992
|
+
menu.setOpen(false);
|
|
993
|
+
},
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-st-model-option-copy", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-st-model-name", children: item.label }) }),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-st-model-check", children: value === modelKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckOutlineIcon, { width: 16, height: 16 }) })
|
|
997
|
+
]
|
|
998
|
+
},
|
|
999
|
+
value
|
|
1000
|
+
);
|
|
1001
|
+
})
|
|
1002
|
+
] }, provider))
|
|
981
1003
|
] }),
|
|
982
1004
|
pane === "effort" && EFFORTS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
983
1005
|
MenuRow,
|
|
@@ -2924,6 +2946,7 @@ var CSS_TEXT = `
|
|
|
2924
2946
|
.dsh-st-chip-btn:hover{background:rgba(255,255,255,.06);color:var(--dsw-alias-label-primary)}
|
|
2925
2947
|
.dsh-st-chip-btn.is-static{cursor:default;opacity:.78}
|
|
2926
2948
|
.dsh-st-chip-btn em,.dsh-st-select.is-pill .dsh-st-select-btn em{width:6px;height:6px;margin-left:2px;opacity:.55}
|
|
2949
|
+
.dsh-st-model-select{position:relative;z-index:1;min-width:0;flex:none}.dsh-st-model-select.is-open{z-index:30}.dsh-st-model-select-trigger{display:flex;align-items:center;gap:4px;min-width:0;max-width:220px;height:28px;padding:0 4px 0 8px;border:0;border-radius:24px;background:transparent;color:var(--dsw-alias-label-secondary);font-size:13px;font-weight:500;line-height:20px;cursor:pointer}.dsh-st-model-select-trigger:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.dsh-st-model-select-trigger>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-st-model-select-trigger em{width:6px;height:6px;margin-left:2px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg) translateY(-2px);opacity:.55;flex:none}.dsh-st-model-select-menu{z-index:30;width:min(240px,calc(100vw - 32px));max-height:min(360px,calc(100vh - 96px));overflow:hidden;padding:4px;border:1px solid var(--dsw-alias-border-inverted,var(--dsw-alias-border-l2));border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base));box-shadow:var(--dsw-shadow-lv3)}.dsh-st-model-select-menu.is-float{position:absolute;z-index:1200;box-sizing:border-box}.dsh-st-model-select-menu .dsh-st-menu-row{min-height:40px;padding:0 10px;border-radius:10px;font-size:14px}.dsh-st-model-select-menu .dsh-st-menu-row.is-kv .dsh-st-menu-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary)}.dsh-st-model-group+.dsh-st-model-group{margin-top:4px}.dsh-st-model-group-title{position:sticky;top:0;z-index:1;padding:5px 8px 3px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base));color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:500;line-height:18px}.dsh-st-model-option{display:flex;width:100%;min-height:38px;align-items:center;gap:8px;padding:6px 8px;border:0;border-radius:10px;background:transparent;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer}.dsh-st-model-option:hover,.dsh-st-model-option:focus-visible{background:var(--dsw-alias-interactive-bg-hover);outline:none}.dsh-st-model-option-copy{display:flex;min-width:0;flex:1;flex-direction:column}.dsh-st-model-name{overflow:hidden;font-size:14px;font-weight:500;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.dsh-st-model-check{display:grid;flex:0 0 18px;place-items:center;color:var(--dsw-alias-label-primary)}
|
|
2927
2950
|
.dsh-st-suffix{color:var(--dsw-alias-label-secondary);font-size:13px}
|
|
2928
2951
|
.dsh-st-inline input.is-narrow{width:72px;flex:none}
|
|
2929
2952
|
.dsh-st-time{display:inline-flex;align-items:center;gap:2px;min-height:36px;padding:0 8px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:rgba(255,255,255,.04)}
|