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 +4 -4
- data/NOTICE +7 -0
- data/README.md +1 -1
- data/app/controllers/layered/assistant/assistants_controller.rb +1 -0
- data/app/controllers/layered/assistant/conversations_controller.rb +1 -0
- data/app/controllers/layered/assistant/panel/conversations_controller.rb +1 -0
- data/app/controllers/layered/assistant/providers_controller.rb +1 -0
- data/app/helpers/layered/assistant/panel_helper.rb +2 -2
- data/app/views/layered/assistant/setup/_setup.html.erb +5 -0
- data/db/migrate/20260312000000_create_layered_assistant_tables.rb +1 -1
- data/db/migrate/20260315000000_add_stopped_to_layered_assistant_messages.rb +1 -1
- data/db/migrate/20260315100000_add_response_timing_to_layered_assistant_messages.rb +1 -1
- data/db/migrate/20260317000000_normalise_provider_protocol_values.rb +1 -1
- data/lib/generators/layered/assistant/install_generator.rb +6 -6
- data/lib/generators/layered/assistant/migrations_generator.rb +4 -4
- data/lib/layered/assistant/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0c052e155f7489ab469b2fe1cc4a59b9285fceaaf2595c5947287a95f31a1ed
|
|
4
|
+
data.tar.gz: 8449a3ab76b185cae858779e37fe6888679a1d9f96b76717871acf3fa5b49443
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 614f4ec4a6e1a592604a9f98572a61cd39808bd47dbcc9e2fcc8d80532dedb378f708877770aef11aaed25f9838be1a867b844b170efbdcb7be6a30dadb7d8b5
|
|
7
|
+
data.tar.gz: 2655b683321d5e9a191106d8e20ab887b679d1b524e504a165a399dd30ef94874078908112ae6481c6bcbc7f2e00df07b9c3ea842e05313c7b9f3bd57b4eff74
|
data/NOTICE
ADDED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# layered-assistant-rails
|
|
2
2
|
|
|
3
|
-
[](https://github.com/layered-ai-public/layered-assistant-rails/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.w3.org/WAI/WCAG22/quickref/)
|
|
5
5
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
6
6
|
[](https://www.layered.ai/)
|
|
@@ -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
|
|
@@ -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 AddResponseTimingToLayeredAssistantMessages < ActiveRecord::Migration[8.
|
|
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
|
+
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).
|
|
16
|
-
js_ok = File.exist?(application_js) && File.read(application_js).
|
|
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.
|
|
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:
|
|
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.
|
|
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: '
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
32
|
+
create_file "#{app_migrations_dir}/#{timestamp}_#{name}.layered_assistant.rb", content
|
|
33
33
|
timestamp += 1
|
|
34
34
|
end
|
|
35
35
|
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.
|
|
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 "
|
|
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.
|