active_prompt_rails 0.1.15 → 0.1.17
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: df889c73c63dcc2e26df997462cd642c181e816eb2bf7288ebd16073530b2c78
|
4
|
+
data.tar.gz: 5b0410dc6666a2522b284ca57414b5ac9b3033002ca8772f037ae884d74ef51a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79326076dcec72e9dea1647210023938f005b597b3ca156dcae35bb619fc4ae55c4466c170a3349b53122be705c30eccfa875e8d2f1ac97ea6aaffcd174abbec
|
7
|
+
data.tar.gz: d8051dc16be682e9a00905abecb845a75e8590cfecda2845a428c777606fc65d41e6cf63ff9ea0ffa64864d2e76819f1eea4fed816de595296eca30240acb0e2
|
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}
|
46
|
+
template_path = File.join("app", "prompts", "#{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,7 +10,7 @@ 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}"
|
13
|
+
empty_directory "app/prompts/#{name.underscore}_prompt"
|
14
14
|
template "system.liquid", "app/prompts/#{name.underscore}_prompt/system.liquid"
|
15
15
|
template "user.liquid", "app/prompts/#{name.underscore}_prompt/user.liquid"
|
16
16
|
create_file "app/prompts/#{name.underscore}_prompt.rb", <<~RUBY
|