fix(messages): handle blank content submission gracefully (#1938)

Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
This commit is contained in:
sentry[bot]
2026-05-24 15:50:47 +02:00
committed by GitHub
parent 5520bacbb8
commit 2ce875f57f

View File

@@ -4,13 +4,17 @@ class MessagesController < ApplicationController
before_action :set_chat
def create
@message = UserMessage.create!(
@message = UserMessage.new(
chat: @chat,
content: message_params[:content],
ai_model: message_params[:ai_model].presence || Chat.default_model
)
redirect_to chat_path(@chat, thinking: true)
if @message.save
redirect_to chat_path(@chat, thinking: true)
else
redirect_to chat_path(@chat), alert: @message.errors.full_messages.to_sentence
end
end
private