dsh-plugin-system-status 0.1.0 → 0.1.1
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 +4 -1
- package/client.js +22 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# dsh-plugin-system-status
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-plugin-system-status)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
3
6
|
一个 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)插件:在对话页输入框下方常驻显示本机的 **CPU、内存、GPU、显存、GPU 温度** 实时读数,并从左侧栏进入 **历史曲线**(CPU、GPU、内存、显存、GPU 温度、各磁盘已用空间)。
|
|
4
7
|
|
|
5
|
-
A DSH plugin (`dsh-plugin`) that shows live CPU / memory / GPU / VRAM / GPU temperature under the composer, with historical charts behind a left-sidebar entry.
|
|
8
|
+
A DSH plugin (`dsh-plugin`) that shows live CPU / memory / GPU / VRAM / GPU temperature under the composer, with historical charts behind a left-sidebar entry. Install it by name: `dsh-plugin-system-status`.
|
|
6
9
|
|
|
7
10
|
<p align="center"><img src="icon.svg" width="96" height="96" alt="System status icon"></p>
|
|
8
11
|
|
package/client.js
CHANGED
|
@@ -126,26 +126,42 @@ window.__ModuleLoader__.load({
|
|
|
126
126
|
translate = null
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
const
|
|
129
|
+
const activeLanguage = () => {
|
|
130
130
|
try {
|
|
131
|
-
|
|
131
|
+
const active = locale?.getLocale?.().active
|
|
132
|
+
if (typeof active === 'string' && active !== '') return active
|
|
132
133
|
} catch {
|
|
133
|
-
|
|
134
|
+
/* fall through to the browser language */
|
|
134
135
|
}
|
|
136
|
+
try {
|
|
137
|
+
if (typeof navigator !== 'undefined' && typeof navigator.language === 'string') {
|
|
138
|
+
return navigator.language
|
|
139
|
+
}
|
|
140
|
+
} catch {
|
|
141
|
+
/* fall through to English */
|
|
142
|
+
}
|
|
143
|
+
return 'en'
|
|
135
144
|
}
|
|
145
|
+
const isChinese = () => activeLanguage().toLowerCase().startsWith('zh')
|
|
136
146
|
return {
|
|
137
147
|
disposers,
|
|
138
148
|
t(key) {
|
|
149
|
+
// Both inline dictionaries are complete, so the active language decides
|
|
150
|
+
// directly and a missing locale service only degrades to the browser
|
|
151
|
+
// language instead of silently forcing English.
|
|
152
|
+
const primary = isChinese() ? DICT.zh : DICT.en
|
|
153
|
+
const secondary = isChinese() ? DICT.en : DICT.zh
|
|
154
|
+
if (typeof primary[key] === 'string') return primary[key]
|
|
155
|
+
if (typeof secondary[key] === 'string') return secondary[key]
|
|
139
156
|
if (translate !== null) {
|
|
140
157
|
try {
|
|
141
158
|
const value = translate(key)
|
|
142
159
|
if (typeof value === 'string' && value !== '' && value !== key) return value
|
|
143
160
|
} catch {
|
|
144
|
-
/* fall through to the
|
|
161
|
+
/* fall through to the key */
|
|
145
162
|
}
|
|
146
163
|
}
|
|
147
|
-
|
|
148
|
-
return dict[key] ?? DICT.en[key] ?? key
|
|
164
|
+
return key
|
|
149
165
|
},
|
|
150
166
|
subscribe: typeof locale?.subscribe === 'function' ? (fn) => locale.subscribe(fn) : null,
|
|
151
167
|
}
|
package/package.json
CHANGED