@dsh-tom/dsh-css 0.2.10 → 0.2.11
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/README.md +2 -2
- package/dist/client.js +31 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npm publish --access public --registry=https://registry.npmjs.org/
|
|
|
22
22
|
打开 **插件 → 添加插件 → 安装第三方插件**,在“包名或地址”输入:
|
|
23
23
|
|
|
24
24
|
```text
|
|
25
|
-
D:\product\dsh-css\dsh-tom-dsh-css-0.2.
|
|
25
|
+
D:\product\dsh-css\dsh-tom-dsh-css-0.2.11.tgz
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
安装并启用,然后完全退出并重新打开 dsh。
|
|
@@ -32,7 +32,7 @@ D:\product\dsh-css\dsh-tom-dsh-css-0.2.10.tgz
|
|
|
32
32
|
包发布到 npmjs 后,先卸载已安装的旧版,再打开 **插件 → 添加插件 → 安装第三方插件**,输入:
|
|
33
33
|
|
|
34
34
|
```text
|
|
35
|
-
@dsh-tom/dsh-css@0.2.
|
|
35
|
+
@dsh-tom/dsh-css@0.2.11
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
选择 **安装源 → npm 官方源**,安装并启用,然后完全退出并重新打开 dsh。
|
package/dist/client.js
CHANGED
|
@@ -1083,24 +1083,37 @@ function replacePercent(value, percent) {
|
|
|
1083
1083
|
function registerCacheHitPrecision(ctx) {
|
|
1084
1084
|
const slot = "conversation.composer.dock";
|
|
1085
1085
|
ctx.slots.inject(slot, () => {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1086
|
+
let original;
|
|
1087
|
+
let dispose;
|
|
1088
|
+
const sync = () => {
|
|
1089
|
+
if (original && ctx.slots.entries(slot).includes(original)) return;
|
|
1090
|
+
dispose?.();
|
|
1091
|
+
dispose = void 0;
|
|
1092
|
+
original = ctx.slots.entries(slot).find((entry) => entry.options.id === "usage");
|
|
1093
|
+
if (!original) return;
|
|
1094
|
+
const renderUsage = original.component.type;
|
|
1095
|
+
function UsagePill(props) {
|
|
1096
|
+
const element = renderUsage(props);
|
|
1097
|
+
const usage = props.useProjection("tokenUsage");
|
|
1098
|
+
if (!usage) return element;
|
|
1099
|
+
const input2 = usage.uncachedInputTokens + usage.cacheReadTokens + usage.cacheWriteTokens;
|
|
1100
|
+
if (input2 === 0) return element;
|
|
1101
|
+
return replacePercent(element, (usage.cacheReadTokens / input2 * 100).toFixed(2));
|
|
1102
|
+
}
|
|
1103
|
+
dispose = ctx.slots.register({
|
|
1104
|
+
...original.options,
|
|
1105
|
+
name: slot,
|
|
1106
|
+
priority: (original.options.priority ?? 0) - 1,
|
|
1107
|
+
locale: original.locale,
|
|
1108
|
+
inject: original.inject
|
|
1109
|
+
}, UsagePill);
|
|
1110
|
+
};
|
|
1111
|
+
const unsubscribe = ctx.slots.subscribe(slot, sync);
|
|
1112
|
+
sync();
|
|
1113
|
+
return () => {
|
|
1114
|
+
unsubscribe();
|
|
1115
|
+
dispose?.();
|
|
1116
|
+
};
|
|
1104
1117
|
});
|
|
1105
1118
|
}
|
|
1106
1119
|
|