llama_bot_rails 0.1.5 β†’ 0.1.6

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: 2e2df41e770f0dbcc740af59357462c33b0bcb87d3dd0394e343729d4d1a4a45
4
- data.tar.gz: b7032c39fe95fc8e5dc5ab892c8abd28366c77db7c4826a29f6096511124e9ca
3
+ metadata.gz: 44750a5b4dc8e228f8b3422c91f875024e8994a6800bccefd7a3c5303f1e0487
4
+ data.tar.gz: 4cb58030cd0100dbaf1d6a64f75ad2e12bc1840153f9d50661a6258aa429a55d
5
5
  SHA512:
6
- metadata.gz: 5b4ad9c9ce5bbb3bbb3d645c3db6e87cff9fc398c0ce412c75d7687c79b7532c751518add6f583566ebb20423e465a1b6f81611448ddf08de4a97d2f5704fc79
7
- data.tar.gz: 172d5d32f0b0742ca51f6c47468019c628d7043e20b212324fc4f8da987a3aabd0e06dd5375375bf645cb62377f7ca2b12b227f640ff54b494dc52c050a18484
6
+ metadata.gz: f29e9c1d3ce80499e237bcbcfabe0bc6cd4ba6ab2271cef4b1d8f5bb4bec5d70753e66589368be68ea3f71b2f35dd613f2849a9c2f8beb2dc9cff530bcbc8fcf
7
+ data.tar.gz: e1eb3bf985687e22321804d7b572c027370ac57303fc82ef17ac088ec36af68a6d3030147ecad1a32fdc8cfe20e35bd4b72fdfa3195023db3570eeafa55072ff
data/README.md CHANGED
@@ -12,7 +12,7 @@ Chat with a powerful agent that has access to your models, your application cont
12
12
 
13
13
  ## πŸŽ₯ **See it in action** (30-Second Demo)
14
14
 
15
- πŸ‘‰ [Insert GIF or YouTube link here]
15
+ πŸ‘‰ ![LlamaBot Demo](https://llamapress-ai-image-uploads.s3.us-west-2.amazonaws.com/pp1s3l4iskwabnq0gi5tx8mi9mue)
16
16
  β€œWelcome to the future of Rails + AI.”
17
17
 
18
18
  ### The agent can:
@@ -7,9 +7,25 @@ module LlamaBotRails
7
7
  # POST /agent/command
8
8
  def command
9
9
  input = params[:command]
10
+
11
+ # Capture both stdout and return value
12
+ output = StringIO.new
13
+ result = nil
14
+
15
+ $stdout = output
10
16
  result = safety_eval(input)
11
- render json: { result: result.inspect }
17
+ $stdout = STDOUT
18
+
19
+ # If result is a string and output has content, prefer output
20
+ final_result = if output.string.present?
21
+ output.string.strip
22
+ else
23
+ result
24
+ end
25
+
26
+ render json: { result: final_result }
12
27
  rescue => e
28
+ $stdout = STDOUT # Reset stdout on error
13
29
  render json: { error: e.class.name, message: e.message }, status: :unprocessable_entity
14
30
  end
15
31
 
@@ -53,12 +69,11 @@ module LlamaBotRails
53
69
  private
54
70
 
55
71
  def safety_eval(input)
56
- # VERY basic, sandbox for real use!
57
- result = eval(input)
58
-
59
- { result: result.inspect }
60
- rescue => e
61
- { error: e.class.name, message: e.message }
72
+ # Change to Rails root directory for file operations
73
+ Dir.chdir(Rails.root) do
74
+ # Create a safer evaluation context
75
+ binding.eval(input)
76
+ end
62
77
  end
63
78
 
64
79
  def authenticate_agent!
@@ -1,3 +1,3 @@
1
1
  module LlamaBotRails
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llama_bot_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kody Kendall