@guojinpeng/dsh-cost-meter 0.1.4 → 0.1.5
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 +3 -3
- package/README.zh-CN.md +3 -3
- package/dist/client.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,10 +76,10 @@ npm pack
|
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
`npm pack` also runs the build. It creates `guojinpeng-dsh-cost-meter-<version>.tgz`.
|
|
79
|
-
Install the generated file in your DSH profile. For version 0.1.
|
|
79
|
+
Install the generated file in your DSH profile. For version 0.1.5:
|
|
80
80
|
|
|
81
81
|
```powershell
|
|
82
|
-
dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.
|
|
82
|
+
dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.5.tgz
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
Restart DSH and check the plugin. Repeat the build, package and install steps after changes.
|
|
@@ -125,7 +125,7 @@ After npm publication succeeds, create the matching Git tag and GitHub Release:
|
|
|
125
125
|
```powershell
|
|
126
126
|
git tag v<version>
|
|
127
127
|
git push origin v<version>
|
|
128
|
-
gh release create v<version> --verify-tag --title "
|
|
128
|
+
gh release create v<version> --verify-tag --title "<version>" --generate-notes --latest
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
Replace `<version>` before you run these commands. GitHub Releases contain release
|
package/README.zh-CN.md
CHANGED
|
@@ -76,10 +76,10 @@ npm pack
|
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
`npm pack` 也会执行构建,生成 `guojinpeng-dsh-cost-meter-<版本号>.tgz`。
|
|
79
|
-
将生成的文件安装到你的 DSH profile。以 0.1.
|
|
79
|
+
将生成的文件安装到你的 DSH profile。以 0.1.5 为例:
|
|
80
80
|
|
|
81
81
|
```powershell
|
|
82
|
-
dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.
|
|
82
|
+
dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.5.tgz
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
重启 DSH,检查插件。每次修改后,重新构建、打包并安装。
|
|
@@ -125,7 +125,7 @@ npm 发布成功后,创建对应的 Git 标签和 GitHub Release:
|
|
|
125
125
|
```powershell
|
|
126
126
|
git tag v<version>
|
|
127
127
|
git push origin v<version>
|
|
128
|
-
gh release create v<version> --verify-tag --title "
|
|
128
|
+
gh release create v<version> --verify-tag --title "<version>" --generate-notes --latest
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
执行前替换 `<version>`。GitHub Release 用于发布说明,无需上传安装包。
|
package/dist/client.js
CHANGED
|
@@ -261,7 +261,7 @@ function createUseCostView(react, store) {
|
|
|
261
261
|
const raw = props.useProjection(PROJECTION_KEY);
|
|
262
262
|
const snapshot = react.useSyncExternalStore(store.subscribe, store.getSnapshot);
|
|
263
263
|
const loadStatus = react.useSyncExternalStore(store.subscribe, store.getLoadStatus);
|
|
264
|
-
const missing =
|
|
264
|
+
const missing = snapshot ? (raw == null ? void 0 : raw.accounting) && Object.keys(raw.accounting.byRoute).some((key) => key && !snapshot.config.pricing[key]) : !raw || raw.unpricedTokens !== 0;
|
|
265
265
|
react.useEffect(() => {
|
|
266
266
|
if (!snapshot || (raw == null ? void 0 : raw.accounting) && Object.keys(raw.accounting.byRoute).some((key) => key && !snapshot.config.pricing[key]))
|
|
267
267
|
store.load().catch(() => {
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ function createHistoryModels(sessionQuery, { readConfig: readConfig2, writeConfi
|
|
|
116
116
|
let missing;
|
|
117
117
|
do {
|
|
118
118
|
missing = Object.fromEntries([...models].filter(needsPrice).map((key) => [key, zeroRate()]));
|
|
119
|
-
if (!initializedOnce
|
|
119
|
+
if (Object.keys(missing).length || !initializedOnce && !Object.keys(config.pricing).length) {
|
|
120
120
|
initializedOnce = true;
|
|
121
121
|
try {
|
|
122
122
|
Object.assign(initialized, (await initializePrices({ ...config, pricing: missing })).config.pricing);
|
package/package.json
CHANGED