active_prompt_rails 0.1.16 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cce75514b94749199f3bd2b3dbbb3a5017ae5bd69d2c32af838a4aa84268a2c
|
4
|
+
data.tar.gz: 6fc57f049084c4e4f804c606eb9e9b1f482d06cad1ff48e203f8c517863c1b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dfbb0943bab181f662da38f69b92a2141f8599743d4e14ad6870cef3d9218c2d35c5a9335ec473085e05d3896eb10365766e46b5bffe122c8c4900c4bea8c41
|
7
|
+
data.tar.gz: 72e5e29a24e415e5b467464fe0b44d35c7bd8398e76db307159aa00575f2703cd33cfe4e1875719769fae6ff75d0ad9387d32049b4435a5a8bce391d8c345552
|
data/lib/active_prompt/base.rb
CHANGED
@@ -43,13 +43,13 @@ module ActivePrompt
|
|
43
43
|
private
|
44
44
|
|
45
45
|
def render_template(template_name)
|
46
|
-
template_path = File.join("app", "prompts", "#{self.class.name.underscore}", template_name)
|
46
|
+
template_path = File.join("app", "prompts", "templates", "#{self.class.name.underscore}", template_name)
|
47
47
|
template = File.read(template_path)
|
48
48
|
context = # Dynamic method call to get the variable value
|
49
49
|
self.class.variables.map do |var|
|
50
50
|
[var, send(var)]
|
51
51
|
end.to_h
|
52
|
-
Liquid::Template.parse(template).render(context)
|
52
|
+
Liquid::Template.parse(template).render(context.stringify_keys)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -10,9 +10,9 @@ module ActivePrompt
|
|
10
10
|
source_root File.expand_path("templates", __dir__)
|
11
11
|
|
12
12
|
def create_prompt_files
|
13
|
-
empty_directory "app/prompts/#{name.underscore}_prompt"
|
14
|
-
template "system.liquid", "app/prompts/#{name.underscore}_prompt/system.liquid"
|
15
|
-
template "user.liquid", "app/prompts/#{name.underscore}_prompt/user.liquid"
|
13
|
+
empty_directory "app/prompts/templates/#{name.underscore}_prompt"
|
14
|
+
template "system.liquid", "app/prompts/templates/#{name.underscore}_prompt/system.liquid"
|
15
|
+
template "user.liquid", "app/prompts/templates/#{name.underscore}_prompt/user.liquid"
|
16
16
|
create_file "app/prompts/#{name.underscore}_prompt.rb", <<~RUBY
|
17
17
|
# This is a generated prompt class for #{file_name}
|
18
18
|
class #{name.camelize}Prompt < ActivePrompt::Base
|