-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: 模型下载完成后自动选择该模型 #956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: 模型下载完成后自动选择该模型 #956
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -574,11 +574,12 @@ def _on_model_download_finished(): | |
| for enum_val in available: | ||
| combo.addItem(enum_val.value, userData=enum_val) | ||
|
|
||
| # 恢复选择 | ||
| if current_value in available: | ||
| combo.setCurrentText(current_value.value) | ||
| elif combo.count() > 0: | ||
| combo.setCurrentIndex(0) | ||
| # 自动选择刚下载的模型 | ||
| downloaded_model_value = model["value"] | ||
| for enum_val in available: | ||
| if enum_val.value == downloaded_model_value: | ||
| combo.setCurrentText(enum_val.value) | ||
| break | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong field compared, downloaded model never auto-selectedHigh Severity The comparison |
||
|
|
||
| InfoBar.success( | ||
| self.tr("下载成功"), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The downloaded model value will never match the enum values. The
model["value"]contains values like "faster-whisper-tiny", "faster-whisper-large-v2", etc., butFasterWhisperModelEnumenum values are "tiny", "large-v2", etc. (without the "faster-whisper-" prefix). The comparisonenum_val.value == downloaded_model_valuewill always be false, so the newly downloaded model will never be selected.To fix this, you need to extract the model name by removing the "faster-whisper-" prefix from the downloaded model value before comparing, or use the existing model_map logic that's already defined at lines 562-564 to properly map between the two formats.