Class: Layered::Assistant::Panel::ConversationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Layered::Assistant::Panel::ConversationsController
- Includes:
- StoppableResponse
- Defined in:
- app/controllers/layered/assistant/panel/conversations_controller.rb
Instance Method Summary collapse
Methods included from StoppableResponse
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/layered/assistant/panel/conversations_controller.rb', line 25 def create @conversation = Conversation.new(conversation_params) @conversation.owner = l_ui_current_user @conversation.assistant = scoped(Assistant).find(conversation_params[:assistant_id]) if conversation_params[:assistant_id].present? @conversation.name = Conversation.default_name if @conversation.name.blank? if @conversation.save redirect_to layered_assistant.panel_conversation_path(@conversation) else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
38 39 40 41 |
# File 'app/controllers/layered/assistant/panel/conversations_controller.rb', line 38 def destroy @conversation.destroy redirect_to layered_assistant.panel_conversations_path end |
#index ⇒ Object
12 13 |
# File 'app/controllers/layered/assistant/panel/conversations_controller.rb', line 12 def index end |
#new ⇒ Object
21 22 23 |
# File 'app/controllers/layered/assistant/panel/conversations_controller.rb', line 21 def new @conversation = Conversation.new end |
#show ⇒ Object
15 16 17 18 19 |
# File 'app/controllers/layered/assistant/panel/conversations_controller.rb', line 15 def show @messages = @conversation..includes(:model).by_created_at @models = Model.available @selected_model_id = @messages.last&.model_id || @conversation.assistant.default_model_id || @models.first&.id end |