The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(HuggingFace): 修复文件选择功能失效及子目录 404
XiaoYouChR07957f648d4d
diff --git a/app/models/task.py b/app/models/task.pyindex b5f8811d..7a9e6ba5 100644--- a/app/models/task.py+++ b/app/models/task.py@@ -228,7 +228,7 @@ class Task:fileSize: int = 0files: list[TaskFile] | None = Nonecategory: str | None = None- stepType: Type[TaskStep] | None = field(default=None, repr=False)+ stepType: ClassVar[Type[TaskStep] | None] = None@propertydef outputPath(self) -> str:diff --git a/features/ftp_pack/task.py b/features/ftp_pack/task.pyindex 97dde4ae..e6c9cbf2 100644--- a/features/ftp_pack/task.py+++ b/features/ftp_pack/task.py@@ -496,7 +496,7 @@ class FtpTask(Task):fileType = FtpFileconnectionInfo: FtpConnectionInfosourceType: str = "file"- stepType: type = field(default=FtpStep, repr=False)+ stepType = FtpStepdef __post_init__(self):if isinstance(self.connectionInfo, dict):diff --git a/features/huggingface_pack/cards.py b/features/huggingface_pack/cards.pyindex 4197d910..07ad7f5b 100644--- a/features/huggingface_pack/cards.py+++ b/features/huggingface_pack/cards.py@@ -62,20 +62,21 @@ class HuggingFaceDraftCard(UniversalDraftCard):class HuggingFaceTaskCard(UniversalTaskCard):def __init__(self, task: HuggingFaceTask, parent=None):super().__init__(task, parent)- self.selectFilesButton = ToolButton(FluentIcon.LIBRARY, self)- self.hBoxLayout.insertWidget(- self.hBoxLayout.indexOf(self.verifyHashButton),- self.selectFilesButton,- )- self.selectFilesButton.clicked.connect(self._onSelectFilesClicked)+ self.selectFilesButton = None+ if task.files and len(task.files) > 1:+ self.selectFilesButton = ToolButton(FluentIcon.LIBRARY, self)+ self.hBoxLayout.insertWidget(+ self.hBoxLayout.indexOf(self.verifyHashButton),+ self.selectFilesButton,+ )+ self.selectFilesButton.clicked.connect(self._onSelectFilesClicked)def refresh(self, force: bool = False) -> None:super().refresh(force=force)- hasMultipleFiles = self._task.files and len(self._task.files) > 1- self.selectFilesButton.setVisible(hasMultipleFiles)- self.selectFilesButton.setEnabled(self._task.status != TaskStatus.RUNNING)+ if self.selectFilesButton is not None:+ self.selectFilesButton.setEnabled(self._task.status != TaskStatus.RUNNING)- if self._task.status in {TaskStatus.WAITING, TaskStatus.COMPLETED} and hasMultipleFiles and not self._fileMissing:+ if self._task.status in {TaskStatus.WAITING, TaskStatus.COMPLETED} and self.selectFilesButton is not None and not self._fileMissing:selected = sum(1 for f in self._task.files if f.selected)self.statusLabel.setText(self.tr("{0}/{1} 个文件").format(selected, len(self._task.files)))diff --git a/features/huggingface_pack/pack.py b/features/huggingface_pack/pack.pyindex dd6da235..8d753236 100644--- a/features/huggingface_pack/pack.py+++ b/features/huggingface_pack/pack.py@@ -177,7 +177,8 @@ class HuggingFaceParser(TaskParser):if entry.get("type") == "file":entries.append(entry)elif entry.get("type") == "directory":- subUrl = f"{apiUrl}/{entry['path']}"+ dirName = entry['path'].rsplit('/', 1)[-1]+ subUrl = f"{apiUrl}/{dirName}"subEntries = await self._fetchTree(client, subUrl)entries.extend(subEntries)break