dsh-per-message-model 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 +12 -12
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -82,13 +82,14 @@ window.__ModuleLoader__.load({
|
|
|
82
82
|
* hook-based state in dock seats; the unfold/collapse is a pure DOM class
|
|
83
83
|
* toggle plus an inline transform on the icon, so it works in any host.
|
|
84
84
|
*/
|
|
85
|
-
function
|
|
85
|
+
function MessageModelBadge({ messageId, useProjection, t }) {
|
|
86
86
|
let value = null;
|
|
87
87
|
try { value = useProjection("perMessageModel"); } catch (err) { value = null; }
|
|
88
88
|
const hasValue = value !== null && value !== void 0 && typeof value === "object";
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const
|
|
89
|
+
const messages = hasValue && typeof value.messages === "object" && value.messages !== null ? value.messages : null;
|
|
90
|
+
const entry = messages !== null && typeof messageId === "string" ? messages[messageId] : null;
|
|
91
|
+
const provider = entry !== null && typeof entry === "object" && typeof entry.provider === "string" ? entry.provider : null;
|
|
92
|
+
const model = entry !== null && typeof entry === "object" && typeof entry.model === "string" ? entry.model : null;
|
|
92
93
|
let label;
|
|
93
94
|
try { label = provider !== null && model !== null ? provider + " / " + model : (typeof t === "function" ? t("badge.unknown") : "model unknown"); }
|
|
94
95
|
catch (err) { label = provider !== null && model !== null ? provider + " / " + model : "model unknown"; }
|
|
@@ -129,8 +130,7 @@ window.__ModuleLoader__.load({
|
|
|
129
130
|
"data-open": "false"
|
|
130
131
|
}, label)
|
|
131
132
|
]);
|
|
132
|
-
}
|
|
133
|
-
//#endregion //#endregion
|
|
133
|
+
}//#endregion //#endregion
|
|
134
134
|
//#region client divider
|
|
135
135
|
/** Fixed Chinese copy for the model-switch divider (user-required). */
|
|
136
136
|
const SWITCH_COPY = "模型切换:";
|
|
@@ -270,10 +270,10 @@ window.__ModuleLoader__.load({
|
|
|
270
270
|
`[data-dsh-model-switch] [class*="-divider-model"]{flex:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-primary);font-weight:700}`,
|
|
271
271
|
`[data-dsh-model-switch] [class*="-divider-arrow"]{flex:none;display:inline-flex;align-items:center;color:var(--dsw-alias-label-tertiary)}`,
|
|
272
272
|
// Composer-dock model button: chip icon + unfoldable label (scroll).
|
|
273
|
-
`[data-dsh-per-message-model-footer]{display:inline-flex;align-items:center;gap:
|
|
273
|
+
`[data-dsh-per-message-model-footer]{display:inline-flex;align-items:center;gap:4px;padding:2px 6px;border:1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.25));border-radius:6px;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;max-width:100%;width:fit-content;flex:none;overflow:hidden;vertical-align:middle}`,
|
|
274
274
|
`[data-dsh-per-message-model-footer]:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.12))}`,
|
|
275
275
|
`[data-dsh-per-message-model-footer] [class*="-footer-icon"]{display:inline-flex;align-items:center;flex:none;transition:transform .45s cubic-bezier(.34,1.56,.64,1)}`,
|
|
276
|
-
`[data-dsh-per-message-model-footer] [class*="-footer-label"]{display:inline-block;overflow:hidden;white-space:nowrap;max-width:0;opacity:0;transition:max-width .45s cubic-bezier(.4,0,.2,1),opacity .35s ease;font-size:
|
|
276
|
+
`[data-dsh-per-message-model-footer] [class*="-footer-label"]{display:inline-block;overflow:hidden;white-space:nowrap;max-width:0;opacity:0;transition:max-width .45s cubic-bezier(.4,0,.2,1),opacity .35s ease;font-size:11px;line-height:16px;color:var(--dsw-alias-label-primary);font-weight:600}`,
|
|
277
277
|
`[data-dsh-per-message-model-footer] [class*="-footer-label"][data-open="true"]{max-width:360px;opacity:1}`
|
|
278
278
|
].join("\n");
|
|
279
279
|
document.head.appendChild(badgeStyle);
|
|
@@ -285,12 +285,12 @@ window.__ModuleLoader__.load({
|
|
|
285
285
|
locale: NS,
|
|
286
286
|
order: 90
|
|
287
287
|
}, ModelSwitchDivider));
|
|
288
|
-
ctx.slots.inject("conversation.
|
|
289
|
-
name: "conversation.
|
|
288
|
+
ctx.slots.inject("conversation.chat.assistant-actions", () => ctx.slots.register({
|
|
289
|
+
name: "conversation.chat.assistant-actions",
|
|
290
290
|
id: "dsh-per-message-model-footer",
|
|
291
291
|
locale: NS,
|
|
292
|
-
order:
|
|
293
|
-
},
|
|
292
|
+
order: 40
|
|
293
|
+
}, MessageModelBadge));
|
|
294
294
|
}
|
|
295
295
|
//#endregion
|
|
296
296
|
exports.apply = apply;
|