dsh-model-health 0.2.16 → 0.2.17
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/dist/index.js +7 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45,19 +45,13 @@ function parseSettingsContent(raw) {
|
|
|
45
45
|
}
|
|
46
46
|
/** 返回当前存在的候选设置文件路径(按优先级排列)。 */
|
|
47
47
|
function settingsPaths(profile) {
|
|
48
|
+
if (profile) return [join(profile.dir, "cordis.yml"), profile.patchPath].filter((p) => existsSync(p));
|
|
48
49
|
const home = dshHome();
|
|
49
50
|
const out = [];
|
|
50
51
|
for (const name of ["settings.yaml", "settings.yaml.imported"]) {
|
|
51
52
|
const p = join(home, name);
|
|
52
53
|
if (existsSync(p)) out.push(p);
|
|
53
54
|
}
|
|
54
|
-
if (profile) {
|
|
55
|
-
for (const p of [
|
|
56
|
-
join(home, "cordis.patch.yml"),
|
|
57
|
-
join(profile.dir, "cordis.yml"),
|
|
58
|
-
profile.patchPath
|
|
59
|
-
]) if (existsSync(p)) out.push(p);
|
|
60
|
-
}
|
|
61
55
|
return out;
|
|
62
56
|
}
|
|
63
57
|
/** 按文件 mtime 缓存解析结果:同一份文件只解析一次,内容变了自动失效。 */
|
|
@@ -92,10 +86,14 @@ function readSettingsFrom(paths) {
|
|
|
92
86
|
}
|
|
93
87
|
/**
|
|
94
88
|
* 读取当前生效的 DSH 模型配置。
|
|
95
|
-
* @param profile 新版 DSH 的 profileContext(可空,空时按旧版逻辑只读 settings.yaml
|
|
89
|
+
* @param profile 新版 DSH 的 profileContext(可空,空时按旧版逻辑只读 settings.yaml)。
|
|
90
|
+
* 新版下 profile 目录连候选文件都没有时返回空配置(该 profile 确实没配置模型),
|
|
91
|
+
* 而不是抛「未找到配置文件」——空是合法状态,面板应显示空态。
|
|
96
92
|
*/
|
|
97
93
|
function readSettingsCached(profile) {
|
|
98
|
-
|
|
94
|
+
const paths = settingsPaths(profile);
|
|
95
|
+
if (profile && paths.length === 0) return {};
|
|
96
|
+
return readSettingsFrom(paths);
|
|
99
97
|
}
|
|
100
98
|
//#endregion
|
|
101
99
|
//#region src/host/models.ts
|
package/package.json
CHANGED