-
-
Notifications
You must be signed in to change notification settings - Fork 542
Add dialog #1227
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
Add dialog #1227
Changes from all commits
634735a
acb12e6
504db16
2179dcc
0cd77be
af243df
b63a628
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,7 @@ public partial class PromptCardViewModel | |
|
|
||
| [ObservableProperty] | ||
| [NotifyPropertyChangedFor(nameof(ShowLowTokenWarning), nameof(LowTokenWarningText))] | ||
| private int tokensRemaining; | ||
| private int tokensRemaining = -1; | ||
|
|
||
| [ObservableProperty] | ||
| private bool isFlyoutOpen; | ||
|
|
@@ -567,6 +567,28 @@ private void EditorCut(TextEditor? textEditor) | |
| [RelayCommand] | ||
| private async Task AmplifyPrompt() | ||
| { | ||
| if (!settingsManager.Settings.SeenTeachingTips.Contains(TeachingTip.PromptAmplifyDisclaimer)) | ||
| { | ||
| var dialog = DialogHelper.CreateMarkdownDialog(Resources.PromptAmplifier_Disclaimer); | ||
| dialog.PrimaryButtonText = "Continue"; | ||
| dialog.CloseButtonText = "Back"; | ||
| dialog.IsPrimaryButtonEnabled = true; | ||
| dialog.DefaultButton = ContentDialogButton.Primary; | ||
|
|
||
| var result = await dialog.ShowAsync(); | ||
| if (result == ContentDialogResult.Primary) | ||
| { | ||
| settingsManager.Transaction(settings => | ||
| { | ||
| settings.SeenTeachingTips.Add(TeachingTip.PromptAmplifyDisclaimer); | ||
| }); | ||
| } | ||
| else | ||
| { | ||
| return; | ||
| } | ||
| } | ||
|
Comment on lines
+570
to
+590
Contributor
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. This block checks if the disclaimer has been seen and shows a dialog if it hasn't. Consider extracting this logic into a separate method to improve readability and potentially reuse it elsewhere. Also, consider using a more descriptive variable name than if (!settingsManager.Settings.SeenTeachingTips.Contains(TeachingTip.PromptAmplifyDisclaimer))
{
await ShowPromptAmplifierDisclaimer();
} |
||
|
|
||
| var valid = await ValidatePrompts(); | ||
| if (!valid) | ||
| return; | ||
|
|
@@ -674,6 +696,10 @@ private async Task AmplifyPrompt() | |
| } | ||
| } | ||
|
|
||
| [RelayCommand] | ||
| private Task ShowAmplifierDisclaimer() => | ||
| DialogHelper.CreateMarkdownDialog(Resources.PromptAmplifier_Disclaimer).ShowAsync(); | ||
|
|
||
| partial void OnIsBalancedChanged(bool value) | ||
| { | ||
| switch (value) | ||
|
|
||
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.
Initializing
tokensRemainingto -1 is a good way to indicate that it hasn't been loaded yet. However, ensure the UI handles this-1value gracefully (e.g., by displaying a loading indicator or a placeholder) to avoid confusion or errors. Consider adding a comment explaining why -1 is used.