layered-assistant-rails 0.2.1 → 0.2.2

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: 982edf1df01578ae2c8d86c3cb572ffea1e15f8dc875f4ab2a2fb2e00f3e3f19
4
- data.tar.gz: f4d6d20954adc4638e7b131d5317a33d97fb4a3e7c28668f59da3c9d77ab484c
3
+ metadata.gz: b0c052e155f7489ab469b2fe1cc4a59b9285fceaaf2595c5947287a95f31a1ed
4
+ data.tar.gz: 8449a3ab76b185cae858779e37fe6888679a1d9f96b76717871acf3fa5b49443
5
5
  SHA512:
6
- metadata.gz: 1a7f7487ab129af7725ffc31b97c919148563343b8b3d3538191f9ab731f7cf19b329641de08d459dda14a25bcd2a7876478d11ae756b30865838ab76a086cb4
7
- data.tar.gz: 5c489a8a8f29c3d7e8682af07e72174ce5a899e116108817a4ec120f892d09b5f24ed1a8dec298a1e34c879c9d88e119453335efeae47cb924a4790bd052c1d6
6
+ metadata.gz: 614f4ec4a6e1a592604a9f98572a61cd39808bd47dbcc9e2fcc8d80532dedb378f708877770aef11aaed25f9838be1a867b844b170efbdcb7be6a30dadb7d8b5
7
+ data.tar.gz: 2655b683321d5e9a191106d8e20ab887b679d1b524e504a165a399dd30ef94874078908112ae6481c6bcbc7f2e00df07b9c3ea842e05313c7b9f3bd57b4eff74
data/NOTICE ADDED
@@ -0,0 +1,7 @@
1
+ layered-assistant-rails
2
+
3
+ Copyright 2026 LAYERED AI LIMITED (UK company number: 17056830).
4
+
5
+ This product includes software developed by LAYERED AI LIMITED and contributors.
6
+
7
+ Licensed under the Apache License, Version 2.0.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # layered-assistant-rails
2
2
 
3
- [![CI](https://github.com/layered-ai-public/layered-ui-rails/actions/workflows/ci.yml/badge.svg)](https://github.com/layered-ai-public/layered-assistant-rails/actions/workflows/ci.yml)
3
+ [![CI](https://github.com/layered-ai-public/layered-assistant-rails/actions/workflows/ci.yml/badge.svg)](https://github.com/layered-ai-public/layered-assistant-rails/actions/workflows/ci.yml)
4
4
  [![WCAG 2.2 AA](https://img.shields.io/badge/WCAG_2.2-AA-green)](https://www.w3.org/WAI/WCAG22/quickref/)
5
5
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
6
  [![Website](https://img.shields.io/badge/Website-layered.ai-purple)](https://www.layered.ai/)
@@ -16,6 +16,7 @@ module Layered
16
16
 
17
17
  def create
18
18
  @assistant = Assistant.new(assistant_params)
19
+ @assistant.owner = l_ui_current_user
19
20
 
20
21
  if @assistant.save
21
22
  redirect_to layered_assistant.assistants_path, notice: "Assistant was successfully created."
@@ -32,6 +32,7 @@ module Layered
32
32
  def create
33
33
  @conversation = Conversation.new(conversation_params)
34
34
  @conversation.owner = l_ui_current_user
35
+ @conversation.assistant = scoped(Assistant).find(conversation_params[:assistant_id]) if conversation_params[:assistant_id].present?
35
36
  @conversation.name = Conversation.default_name if @conversation.name.blank?
36
37
  if @conversation.save
37
38
  redirect_to layered_assistant.conversation_path(@conversation), notice: "Conversation was successfully created."
@@ -25,6 +25,7 @@ module Layered
25
25
  def create
26
26
  @conversation = Conversation.new(conversation_params)
27
27
  @conversation.owner = l_ui_current_user
28
+ @conversation.assistant = scoped(Assistant).find(conversation_params[:assistant_id]) if conversation_params[:assistant_id].present?
28
29
  @conversation.name = Conversation.default_name if @conversation.name.blank?
29
30
 
30
31
  if @conversation.save
@@ -15,6 +15,7 @@ module Layered
15
15
 
16
16
  def create
17
17
  @provider = Provider.new(provider_params)
18
+ @provider.owner = l_ui_current_user
18
19
 
19
20
  if @provider.save
20
21
  Models::CreateService.new(@provider).call if params[:provider][:create_models] == "1"
@@ -18,8 +18,8 @@ module Layered
18
18
  # Any extra keyword arguments are forwarded to the respective
19
19
  # +turbo_frame_tag+ call as HTML attributes.
20
20
 
21
- def layered_assistant_panel_header(**options)
22
- turbo_frame_tag "assistant_panel_header", **options
21
+ def layered_assistant_panel_header(**options, &block)
22
+ turbo_frame_tag "assistant_panel_header", **options, &block
23
23
  end
24
24
 
25
25
  def layered_assistant_panel_body(**options)
@@ -167,6 +167,11 @@ end</code></pre>
167
167
  <td class="l-ui-table__cell"><code>false</code></td>
168
168
  <td class="l-ui-table__cell">Log API errors to stdout from the AI API clients</td>
169
169
  </tr>
170
+ <tr>
171
+ <th class="l-ui-table__cell--primary" scope="row"><code>api_request_timeout</code></th>
172
+ <td class="l-ui-table__cell"><code>210</code></td>
173
+ <td class="l-ui-table__cell">Timeout in seconds for AI API requests</td>
174
+ </tr>
170
175
  <tr>
171
176
  <th class="l-ui-table__cell--primary" scope="row"><code>skip_db_encryption</code></th>
172
177
  <td class="l-ui-table__cell"><code>false</code></td>
@@ -1,4 +1,4 @@
1
- class CreateLayeredAssistantTables < ActiveRecord::Migration[8.1]
1
+ class CreateLayeredAssistantTables < ActiveRecord::Migration[8.0]
2
2
  def change
3
3
  create_table :layered_assistant_providers, if_not_exists: true do |t|
4
4
  t.references :owner, polymorphic: true
@@ -1,4 +1,4 @@
1
- class AddStoppedToLayeredAssistantMessages < ActiveRecord::Migration[8.1]
1
+ class AddStoppedToLayeredAssistantMessages < ActiveRecord::Migration[8.0]
2
2
  def change
3
3
  add_column :layered_assistant_messages, :stopped, :boolean, default: false, null: false
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddResponseTimingToLayeredAssistantMessages < ActiveRecord::Migration[8.1]
1
+ class AddResponseTimingToLayeredAssistantMessages < ActiveRecord::Migration[8.0]
2
2
  def change
3
3
  add_column :layered_assistant_messages, :ttft_ms, :integer
4
4
  add_column :layered_assistant_messages, :response_ms, :integer
@@ -1,4 +1,4 @@
1
- class NormaliseProviderProtocolValues < ActiveRecord::Migration[8.1]
1
+ class NormaliseProviderProtocolValues < ActiveRecord::Migration[8.0]
2
2
  def up
3
3
  execute "UPDATE layered_assistant_providers SET protocol = 'anthropic' WHERE protocol = 'Anthropic'"
4
4
  execute "UPDATE layered_assistant_providers SET protocol = 'openai' WHERE protocol = 'OpenAI'"
@@ -12,8 +12,8 @@ module Layered
12
12
  application_css = "app/assets/tailwind/application.css"
13
13
  application_js = "app/javascript/application.js"
14
14
 
15
- css_ok = File.exist?(application_css) && File.read(application_css).include?('@import "./layered_ui"')
16
- js_ok = File.exist?(application_js) && File.read(application_js).include?('import "layered_ui"')
15
+ css_ok = File.exist?(application_css) && File.read(application_css).match?(%r{@import\s+['"]\.?/?layered_ui['"]})
16
+ js_ok = File.exist?(application_js) && File.read(application_js).match?(%r{import\s+['"]layered_ui['"]})
17
17
 
18
18
  unless css_ok && js_ok
19
19
  say "layered-ui-rails is not installed yet - installing now...", :yellow
@@ -46,10 +46,10 @@ module Layered
46
46
  content = File.read(application_css)
47
47
  import_line = '@import "./layered_assistant";'
48
48
 
49
- return if content.include?(import_line)
49
+ return if content.match?(%r{@import\s+['"]\.?/?layered_assistant['"]})
50
50
 
51
51
  # Insert after the layered_ui import (which must already be present)
52
- inject_into_file application_css, "\n#{import_line}", after: '@import "./layered_ui";'
52
+ inject_into_file application_css, "\n#{import_line}", after: %r{@import\s+['"]\.?/?layered_ui['"];?}
53
53
  say "Added import to #{application_css}", :green
54
54
  end
55
55
 
@@ -61,10 +61,10 @@ module Layered
61
61
  content = File.read(application_js)
62
62
  import_line = 'import "layered_assistant"'
63
63
 
64
- return if content.include?(import_line)
64
+ return if content.match?(%r{import\s+['"]layered_assistant['"]})
65
65
 
66
66
  # Insert after the layered_ui import (which must already be present)
67
- inject_into_file application_js, "\n#{import_line}", after: 'import "layered_ui"'
67
+ inject_into_file application_js, "\n#{import_line}", after: %r{import\s+['"]layered_ui['"];?}
68
68
  say "Added import to #{application_js}", :green
69
69
  end
70
70
 
@@ -6,14 +6,15 @@ module Layered
6
6
 
7
7
  def copy_migrations
8
8
  engine_migrations_path = Layered::Assistant::Engine.root.join("db/migrate")
9
- app_migrations_path = Rails.root.join("db/migrate")
9
+ app_migrations_dir = "db/migrate"
10
10
 
11
11
  unless engine_migrations_path.exist?
12
12
  say "No migrations found in layered-assistant-rails.", :yellow
13
13
  return
14
14
  end
15
15
 
16
- existing_migrations = Dir[app_migrations_path.join("*.rb")].map { |f| migration_name(File.basename(f)) }
16
+ app_migrations_path = File.join(destination_root, app_migrations_dir)
17
+ existing_migrations = Dir[File.join(app_migrations_path, "*.rb")].map { |f| migration_name(File.basename(f)) }
17
18
 
18
19
  timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
19
20
 
@@ -26,10 +27,9 @@ module Layered
26
27
  next
27
28
  end
28
29
 
29
- destination = app_migrations_path.join("#{timestamp}_#{name}.layered_assistant.rb")
30
30
  content = "# This migration comes from layered_assistant (originally #{basename.split("_").first})\n" + File.read(source)
31
31
 
32
- create_file destination, content
32
+ create_file "#{app_migrations_dir}/#{timestamp}_#{name}.layered_assistant.rb", content
33
33
  timestamp += 1
34
34
  end
35
35
  end
@@ -1,5 +1,5 @@
1
1
  module Layered
2
2
  module Assistant
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: layered-assistant-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - layered.ai
@@ -299,6 +299,7 @@ extra_rdoc_files: []
299
299
  files:
300
300
  - AGENTS.md
301
301
  - LICENSE
302
+ - NOTICE
302
303
  - README.md
303
304
  - Rakefile
304
305
  - app/assets/tailwind/layered/assistant/styles.css
@@ -424,7 +425,7 @@ post_install_message: |
424
425
  • Copy the layered assistant CSS to your host app at app/assets/tailwind/layered_assistant.css
425
426
  • This approach ensures the CSS is processed with your host app's Tailwind configuration
426
427
  • Add an import statement to your app/assets/tailwind/application.css
427
- • Add `import "layered_assistant"` to your app/javascript/application.js (just after `import "@hotwired/turbo-rails"`, if present)
428
+ • Add `import "layered_assistant"` to your app/javascript/application.js (just after `import "layered_ui"`, which must already be present)
428
429
  • Copy engine migrations to your app's db/migrate/
429
430
 
430
431
  If these imports already exist, they will not be duplicated.