From 7f24188abd2fc082680a68dcf54e93c4c8299610 Mon Sep 17 00:00:00 2001 From: Vijay Swamidass Date: Tue, 3 Sep 2024 18:13:24 -0700 Subject: [PATCH 1/4] Style --- app/controllers/assistants_controller.rb | 2 +- app/views/assistants/_assistant.html.erb | 68 ++++++++++++------------ app/views/assistants/_form.html.erb | 2 +- app/views/assistants/edit.html.erb | 2 - app/views/assistants/index.html.erb | 2 +- app/views/assistants/show.html.erb | 29 ++++++---- app/views/chats/_form.html.erb | 2 +- app/views/chats/new.html.erb | 17 ++++-- app/views/layouts/application.html.erb | 32 +++++------ 9 files changed, 86 insertions(+), 70 deletions(-) diff --git a/app/controllers/assistants_controller.rb b/app/controllers/assistants_controller.rb index 5041829..7ed2713 100644 --- a/app/controllers/assistants_controller.rb +++ b/app/controllers/assistants_controller.rb @@ -3,7 +3,7 @@ class AssistantsController < ApplicationController # GET /assistants or /assistants.json def index - @assistants = Assistant.all + @assistants = Assistant.all.order(status: :desc) end # GET /assistants/1 or /assistants/1.json diff --git a/app/views/assistants/_assistant.html.erb b/app/views/assistants/_assistant.html.erb index 1ec56f8..89e5e30 100644 --- a/app/views/assistants/_assistant.html.erb +++ b/app/views/assistants/_assistant.html.erb @@ -1,36 +1,36 @@
- - -
- Description - -
-
- Quip URL -

<%= assistant.quip_url %>

-
-
- Confluence Spaces -

<%= assistant.confluence_spaces %>

-
-
- Libraries -

<%= assistant.libraries %>

-
-
- Input - -
-
- Output - -
-
- Instructions - -
-
- Context - -
+ <% cache assistant do %> +
+ Description + +
+
+ Quip URL +

<%= assistant.quip_url %>

+
+
+ Confluence Spaces +

<%= assistant.confluence_spaces %>

+
+
+ Libraries +

<%= assistant.libraries %>

+
+
+ Input + +
+
+ Output + +
+
+ Instructions + +
+
+ Context + +
+ <% end %>
diff --git a/app/views/assistants/_form.html.erb b/app/views/assistants/_form.html.erb index f4377b4..c3e3748 100644 --- a/app/views/assistants/_form.html.erb +++ b/app/views/assistants/_form.html.erb @@ -50,6 +50,6 @@ <%= form.text_area :context, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
- <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> + <%= form.submit "Save", class: "rounded-lg py-3 px-5 bg-sky-600 text-white inline-block font-medium cursor-pointer" %>
<% end %> diff --git a/app/views/assistants/edit.html.erb b/app/views/assistants/edit.html.erb index 961b697..c6d0166 100644 --- a/app/views/assistants/edit.html.erb +++ b/app/views/assistants/edit.html.erb @@ -12,6 +12,4 @@

Editing Assistant

<%= render "form", assistant: @assistant %> - <%= link_to "Show this assistant", @assistant, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to "Back to assistants", assistants_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> diff --git a/app/views/assistants/index.html.erb b/app/views/assistants/index.html.erb index 95838d9..63aba79 100644 --- a/app/views/assistants/index.html.erb +++ b/app/views/assistants/index.html.erb @@ -17,7 +17,7 @@

<%= assistant.description %>

- <%= link_to "Start Chat", new_assistant_chat_path(assistant_id: assistant.id), class: "rounded-lg py-2 px-4 bg-sky-500 text-white font-medium hover:bg-sky-700" %> + <%= link_to "Start Chat", new_assistant_chat_path(assistant_id: assistant.id), class: "rounded-lg py-2 px-4 bg-white text-sky-500 border border-sky-500 font-medium hover:bg-sky-100" %>
<% end %> diff --git a/app/views/assistants/show.html.erb b/app/views/assistants/show.html.erb index 6c931f0..67ba01d 100644 --- a/app/views/assistants/show.html.erb +++ b/app/views/assistants/show.html.erb @@ -12,16 +12,25 @@ -

- <%= @assistant.name %> - <%= render partial: 'assistant_badge', locals: { assistant: @assistant } %> -

-
- <%= link_to "New chat", new_assistant_chat_path(@assistant), class: "mt-2 rounded-lg py-3 px-5 bg-sky-500 inline-block font-medium text-white" %> - <%= link_to "Edit", edit_assistant_path(@assistant), class: "mt-2 rounded-lg py-3 px-5 bg-gray-300 inline-block font-medium" %> -
- <%= button_to "Delete", @assistant, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-300 font-medium" %> +
+

+ <%= @assistant.name %> + <%= render partial: 'assistant_badge', locals: { assistant: @assistant } %> +

+
+ <%= link_to new_assistant_chat_path(@assistant), class: "rounded-lg py-3 px-5 bg-sky-500 inline-flex items-center font-medium text-white" do %> + + + + Chat with <%= @assistant.name %> + <% end %>
- <%= render @assistant %>
+
+ <% if policy(@assistant).edit? %> + <%= link_to "Edit", edit_assistant_path(@assistant), class: "mt-2 rounded-lg py-3 px-5 bg-gray-300 font-medium inline-block" %> + <%= button_to "Delete", @assistant, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-300 font-medium inline-block" %> + <% end %> +
+ <%= render @assistant %>
\ No newline at end of file diff --git a/app/views/chats/_form.html.erb b/app/views/chats/_form.html.erb index acfe00f..78e59ac 100644 --- a/app/views/chats/_form.html.erb +++ b/app/views/chats/_form.html.erb @@ -14,6 +14,6 @@ <%= form.text_area :first_message, rows: 5,placeholder: ("Please give me " + chat.assistant.input).capitalize, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
- <%= form.submit class: "rounded-lg py-3 px-5 bg-sky-600 text-white inline-block font-medium cursor-pointer" %> + <%= form.submit "Start Chatting", class: "rounded-lg py-3 px-5 bg-sky-600 text-white inline-block font-medium cursor-pointer" %>
<% end %> \ No newline at end of file diff --git a/app/views/chats/new.html.erb b/app/views/chats/new.html.erb index ae03c8b..5c2eeb7 100644 --- a/app/views/chats/new.html.erb +++ b/app/views/chats/new.html.erb @@ -1,7 +1,16 @@
-

Hello, I am the <%= @chat.assistant.name %> assistant.

- + + +

Hello, I am the <%= @chat.assistant.name %> assistant.

<%= render "form", chat: @chat, assistant: @chat.assistant %> - - <%= link_to "Back to chats", chats_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-300 inline-block font-medium" %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1e9391e..0a0b844 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -90,23 +90,23 @@ Documents +
  • + + + + + Chats + +
  • +
  • + + + + + Assistants + +
  • <% if session[:beta] == "true" then %> -
  • - - - - - Chats - -
  • -
  • - - - - - Assistants - -
  • <% end %> From 6d256aa14901b606d4966cc4906b87686486b2d2 Mon Sep 17 00:00:00 2001 From: vswamidass Date: Tue, 3 Sep 2024 23:34:56 -0700 Subject: [PATCH 2/4] css --- app/views/assistants/_assistant.html.erb | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/views/assistants/_assistant.html.erb b/app/views/assistants/_assistant.html.erb index 89e5e30..6fb1cea 100644 --- a/app/views/assistants/_assistant.html.erb +++ b/app/views/assistants/_assistant.html.erb @@ -1,36 +1,36 @@
    <% cache assistant do %>
    - Description - + Description +
    - Quip URL + Quip URL

    <%= assistant.quip_url %>

    - Confluence Spaces + Confluence Spaces

    <%= assistant.confluence_spaces %>

    - Libraries + Libraries

    <%= assistant.libraries %>

    - Input - + Input +
    - Output - + Output +
    - Instructions - + Instructions +
    - Context - + Context +
    <% end %>
    From a84d6b6daa83bcd0e299af459afbc8eeb20fc776 Mon Sep 17 00:00:00 2001 From: vswamidass Date: Tue, 3 Sep 2024 23:42:10 -0700 Subject: [PATCH 3/4] css --- app/views/assistants/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/assistants/show.html.erb b/app/views/assistants/show.html.erb index 67ba01d..7711d90 100644 --- a/app/views/assistants/show.html.erb +++ b/app/views/assistants/show.html.erb @@ -18,7 +18,7 @@ <%= render partial: 'assistant_badge', locals: { assistant: @assistant } %>
    - <%= link_to new_assistant_chat_path(@assistant), class: "rounded-lg py-3 px-5 bg-sky-500 inline-flex items-center font-medium text-white" do %> + <%= link_to new_assistant_chat_path(@assistant), class: "rounded-lg py-3 px-5 bg-sky-800 inline-flex items-center font-medium text-white" do %> From a8a7e8b85ebbe8af9ecb61c1b25626bdffd2e918 Mon Sep 17 00:00:00 2001 From: vswamidass Date: Wed, 4 Sep 2024 00:28:19 -0700 Subject: [PATCH 4/4] css --- app/views/assistants/_assistant_badge.html.erb | 8 ++++---- app/views/assistants/index.html.erb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/assistants/_assistant_badge.html.erb b/app/views/assistants/_assistant_badge.html.erb index 5cb254e..221c463 100644 --- a/app/views/assistants/_assistant_badge.html.erb +++ b/app/views/assistants/_assistant_badge.html.erb @@ -1,6 +1,6 @@ <% if assistant.ready? %> - - + + <% elsif assistant.development? %> - - + +