Skip to content

Commit

Permalink
add import page
Browse files Browse the repository at this point in the history
  • Loading branch information
vswamidass-sfdc committed Sep 4, 2024
1 parent f24c2bb commit f0b25a6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/views/assistants/import.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%= render 'shared/page_header', title: 'Import Assistants', subtitle: 'Paste the JSON copied from another Assistant.' %>
<%= form_tag assistants_path, method: :post, class: "contents" do %>
<div class="my-5">
<%= label_tag :json %>
<%= text_area_tag :json, nil, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
</div>
<div class="inline">
<%= submit_tag "Import", class: "rounded-lg py-3 px-5 bg-sky-600 text-white inline-block font-medium cursor-pointer" %>
</div>
<% end %>
1 change: 1 addition & 0 deletions app/views/assistants/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<%= render 'shared/page_header', title: 'Assistants', subtitle: 'Assistants have special instructions and context to answer specific problems better than general Q/A. Click "Chat" to begin!' %>
<% if policy(Assistant.new).edit? %>
<%= link_to "New +", new_assistant_path, class: "rounded-lg py-3 px-5 bg-sky-900 text-white block font-medium" %>
<%= link_to "Import", import_assistants_path, class: "rounded-lg py-3 px-5 bg-sky-900 text-white block font-medium" %>
<% end %>
</div>
<div id="assistants" class="mt-5 space-y-4">
Expand Down
8 changes: 6 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# frozen_string_literal: true

Rails.application.routes.draw do
resources :messages
resources :chats do
resources :messages
end
resources :assistants do
resources :chats, only: %i[create new]

# Adding the import route for all assistants
collection do
post 'import'
get 'import'
end
end

# Auth routes
Expand Down

0 comments on commit f0b25a6

Please sign in to comment.