dsh-novel-writer 3.1.0 → 3.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/lib/client.js +10 -1
- package/lib/index.js +14 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1161,7 +1161,7 @@ var TOOL_GROUPS = [
|
|
|
1161
1161
|
isDefault ? el("div", { style: { fontSize: "10px", color: "#cbd5e1", marginTop: "1px" } }, t("creation.defaultHint")) : null
|
|
1162
1162
|
),
|
|
1163
1163
|
el("button", { type: "button", onClick: function () { props.controller.set({ creationBook: name, creationDraft: null, creationDirty: false }); props.controller.openView("creation-form"); } }, t("creation.edit")),
|
|
1164
|
-
isDefault ? null : el("button", { type: "button", onClick: function () { var patch = {}; patch[name] = null; props.toggle({ creationProfiles: patch }); props.controller.set({ revealMsg: t("creation.deleted"), revealErr: false }); } }, t("creation.delete"))
|
|
1164
|
+
isDefault ? null : el("button", { type: "button", onClick: function () { var patch = {}; patch[name] = null; props.toggle({ creationProfiles: patch }); var nb = (props.controller.getSnapshot().books || []).filter(function (b) { return b !== name; }); props.controller.set({ books: nb, revealMsg: t("creation.deleted"), revealErr: false }); } }, t("creation.delete"))
|
|
1165
1165
|
);
|
|
1166
1166
|
}
|
|
1167
1167
|
body = el("div", null,
|
|
@@ -1532,6 +1532,15 @@ var TOOL_GROUPS = [
|
|
|
1532
1532
|
if (patch.tools && typeof patch.tools === "object") {
|
|
1533
1533
|
merged.tools = Object.assign({}, cur.tools || {}, patch.tools);
|
|
1534
1534
|
}
|
|
1535
|
+
// v3.1.1:creationProfiles 深合并(null 键=删除该书的设定,本地立即生效)
|
|
1536
|
+
if (patch.creationProfiles && typeof patch.creationProfiles === "object") {
|
|
1537
|
+
var mergedCp = Object.assign({}, cur.creationProfiles || {});
|
|
1538
|
+
for (var cpk in patch.creationProfiles) {
|
|
1539
|
+
if (patch.creationProfiles[cpk] === null) delete mergedCp[cpk];
|
|
1540
|
+
else mergedCp[cpk] = patch.creationProfiles[cpk];
|
|
1541
|
+
}
|
|
1542
|
+
merged.creationProfiles = mergedCp;
|
|
1543
|
+
}
|
|
1535
1544
|
controller.set(merged);
|
|
1536
1545
|
try {
|
|
1537
1546
|
var remote = await saveState(patch);
|
package/lib/index.js
CHANGED
|
@@ -1803,6 +1803,20 @@ async function syncCreationProfileFiles(root, patchProfiles, nextProfiles) {
|
|
|
1803
1803
|
const cnext = upsertCreationSection(ccur, "", "【用户角色设定】");
|
|
1804
1804
|
if (cnext !== ccur) await writeFile(cf, cnext, "utf8");
|
|
1805
1805
|
}
|
|
1806
|
+
// v3.1.1:空壳文件夹清理——所有文件只剩模板骨架(无模型内容)时整目录删除,避免空文件夹堆积
|
|
1807
|
+
const dir3 = join(base, sanitizeSegment(book, "book"));
|
|
1808
|
+
if (existsSync(dir3)) {
|
|
1809
|
+
let anyContent = false;
|
|
1810
|
+
for (const fname of Object.values(CREATION_FILES)) {
|
|
1811
|
+
const fp = join(dir3, fname);
|
|
1812
|
+
if (existsSync(fp)) {
|
|
1813
|
+
const c = await readFile(fp, "utf8");
|
|
1814
|
+
const meaningful = c.split("\n").map(function (l) { return l.trim(); }).filter(Boolean).filter(function (l) { return !l.startsWith("#") && !l.startsWith("(") && !l.startsWith("【"); });
|
|
1815
|
+
if (meaningful.length > 0) { anyContent = true; break; }
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
if (!anyContent) await rm(dir3, { recursive: true, force: true });
|
|
1819
|
+
}
|
|
1806
1820
|
} catch { /* 忽略 */ }
|
|
1807
1821
|
}
|
|
1808
1822
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-novel-writer",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "小说写作助手 / Novel Writing Assistant for DeepSeek Harness — sentence/emotion/imagery analysis, 6-dim writing baseline band, 12-axis vibe spectrum, style report, original-creation mode with per-book profiles, local semantic search (0 token), plot & settings management.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|