Merge main: offline-found models keep their name

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DemonGatanjieu
2026-10-11 02:03:47 +08:00
co-authored by Claude Opus 5.5
3 changed files with 11 additions and 2 deletions
+1
View File
@@ -168,6 +168,7 @@
- **A character voice dropped on a TTS node stays put (拖到 TTS 节点的角色声音刷新后还在)**: the same gap as above: reloading right after the drop brought back the node's previous voice, and Ctrl+Z skipped it. Every drop from the browser onto the canvas is now recorded as one history step.
### Fixes
- **Models found offline no longer get their name doubled (离线推断的模型名字不再越叠越长)**: a model Civitai had no record of (or a scan without a connection) is named after its file, as both model and version. With renaming on, a scan renamed it to name_name, and each later scan doubled it again; the details showed "name - name". Such models now keep their file name, a doubled name set by an earlier virtual rename is dropped at the next scan, and the details show the name once. Files already renamed keep their current name (scanning again no longer lengthens it).
- **The Workflows page was blank after opening a workflow (在新画布打开后再打开插件是空的)**: opening a workflow on the canvas (Open on a card or in its details) and then the browser again showed an empty page. The Workflows list is there again.
- **Language follows ComfyUI again (语言跟随 ComfyUI)**: with the language left on "Follow ComfyUI" (the default), changing ComfyUI's language now switches the browser the next time it opens; before, it kept the old language until the page was reloaded.
- **Empty list on the audio pages (音频页左边列表是空的)**: after reloading ComfyUI, a browser that reopened straight onto Voices or Audio showed an empty list column until you switched to the image side and back.
+2 -1
View File
@@ -117,7 +117,8 @@ def _read_metadata(file_path):
name = data.get("name", "")
if "model" in data and isinstance(data["model"], dict):
model_name = data["model"].get("name", "")
name = f"{model_name} - {name}".strip(' -')
# A model and version of one name (what the file alone tells) read once.
name = f"{model_name} - {name}" if model_name and name and model_name != name else model_name or name
description = data.get("description", "") or ""
if not description and "model" in data and isinstance(data["model"], dict):
+8 -1
View File
@@ -215,9 +215,14 @@ def scan_one(args, state, rename_log, root, filename, previous):
info_data = civitai_data
if file_hash:
info_data["anomalous_file_identity"] = computed_file_identity(file_path, file_hash)
# What the file alone tells has no standard name: both names are the file's own, so a
# rename would only repeat it (name_name, then name_name_name_name on the next scan).
inferred = is_unmatched(civitai_data)
# Civitai's name for the card; a name set in the model editor lives in
# <model>.anomalous.json and is shown instead.
if args.virtual_rename:
if inferred:
info_data.pop("anomalous_custom_name", None)
elif args.virtual_rename:
info_data["anomalous_custom_name"] = f"{model_name}_{version_name}"
if not args.dry_run:
with open(old_base + ".info", 'w', encoding='utf-8') as f:
@@ -257,6 +262,8 @@ def scan_one(args, state, rename_log, root, filename, previous):
if args.skip_rename or not args.physical_rename:
print(f"[*] 物理重命名已跳过。仅保存 .info 及其可能包含的虚拟重命名。")
elif inferred:
print(f"[*] 没有 Civitai 的标准名称,保留原文件名。")
elif file_path != new_file_path and new_filename != filename:
if os.path.exists(new_file_path):
print(f"[*] 目标文件名已存在,正在验证内容是否完全相同: {filename}")