dsh-screen-beyond 0.5.8 → 0.5.9
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 +1 -1
- package/package.json +1 -1
- package/runtime/server.mjs +7 -2
- package/runtime/settings.html +2 -2
package/README.md
CHANGED
package/package.json
CHANGED
package/runtime/server.mjs
CHANGED
|
@@ -960,7 +960,9 @@ async function streamText(text) {
|
|
|
960
960
|
function apiKey() {
|
|
961
961
|
const direct = process.env.DEEPSEEK_API_KEY;
|
|
962
962
|
if (direct) return direct;
|
|
963
|
-
|
|
963
|
+
// 插件设置里自己保存的 key 优先于 DSH 其它插件留下的 key:
|
|
964
|
+
// 用户在本插件设置里填了新 key,却被 ~/.dsh 下的旧 key 覆盖,是真实踩过的坑。
|
|
965
|
+
const files = [path.join(ROOT, 'api-key.txt'), path.join(HOME, '.dsh', 'desktop', 'deepseek-api-key'), path.join(HOME, '.dsh', 'llm-deepseek', 'api-key'), path.join(HOME, '.dsh', 'deepseek-api-key')];
|
|
964
966
|
for (const f of files) { try { const s = fs.readFileSync(f, 'utf8').trim(); if (s) return s; } catch {} }
|
|
965
967
|
try { const y = fs.readFileSync(path.join(HOME, '.dsh', '.credentials.yaml'), 'utf8'); const m = y.match(/(?:deepseek[_-]?api[_-]?key|DEEPSEEK_API_KEY)\s*:\s*(\S+)/i); if (m) return m[1].trim(); } catch {}
|
|
966
968
|
throw new Error('没有找到 DeepSeek API Key');
|
|
@@ -978,7 +980,10 @@ async function chatCompletion(body) {
|
|
|
978
980
|
signal: AbortSignal.timeout(180000),
|
|
979
981
|
});
|
|
980
982
|
const text = await res.text();
|
|
981
|
-
if (!res.ok)
|
|
983
|
+
if (!res.ok) {
|
|
984
|
+
if (res.status === 401) throw new Error('DeepSeek API Key 无效(401)。请到「设置 → 模型 → API Key」重新填写 DeepSeek 开放平台的 key,并确认本插件设置里的 key 已保存;如果你刚从别的插件继承过 key,也要检查旧 key 是否还有效。');
|
|
985
|
+
throw new Error('deepseek HTTP ' + res.status + ': ' + text.slice(0, 300));
|
|
986
|
+
}
|
|
982
987
|
const j = JSON.parse(text);
|
|
983
988
|
return j;
|
|
984
989
|
}
|
package/runtime/settings.html
CHANGED
|
@@ -85,7 +85,7 @@ input[type=range]{flex:1;accent-color:#2563eb}
|
|
|
85
85
|
<a href="#data" data-tab="data"><span>💾</span>数据</a>
|
|
86
86
|
<a href="#tutorial" data-tab="tutorial"><span>📖</span>教程</a>
|
|
87
87
|
</nav>
|
|
88
|
-
<div class="sidefoot">v0.5.
|
|
88
|
+
<div class="sidefoot">v0.5.9 · <span id="sideMode">…</span><br><a href="/screen" target="_blank" style="color:#3b82f6;text-decoration:none;margin-right:10px">看屏幕</a><a href="/" style="color:#3b82f6;text-decoration:none">回到聊天</a></div>
|
|
89
89
|
</aside>
|
|
90
90
|
|
|
91
91
|
<div class="main">
|
|
@@ -960,7 +960,7 @@ async function renderData(){
|
|
|
960
960
|
+ '</div>'
|
|
961
961
|
+ '<div class="card"><h2>备份</h2><div class="small">导出把数据目录打包成 zip;导入覆盖恢复。系统每天凌晨 4 点后会自动备份一次。</div>'
|
|
962
962
|
+ '<div class="row"><button class="btn primary" onclick="doBackup()">立即备份</button><span class="hint" style="flex:1;margin-left:8px">备份到数据目录下的 backups</span></div><button class="btn ghost" style="margin-top:8px">导出备份</button></div>'
|
|
963
|
-
+ '</div><div class="col side2"><div class="card"><h2>版本</h2><div class="small">v0.5.
|
|
963
|
+
+ '</div><div class="col side2"><div class="card"><h2>版本</h2><div class="small">v0.5.9 · 本地运行时</div></div></div></div>';
|
|
964
964
|
}
|
|
965
965
|
|
|
966
966
|
// ================= router =================
|