Enabled editing model notes in download tab.

This commit is contained in:
Christian Bastian
2024-08-17 04:04:49 -04:00
parent 70d55e3319
commit 75879a5403

View File

@@ -3496,6 +3496,14 @@ class DownloadView {
}, },
}); });
const infoNotes = $el("textarea.comfy-multiline-input", {
name: "model info notes",
value: info["description"]??"",
rows: 6,
disabled: false,
style: { display: info["description"] === undefined || info["description"] === "" ? "none" : "" },
});
const filepath = info["downloadFilePath"]; const filepath = info["downloadFilePath"];
const modelInfo = $el("details.download-details", [ const modelInfo = $el("details.download-details", [
$el("summary", [filepath + info["fileName"]]), $el("summary", [filepath + info["fileName"]]),
@@ -3547,12 +3555,12 @@ class DownloadView {
return [false, "📥︎"]; return [false, "📥︎"];
}); });
if (success) { if (success) {
const description = info["description"]; const description = infoNotes.value;
if (this.elements.downloadNotes.checked && description !== "") { if (this.elements.downloadNotes.checked && description !== "") {
const modelPath = pathDirectory + searchSeparator + modelName; const modelPath = pathDirectory + searchSeparator + modelName;
const saved = await saveNotes(modelPath, description); const saved = await saveNotes(modelPath, description);
if (!saved) { if (!saved) {
console.warn("Description was note saved as notes!"); console.warn("Model description was not saved!");
} }
} }
this.#updateModels(); this.#updateModels();
@@ -3569,13 +3577,7 @@ class DownloadView {
el_filename, el_filename,
]), ]),
downloadPreviewSelect.elements.radioGroup, downloadPreviewSelect.elements.radioGroup,
$el("textarea.comfy-multiline-input", { infoNotes,
name: "model info notes",
value: info["description"]??"",
rows: 6,
disabled: true,
style: { display: info["description"] === undefined || info["description"] === "" ? "none" : "" },
})
]), ]),
]), ]),
]), ]),