Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@
Text="Emergency stop shortcuts and stop phrases discard the active capture without typing text. Use silence auto-commit or the start / stop shortcut when you want to commit." />
</StackPanel>

<Border Name="FirstRunDownloadHintBorder"
Margin="0,14,0,0"
Padding="14"
Background="{StaticResource HeroCardBackgroundBrush}"
BorderBrush="{StaticResource HeroCardBorderBrush}"
BorderThickness="1"
CornerRadius="10"
Visibility="Collapsed">
<StackPanel>
<TextBlock FontSize="14"
FontWeight="SemiBold"
Text="Ready to download your first model" />
<TextBlock Name="FirstRunDownloadHintText"
Margin="0,6,0,0"
Foreground="{StaticResource TextSecondaryBrush}"
TextWrapping="Wrap" />
</StackPanel>
</Border>

<TextBlock Name="WelcomeFooterText"
Margin="0,18,0,0"
Foreground="{StaticResource TextSecondaryBrush}"
Expand Down
70 changes: 70 additions & 0 deletions SettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ internal SettingsWindow(AppSettings settings, bool isFirstRun, DictationStatsSta

this.InitializeModelSelection(settings);
this.UpdateWindowChrome();

if (isFirstRun)
{
this.UpdateFirstRunDownloadHint();
}
}

internal event Action<AppSettings>? SettingsSaved;
Expand Down Expand Up @@ -1040,6 +1045,10 @@ private void OnSaveClick(object sender, RoutedEventArgs e)
if (ReferenceEquals(this.SetupTabControl.SelectedItem, this.WelcomeTab))
{
this.SetupTabControl.SelectedItem = this.ModelTab;
if (!this.IsCurrentBackendModelInstalled())
{
this.OnDownloadSelectedModelClick(this, new RoutedEventArgs());
}
return;
}

Expand Down Expand Up @@ -2406,6 +2415,67 @@ private void SetModelPathText(string? value)
this.suppressModelPathTextChanged = false;
}

private void UpdateFirstRunDownloadHint()
{
if (this.FirstRunDownloadHintBorder is null || this.FirstRunDownloadHintText is null)
{
return;
}

if (this.IsCurrentBackendModelInstalled())
{
this.FirstRunDownloadHintBorder.Visibility = Visibility.Collapsed;
return;
}

var (name, size) = this.currentBackend switch
{
TranscriptionBackendKind.Moonshine =>
MoonshineModelCatalog.Options
.Where(opt => opt.Recommended)
.Select(opt => (opt.DisplayName, opt.ApproximateSizeLabel))
.FirstOrDefault(("the recommended model", string.Empty)),
TranscriptionBackendKind.Parakeet =>
ParakeetModelCatalog.Options
.Where(opt => opt.Recommended)
.Select(opt => (opt.DisplayName, opt.ApproximateSizeLabel))
.FirstOrDefault(("the recommended model", string.Empty)),
TranscriptionBackendKind.WhisperNet =>
WhisperNetModelCatalog.Options
.Where(opt => opt.Recommended)
.Select(opt => (opt.DisplayName, opt.ApproximateSizeLabel))
.FirstOrDefault(("the recommended model", string.Empty)),
_ =>
WhisperModelCatalog.Options
.Where(opt => opt.Recommended)
.Select(opt => (opt.DisplayName, opt.ApproximateSizeLabel))
.FirstOrDefault(("the recommended model", string.Empty))
};

var sizeNote = string.IsNullOrEmpty(size) ? string.Empty : $" (~{size} download)";
this.FirstRunDownloadHintText.Text =
$"Clicking Next will begin downloading {name}{sizeNote}. " +
"You can change the model choice on the next step before the download finishes.";
this.FirstRunDownloadHintBorder.Visibility = Visibility.Visible;
}

private bool IsCurrentBackendModelInstalled()
{
return this.currentBackend switch
{
TranscriptionBackendKind.Moonshine =>
MoonshineModelCatalog.Options.Any(opt => MoonshineModelCatalog.TryResolveInstalledPath(opt, out _)),
TranscriptionBackendKind.Parakeet =>
ParakeetModelCatalog.Options.Any(opt => ParakeetModelCatalog.TryResolveInstalledPath(opt, out _)),
TranscriptionBackendKind.QualcommQnn =>
QualcommAihubWhisperModelCatalog.Options.Any(opt => QualcommAihubWhisperModelCatalog.TryResolveInstalledPath(opt, out _)),
TranscriptionBackendKind.WhisperNet =>
WhisperNetModelCatalog.Options.Any(opt => WhisperNetModelCatalog.TryResolveInstalledArtifacts(opt, out _)),
_ =>
WhisperModelCatalog.Options.Any(opt => WhisperModelCatalog.TryResolveInstalledPath(opt, out _))
};
}

private void ShowModelDownloadMessage(string message)
{
this.ModelDownloadStatusText.Text = message;
Expand Down
Loading