layered-assistant-rails 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff9af0132fa23f11eae8703acf4b0cfd2c893389fa0237e2883f09a6fa3080b3
4
- data.tar.gz: 5a2e46ba572593219180533800eca8f69e78712a03bb521886f017c07a3b0a15
3
+ metadata.gz: 0c6156a26192a7edd3fcb67ac5a170aa88ed8b52d2e673787d5595f05c420fbd
4
+ data.tar.gz: 79ec02dbdf134098f5ddb28d6dc480d626a27d35abb1151e1b6712e5496f09c9
5
5
  SHA512:
6
- metadata.gz: b418c0f1b88ad608bfc07447b5227f5cdc499267c15810fccc0b7e97650a3d53476c6778fd1921438b280177ce677ccbcd492918738f070647146de51c908f6b
7
- data.tar.gz: 5b3e1061ab08cd17abc131a909a39127e1adbe98c080e29cd3da4040172fab9e0f6978e72c1760a798b1dcd90a8a09c8608a361591f9632f81bc3a6672f090fe
6
+ metadata.gz: 3e09ac245b3bbbbb14c7e73540c6bd91d215323de65957b4452d797a6d5e23ddeb03b8fef7da870b781a75b1e18ebd29592563c06eacd3ea1038e7e6aa415447
7
+ data.tar.gz: a7ce50cbdba541810656dfd56fd660a435bb4d6b87b3f77fa50818c65374db059f7a5ba4d1aa5e2c1e2011efc8e4db706e1579ff9e9ea12c11bc68b2a438d3b3
@@ -9,6 +9,9 @@ module Layered
9
9
  end
10
10
 
11
11
  def show
12
+ conversation = @assistant.conversations.create!(name: Conversation.default_name)
13
+ add_conversation_to_session(conversation)
14
+ redirect_to layered_assistant.public_conversation_path(conversation)
12
15
  end
13
16
  end
14
17
  end
@@ -20,6 +20,14 @@ module Layered
20
20
 
21
21
  def show
22
22
  @messages = @conversation.messages.includes(:model).by_created_at
23
+ @conversations = if session_conversation_uids.any?
24
+ Conversation.joins(:assistant).merge(Assistant.publicly_available)
25
+ .where(uid: session_conversation_uids, assistant: @conversation.assistant)
26
+ .by_created_at
27
+ .limit(20)
28
+ else
29
+ Conversation.none
30
+ end
23
31
  end
24
32
 
25
33
  private
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ navigate(event) {
5
+ const value = event.target.value
6
+ if (value) Turbo.visit(value)
7
+ }
8
+ }
@@ -1,11 +1,13 @@
1
1
  import { application } from "controllers/application"
2
2
  import ComposerController from "layered_assistant/composer_controller"
3
+ import ConversationSelectController from "layered_assistant/conversation_select_controller"
3
4
  import MessagesController from "layered_assistant/messages_controller"
4
5
  import PanelController from "layered_assistant/panel_controller"
5
6
  import PanelNavController from "layered_assistant/panel_nav_controller"
6
7
  import ProviderTemplateController from "layered_assistant/provider_template_controller"
7
8
 
8
9
  application.register("composer", ComposerController)
10
+ application.register("conversation-select", ConversationSelectController)
9
11
  application.register("messages", MessagesController)
10
12
  application.register("panel", PanelController)
11
13
  application.register("panel-nav", PanelNavController)
@@ -1,9 +1,17 @@
1
1
  <%= turbo_stream_from @conversation %>
2
2
 
3
3
  <div class="l-ui-conversation__container">
4
- <div class="l-ui-container--spread">
5
- <h1><%= @conversation.name %></h1>
6
- <%= link_to "Back", layered_assistant.public_assistant_path(@conversation.assistant), class: "l-ui-button--outline" %>
4
+ <div class="l-ui-form__group l-ui-utility--mt-0">
5
+ <div class="l-ui-select-wrapper l-ui-utility--mt-0">
6
+ <select class="l-ui-select l-ui-utility--mt-0" aria-label="Select conversation"
7
+ data-controller="conversation-select"
8
+ data-action="change->conversation-select#navigate">
9
+ <option value="<%= layered_assistant.public_assistant_path(@conversation.assistant) %>">+ New</option>
10
+ <% @conversations.each do |c| %>
11
+ <option value="<%= layered_assistant.public_conversation_path(c) %>" <%= "selected" if c.id == @conversation.id %>><%= c.name %></option>
12
+ <% end %>
13
+ </select>
14
+ </div>
7
15
  </div>
8
16
 
9
17
  <div class="l-ui-conversation__messages" data-controller="messages">
@@ -1,3 +1,9 @@
1
+ <% if controller_path == "layered/assistant/public/conversations" && action_name == "show" %>
2
+ <% content_for :l_ui_body_class do %>l-ui-body--hide-header<% end %>
3
+ <% elsif controller_path.start_with?("layered/assistant") %>
4
+ <% content_for :l_ui_body_class do %>l-ui-body--always-show-navigation<% end %>
5
+ <% end %>
6
+
1
7
  <% content_for :l_ui_navigation_items do %>
2
8
  <%= render "layouts/layered/assistant/host_navigation" %>
3
9
  <% if l_assistant_accessible? %>
@@ -5,26 +11,30 @@
5
11
  <%= l_ui_navigation_item "Providers", layered_assistant.providers_path %>
6
12
  <%= l_ui_navigation_item "Assistants", layered_assistant.assistants_path %>
7
13
  <%= l_ui_navigation_item "Conversations", layered_assistant.conversations_path %>
8
- <% end %>
9
- <% end %>
10
-
11
- <% content_for :l_ui_panel_heading do %>
12
- <% if l_assistant_accessible? %>
13
- <%= layered_assistant_panel_header %>
14
14
  <% else %>
15
- <%= layered_assistant_panel_header do %>Assistant<% end %>
15
+ <%= l_ui_navigation_item "Assistants", layered_assistant.public_assistants_path %>
16
16
  <% end %>
17
17
  <% end %>
18
18
 
19
- <% if l_assistant_accessible? %>
20
- <% content_for :l_ui_panel_body do %>
21
- <%= layered_assistant_panel_body data: { controller: "panel" } %>
19
+ <% unless controller_path == "layered/assistant/public/conversations" && action_name == "show" %>
20
+ <% content_for :l_ui_panel_heading do %>
21
+ <% if l_assistant_accessible? %>
22
+ <%= layered_assistant_panel_header %>
23
+ <% else %>
24
+ <%= layered_assistant_panel_header do %>Assistant<% end %>
25
+ <% end %>
22
26
  <% end %>
23
- <% else %>
24
- <% public_assistant = Layered::Assistant::Assistant.publicly_available.by_name.first %>
25
- <% if public_assistant %>
27
+
28
+ <% if l_assistant_accessible? %>
26
29
  <% content_for :l_ui_panel_body do %>
27
- <%= layered_assistant_public_panel_body assistant: public_assistant, data: { controller: "panel", panel_storage_key_value: "public_assistant_panel_url" } %>
30
+ <%= layered_assistant_panel_body data: { controller: "panel" } %>
31
+ <% end %>
32
+ <% else %>
33
+ <% public_assistant = Layered::Assistant::Assistant.publicly_available.by_name.first %>
34
+ <% if public_assistant %>
35
+ <% content_for :l_ui_panel_body do %>
36
+ <%= layered_assistant_public_panel_body assistant: public_assistant, data: { controller: "panel", panel_storage_key_value: "public_assistant_panel_url" } %>
37
+ <% end %>
28
38
  <% end %>
29
39
  <% end %>
30
40
  <% end %>
data/config/importmap.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  pin "layered_assistant", to: "layered_assistant/index.js"
2
2
  pin "layered_assistant/message_streaming", to: "layered_assistant/message_streaming.js"
3
3
  pin "layered_assistant/composer_controller", to: "layered_assistant/composer_controller.js"
4
+ pin "layered_assistant/conversation_select_controller", to: "layered_assistant/conversation_select_controller.js"
4
5
  pin "layered_assistant/messages_controller", to: "layered_assistant/messages_controller.js"
5
6
  pin "layered_assistant/panel_controller", to: "layered_assistant/panel_controller.js"
6
7
  pin "layered_assistant/panel_nav_controller", to: "layered_assistant/panel_nav_controller.js"
@@ -1,5 +1,5 @@
1
1
  module Layered
2
2
  module Assistant
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: layered-assistant-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - layered.ai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-24 00:00:00.000000000 Z
11
+ date: 2026-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.1.3
117
+ version: 0.1.4
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.1.3
124
+ version: 0.1.4
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: propshaft
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -325,6 +325,7 @@ files:
325
325
  - app/helpers/layered/assistant/messages_helper.rb
326
326
  - app/helpers/layered/assistant/panel_helper.rb
327
327
  - app/javascript/layered_assistant/composer_controller.js
328
+ - app/javascript/layered_assistant/conversation_select_controller.js
328
329
  - app/javascript/layered_assistant/index.js
329
330
  - app/javascript/layered_assistant/message_streaming.js
330
331
  - app/javascript/layered_assistant/messages_controller.js
@@ -380,7 +381,6 @@ files:
380
381
  - app/views/layered/assistant/providers/index.html.erb
381
382
  - app/views/layered/assistant/providers/new.html.erb
382
383
  - app/views/layered/assistant/public/assistants/index.html.erb
383
- - app/views/layered/assistant/public/assistants/show.html.erb
384
384
  - app/views/layered/assistant/public/conversations/show.html.erb
385
385
  - app/views/layered/assistant/public/messages/_composer.html.erb
386
386
  - app/views/layered/assistant/public/messages/create.turbo_stream.erb
@@ -1,23 +0,0 @@
1
- <div class="l-ui-container--spread">
2
- <h1><%= @assistant.name %></h1>
3
- <%= link_to "Back", layered_assistant.public_assistants_path, class: "l-ui-button--outline" %>
4
- </div>
5
-
6
- <dl class="l-ui-description-list l-ui-utility--mt-lg">
7
- <% if @assistant.description.present? %>
8
- <dt>Description</dt>
9
- <dd><%= @assistant.description %></dd>
10
- <% end %>
11
-
12
- <% if @assistant.default_model.present? %>
13
- <dt>Default model</dt>
14
- <dd><%= @assistant.default_model.name %></dd>
15
- <% end %>
16
- </dl>
17
-
18
- <div class="l-ui-utility--mt-lg">
19
- <%= form_with url: layered_assistant.public_conversations_path, class: "l-ui-form" do |f| %>
20
- <%= f.hidden_field :assistant_id, value: @assistant.id %>
21
- <%= f.submit "New conversation", class: "l-ui-button--primary" %>
22
- <% end %>
23
- </div>