feat(doctor): suppress duplicate filename warnings when full path syntax is active (#917)

This commit is contained in:
Will Miao
2026-05-22 22:35:06 +08:00
parent 806555cf06
commit f105500740
3 changed files with 26 additions and 0 deletions

View File

@@ -686,6 +686,9 @@ class DoctorHandler:
)
async def resolve_filename_conflicts(self, request: web.Request) -> web.Response:
if self._settings.get("lora_syntax_format", "legacy") == "full":
return web.json_response({"success": True, "renamed": [], "count": 0})
renamed: list[dict[str, Any]] = []
try:
@@ -990,6 +993,18 @@ class DoctorHandler:
}
async def _check_filename_conflicts(self) -> dict[str, Any]:
# When full path syntax is active, duplicate filenames across subfolders
# are not ambiguous (<lora:subfolder/name:strength>), so skip the check.
if self._settings.get("lora_syntax_format", "legacy") == "full":
return {
"id": "filename_conflicts",
"title": "Duplicate Filename Conflicts",
"status": "ok",
"summary": "Full path syntax is active — duplicate filenames across folders are not ambiguous.",
"details": [],
"actions": [],
}
all_conflicts: list[dict[str, Any]] = []
total_conflict_groups = 0
total_conflict_files = 0

View File

@@ -1177,6 +1177,12 @@ class ModelQueryHandler:
async def find_filename_conflicts(self, request: web.Request) -> web.Response:
try:
settings = get_settings_manager()
if settings.get("lora_syntax_format", "legacy") == "full":
return web.json_response(
{"success": True, "conflicts": [], "count": 0}
)
duplicates = self._service.find_duplicate_filenames()
result = []
cache = await self._service.scanner.get_cached_data()

View File

@@ -1120,6 +1120,11 @@ class ModelScanner:
if self._hash_index is None or self.model_type != "lora":
return
# When full path syntax is active, duplicate filenames across subfolders
# are fully qualified, so there is no ambiguity — skip the warning.
if get_settings_manager().get("lora_syntax_format", "legacy") == "full":
return
duplicates = self._hash_index.get_duplicate_filenames()
if not duplicates:
return