@dungsil/dsh-plugin-ui-model-picker 0.2.2 → 0.2.3
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/dist/client.js +6 -5
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -36,7 +36,7 @@ const composerStyles = `
|
|
|
36
36
|
.dsh-plugin-composer-chevron, .dsh-plugin-composer-detail { color: var(--dsw-alias-label-caption); }
|
|
37
37
|
.dsh-plugin-composer-trigger[aria-expanded=true] .dsh-plugin-composer-chevron { transform: rotate(180deg); }
|
|
38
38
|
`;
|
|
39
|
-
const ComposerTrigger = (0, react.forwardRef)(function ComposerTrigger({ className = "", icon, label, detail, ...props }, ref) {
|
|
39
|
+
const ComposerTrigger = /* @__PURE__ */ (0, react.forwardRef)(function ComposerTrigger({ className = "", icon, label, detail, ...props }, ref) {
|
|
40
40
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
41
41
|
...props,
|
|
42
42
|
ref,
|
|
@@ -173,7 +173,7 @@ function apply(ctx) {
|
|
|
173
173
|
const state = (0, react.useSyncExternalStore)(subscribe, getSnapshot);
|
|
174
174
|
const { active: locale } = useLocaleSnapshot(ctx.locale);
|
|
175
175
|
const text = copy[locale.startsWith("ko") ? "ko" : locale.startsWith("zh") ? "zh" : "en"];
|
|
176
|
-
const [
|
|
176
|
+
const [requestedPanel, setPanel] = (0, react.useState)(null);
|
|
177
177
|
const [draft, setDraft] = (0, react.useState)(0);
|
|
178
178
|
const [failed, setFailed] = (0, react.useState)(false);
|
|
179
179
|
const trigger = (0, react.useRef)(null);
|
|
@@ -189,9 +189,10 @@ function apply(ctx) {
|
|
|
189
189
|
id: void 0,
|
|
190
190
|
name: text.default
|
|
191
191
|
}] : [], ...reasoning.efforts] : [];
|
|
192
|
+
const panel = requestedPanel === "effort" && !efforts.length ? "model" : requestedPanel;
|
|
192
193
|
const effective = current?.reasoningEffort ?? reasoning?.defaultEffort;
|
|
193
194
|
const effortIndex = efforts.findIndex((item) => item.id === effective);
|
|
194
|
-
const effortLabel = efforts[effortIndex]?.name ?? state.retainedEffort;
|
|
195
|
+
const effortLabel = efforts.length ? efforts[effortIndex]?.name ?? state.retainedEffort : void 0;
|
|
195
196
|
const busy = state.status === "selecting";
|
|
196
197
|
const disabled = locked || busy;
|
|
197
198
|
(0, react.useEffect)(() => {
|
|
@@ -305,7 +306,7 @@ function apply(ctx) {
|
|
|
305
306
|
label: model?.name ?? current?.model ?? text.model,
|
|
306
307
|
detail: effortLabel,
|
|
307
308
|
disabled,
|
|
308
|
-
"aria-label": `${text.choose}: ${model?.name ?? current?.model ?? text.model}${effortLabel ? `, ${effortLabel}` : ""}`,
|
|
309
|
+
"aria-label": `${efforts.length ? text.choose : text.model}: ${model?.name ?? current?.model ?? text.model}${effortLabel ? `, ${effortLabel}` : ""}`,
|
|
309
310
|
title: `${model?.name ?? current?.model ?? text.model}${effortLabel ? ` ${effortLabel}` : ""}`,
|
|
310
311
|
"aria-haspopup": "dialog",
|
|
311
312
|
"aria-expanded": panel !== null,
|
|
@@ -319,7 +320,7 @@ function apply(ctx) {
|
|
|
319
320
|
"aria-label": panel === "model" ? text.model : text.effort,
|
|
320
321
|
className: "dsh-codex-popover",
|
|
321
322
|
children: [
|
|
322
|
-
panel === "model" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
323
|
+
panel === "model" ? efforts.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
323
324
|
type: "button",
|
|
324
325
|
className: "dsh-codex-back",
|
|
325
326
|
onClick: () => setPanel("effort"),
|