nano-bots 0.1.0 → 0.1.1

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: 4632306b0fe1fc9af4ee96c7624f163d80c70eb259c80f3efad158e95e76414a
4
- data.tar.gz: a2156c47648e3b8b118a4698d23031ca4bd4bf139db6f5f19fa5561f1591cf7b
3
+ metadata.gz: acc012feeff1090abe2df65283bdd02c8eb1c44bdb5cad13a91ce5dc481727a8
4
+ data.tar.gz: b34a3d078c723494e12bfcdf6793294d400adbe5150302d675eef569d471ff37
5
5
  SHA512:
6
- metadata.gz: d8271268413e87793b147385c999edddbb59dc70203dfca243adb7836ee680dc430a57dc625d038394b6b86e3bb0a9a4e45f12291f9e1ef9574da8ee69ed93e5
7
- data.tar.gz: 1d6d1118162ed3dbc3438205aa7b4e858499d154e7cc6bdba963a53ddeeff7c071398e9eebc1f3d273c7aa128c39fbcb452a8f6f9bfff8d41b2dac81fb04d9ce
6
+ metadata.gz: 617b3fda80392476c1943f3df9e5201d1cd5f377ede9b76b413748ca4197834b7058f4b48abc599af4eddff0879e111f7860a403759eda34cdcc3894f8d865e8
7
+ data.tar.gz: 7907c44f88d19ea62e57b1288410f80045438c4ba7a9bc962fe07cb4535467b88aea43e618e5165971403e2ac30d16c52a0cf56077916bbb5082d0cee4945892
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nano-bots (0.1.0)
4
+ nano-bots (0.1.1)
5
5
  babosa (~> 2.0)
6
6
  dotenv (~> 2.8, >= 2.8.1)
7
7
  faraday (~> 2.7, >= 2.7.5)
data/README.md CHANGED
@@ -28,13 +28,13 @@ https://user-images.githubusercontent.com/113217272/238141567-c58a240c-7b67-4b3b
28
28
  For a system usage:
29
29
 
30
30
  ```sh
31
- gem install nano-bots -v 0.1.0
31
+ gem install nano-bots -v 0.1.1
32
32
  ```
33
33
 
34
34
  To use it in a project, add it to your `Gemfile`:
35
35
 
36
36
  ```ruby
37
- gem 'nano-bots', '~> 0.1.0'
37
+ gem 'nano-bots', '~> 0.1.1'
38
38
  ```
39
39
 
40
40
  ```sh
@@ -85,15 +85,15 @@ version: '3.7'
85
85
  services:
86
86
  nano-bots:
87
87
  image: ruby:3.2.2-slim-bullseye
88
- command: sh -c "gem install nano-bots -v 0.1.0 && bash"
88
+ command: sh -c "gem install nano-bots -v 0.1.1 && bash"
89
89
  environment:
90
90
  OPENAI_API_ADDRESS: https://api.openai.com
91
91
  OPENAI_API_KEY: your-access-token
92
92
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
93
93
  NANO_BOTS_END_USER: your-user
94
94
  volumes:
95
- - ./your-cartridges:/.local/share/nano-bots/cartridges
96
- - ./your-state:/.local/state/nano-bots
95
+ - ./your-cartridges:/root/.local/share/nano-bots/cartridges
96
+ - ./your-state-path:/root/.local/state/nano-bots
97
97
  ```
98
98
 
99
99
  Enter the container:
@@ -408,5 +408,5 @@ gem build nano-bots.gemspec
408
408
 
409
409
  gem signin
410
410
 
411
- gem push nano-bots-0.1.0.gem
411
+ gem push nano-bots-0.1.1.gem
412
412
  ```
@@ -24,14 +24,22 @@ module NanoBot
24
24
  def self.fennel(content, expression)
25
25
  path = "#{File.expand_path('../static/fennel', __dir__)}/?.lua"
26
26
  state = SweetMoon::State.new(package_path: path).fennel
27
- state.fennel.eval("(set _G.adapter (fn [content] #{expression}))")
27
+ # TODO: global is deprecated...
28
+ state.fennel.eval(
29
+ "(global adapter (fn [content] #{expression}))", 1,
30
+ { allowedGlobals: %w[math string table] }
31
+ )
28
32
  adapter = state.get(:adapter)
29
33
  adapter.call([content])
30
34
  end
31
35
 
32
36
  def self.lua(content, expression)
33
37
  state = SweetMoon::State.new
34
- state.eval("adapter = function(content) return #{expression}; end")
38
+ code = "_, adapter = pcall(load('return function(content) return #{
39
+ expression.gsub("'", "\\\\'")
40
+ }; end', nil, 't', {math=math,string=string,table=table}))"
41
+
42
+ state.eval(code)
35
43
  adapter = state.get(:adapter)
36
44
  adapter.call([content])
37
45
  end
@@ -3,12 +3,12 @@ version: '3.7'
3
3
  services:
4
4
  nano-bots:
5
5
  image: ruby:3.2.2-slim-bullseye
6
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev && gem install nano-bots -v 0.1.0 && bash"
6
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev && gem install nano-bots -v 0.1.1 && bash"
7
7
  environment:
8
8
  OPENAI_API_ADDRESS: https://api.openai.com
9
9
  OPENAI_API_KEY: your-access-token
10
10
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
11
11
  NANO_BOTS_END_USER: your-user
12
12
  volumes:
13
- - ./your-cartridges:/.local/share/nano-bots/cartridges
14
- - ./your-state:/.local/state/nano-bots
13
+ - ./your-cartridges:/root/.local/share/nano-bots/cartridges
14
+ - ./your-state-path:/root/.local/state/nano-bots
data/static/gem.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module NanoBot
4
4
  GEM = {
5
5
  name: 'nano-bots',
6
- version: '0.1.0',
6
+ version: '0.1.1',
7
7
  author: 'icebaker',
8
8
  summary: 'Ruby Implementation of Nano Bots: small, AI-powered bots',
9
9
  description: 'Ruby Implementation of Nano Bots: small, AI-powered bots easily shared as a single file, designed to support multiple providers such as Vicuna, OpenAI ChatGPT, Google PaLM, Alpaca, and LLaMA.',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nano-bots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - icebaker