feat: Implement filename-based hash retrieval in LoraScanner and ModelScanner for improved compatibility

This commit is contained in:
Will Miao
2025-04-19 21:12:26 +08:00
parent 30d7c007de
commit 1faa70fc77
4 changed files with 56 additions and 23 deletions

View File

@@ -832,6 +832,10 @@ class ModelScanner:
def get_hash_by_path(self, file_path: str) -> Optional[str]:
"""Get hash for a model by its file path"""
return self._hash_index.get_hash(file_path)
def get_hash_by_filename(self, filename: str) -> Optional[str]:
"""Get hash for a model by its filename without path"""
return self._hash_index.get_hash_by_filename(filename)
# TODO: Adjust this method to use metadata instead of finding the file
def get_preview_url_by_hash(self, sha256: str) -> Optional[str]: