Merge branch 'master' into master

This commit is contained in:
叫我小杨同学 authored and GitHub committed 2026-08-30 01:41:20 +08:00
commit fa14110e94
3 files changed
+33 -6

No files matched your search

+25
View File
@@ -64,6 +64,28 @@ export function findShimDir() {
return null;
}
/**
* 定位 DSH Desktop 解包后的 @deepseek-ai 依赖目录。
* Electron 将 app.asar 中标记为 unpacked 的文件放在相邻目录,补丁应写入该真实路径。
*/
function findDesktopAiBase() {
const candidates = [];
if (typeof process.resourcesPath === "string" && process.resourcesPath.trim()) {
candidates.push(path.join(process.resourcesPath, "app.asar.unpacked", "node_modules", "@deepseek-ai"));
}
// ELECTRON_RUN_AS_NODE 模式没有稳定的 resourcesPath,按可执行文件位置回推 Contents/Resources。
const contentsDir = path.dirname(path.dirname(process.execPath));
candidates.push(path.join(contentsDir, "Resources", "app.asar.unpacked", "node_modules", "@deepseek-ai"));
for (const candidate of candidates) {
if (fs.existsSync(path.join(candidate, "dsh-agent-instructions", "lib"))) {
return path.normalize(candidate);
}
}
return null;
}
export function findAiBase() {
const env = process.env.DSH_BASE;
if (env && env.trim()) {
@@ -71,6 +93,9 @@ export function findAiBase() {
if (fs.existsSync(path.join(p, "dsh-agent-instructions", "lib"))) return p;
}
const desktopBase = findDesktopAiBase();
if (desktopBase) return desktopBase;
const rel = path.join("node_modules", "@deepseek-ai", "dsh", "node_modules", "@deepseek-ai");
const prefix = findNpmPrefix();