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,15 +125,22 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
if (!Models.OpenAI.IsValid)
|
if (!Models.OpenAI.IsValid)
|
||||||
{
|
{
|
||||||
App.RaiseException(null, $"Bad configuration for OpenAI");
|
App.RaiseException(null, "Bad configuration for OpenAI");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataContext is ViewModels.WorkingCopy vm && vm.Staged is { Count: > 0 })
|
if (DataContext is ViewModels.WorkingCopy vm)
|
||||||
{
|
{
|
||||||
var dialog = new AIAssistant() { DataContext = vm };
|
if (vm.Staged is { Count: > 0 })
|
||||||
dialog.GenerateCommitMessage();
|
{
|
||||||
App.OpenDialog(dialog);
|
var dialog = new AIAssistant() { DataContext = vm };
|
||||||
|
dialog.GenerateCommitMessage();
|
||||||
|
App.OpenDialog(dialog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
App.RaiseException(null, "No files added to commit!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
Loading…
Reference in a new issue