Fix validation for empty prompts with attachments

This commit is contained in:
Bülhoff committed 2026-08-12 15:34:59 +02:00
1 parent bb8f6f13f0
commit c902f33569
3 files changed
+18 -3

No files matched your search

@@ -763,18 +763,27 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
await this.SyncForegroundChatAsync();
return this.ChatThread;
}
private async Task SendMessage(bool reuseLastUserPrompt = false)
{
if (this.MediaTranscriptionService.IsBusy(this.CurrentMediaImportOwner))
return;
if (!this.IsProviderSelected)
return;
if (!reuseLastUserPrompt && string.IsNullOrWhiteSpace(this.ComposerState.UserInput)
&& this.ComposerState.FileAttachments.Count > 0)
{
await this.MessageBus.SendWarning(new(
Icons.Material.Filled.VoiceChat,
this.T("The attachment has not been sent. Please enter a prompt in the chat window")));
return;
}
if(!this.ChatThread.IsLLMProviderAllowed(this.Provider))
return;
this.RefreshCurrentProfileAndChatTemplate();
// Blur the focus away from the input field to be able to clear it: