mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-10-31 13:03:20 -07:00
enhance: notify user when try to generate commit message by OpenAI but not files are added to commit
This commit is contained in:
parent
cc6e486663
commit
5c2583db67
1 changed files with 12 additions and 5 deletions
|
@ -125,16 +125,23 @@ namespace SourceGit.Views
|
|||
{
|
||||
if (!Models.OpenAI.IsValid)
|
||||
{
|
||||
App.RaiseException(null, $"Bad configuration for OpenAI");
|
||||
App.RaiseException(null, "Bad configuration for OpenAI");
|
||||
return;
|
||||
}
|
||||
|
||||
if (DataContext is ViewModels.WorkingCopy vm && vm.Staged is { Count: > 0 })
|
||||
if (DataContext is ViewModels.WorkingCopy vm)
|
||||
{
|
||||
if (vm.Staged is { Count: > 0 })
|
||||
{
|
||||
var dialog = new AIAssistant() { DataContext = vm };
|
||||
dialog.GenerateCommitMessage();
|
||||
App.OpenDialog(dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.RaiseException(null, "No files added to commit!");
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue