mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* Add comprehensive AI/LLM configuration documentation * Fix Chat.start! to use default model when model is nil or empty * Ensure all controllers use Chat.default_model for consistency * Move AI doc inside `hosting/` * Probably too much error handling --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
25 lines
564 B
Ruby
25 lines
564 B
Ruby
class MessagesController < ApplicationController
|
|
guard_feature unless: -> { Current.user.ai_enabled? }
|
|
|
|
before_action :set_chat
|
|
|
|
def create
|
|
@message = UserMessage.create!(
|
|
chat: @chat,
|
|
content: message_params[:content],
|
|
ai_model: message_params[:ai_model].presence || Chat.default_model
|
|
)
|
|
|
|
redirect_to chat_path(@chat, thinking: true)
|
|
end
|
|
|
|
private
|
|
def set_chat
|
|
@chat = Current.user.chats.find(params[:chat_id])
|
|
end
|
|
|
|
def message_params
|
|
params.require(:message).permit(:content, :ai_model)
|
|
end
|
|
end
|