mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08: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)
|
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)
|
||||||
|
{
|
||||||
|
if (vm.Staged is { Count: > 0 })
|
||||||
{
|
{
|
||||||
var dialog = new AIAssistant() { DataContext = vm };
|
var dialog = new AIAssistant() { DataContext = vm };
|
||||||
dialog.GenerateCommitMessage();
|
dialog.GenerateCommitMessage();
|
||||||
App.OpenDialog(dialog);
|
App.OpenDialog(dialog);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
App.RaiseException(null, "No files added to commit!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue