Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifiht committed Apr 22, 2024
1 parent b762afc commit 2883f39
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 45 deletions.
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.1.1)
beaneater (1.1.3)
celluloid (0.16.0)
timers (~> 4.0.0)
Expand Down Expand Up @@ -41,11 +44,21 @@ GEM
multipart-post (~> 2)
faraday-net_http (3.0.2)
ffi (1.15.5)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
hitimes (2.0.0)
http-2-next (0.5.1)
http (5.2.0)
addressable (~> 2.8)
base64 (~> 0.1)
http-cookie (~> 1.0)
http-form_data (~> 2.2)
llhttp-ffi (~> 0.5.0)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
http-form_data (2.3.0)
httpx (0.23.4)
http-2-next (>= 0.4.1)
ice_nine (0.11.2)
Expand All @@ -54,6 +67,9 @@ GEM
celluloid (~> 0.16.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0206)
Expand All @@ -66,6 +82,7 @@ GEM
pp (0.4.0)
prettyprint
prettyprint (0.1.1)
public_suffix (5.0.5)
puma (6.4.0)
nio4r (~> 2.0)
rake (13.0.6)
Expand Down Expand Up @@ -99,6 +116,7 @@ PLATFORMS
DEPENDENCIES
beaneater
discordrb
http
httpx
jemalloc
listen (~> 2.0)
Expand Down
6 changes: 3 additions & 3 deletions src/lib/shiki_stdlib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(module_name)
config = AppSettings.new
beanstalk_host = config.get("beanstalk_host")
beanstalk_port = config.get("beanstalk_port")

def eval_string(str)
begin
eval str
Expand All @@ -25,12 +25,12 @@ def eval_string(str)
pm2.log("NameError: #{str}")
end #begin
end #def

def run(proc)
bstalk = Beaneater.new("#{beanstalk_host}\:#{beanstalk_port}")
bstalk.tubes.find(@module_name) # also creates the tube
bstalk.tubes.watch!(@module_name)

core_threads << Thread.new {
loop do
job = bstalk.tubes.reserve
Expand Down
38 changes: 19 additions & 19 deletions src/modules/chat/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ def log_to_pm2(message)

def format_question(prompt)
request = {
"stream"=> false,
"n_predict"=> 400,
"temperature"=> 0,
"stop"=> [
"</s>",
"stream" => false,
"n_predict" => 400,
"temperature" => 0,
"stop" => [
"</s>",
],
"repeat_last_n"=> 256,
"repeat_penalty"=> 1,
"top_k"=> 20,
"top_p"=> 0.75,
"tfs_z"=> 1,
"typical_p"=> 1,
"presence_penalty"=> 0,
"frequency_penalty"=> 0,
"mirostat"=> 0,
"mirostat_tau"=> 5,
"mirostat_eta"=> 0.1,
"grammar"=> "",
"n_probs"=> 0,
"prompt"=> prompt
"repeat_last_n" => 256,
"repeat_penalty" => 1,
"top_k" => 20,
"top_p" => 0.75,
"tfs_z" => 1,
"typical_p" => 1,
"presence_penalty" => 0,
"frequency_penalty" => 0,
"mirostat" => 0,
"mirostat_tau" => 5,
"mirostat_eta" => 0.1,
"grammar" => "",
"n_probs" => 0,
"prompt" => prompt,
}
return request.to_json
end #def
Expand Down
36 changes: 18 additions & 18 deletions src/modules/discord/discord.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,24 @@ def eval_string(str)

def format_question(prompt)
request = {
"stream"=> false,
"n_predict"=> 400,
"temperature"=> 0,
"stop"=> ["\n@User:"],
"repeat_last_n"=> 256,
"repeat_penalty"=> 1,
"top_k"=> 20,
"top_p"=> 0.75,
"tfs_z"=> 1,
"typical_p"=> 1,
"presence_penalty"=> 0,
"frequency_penalty"=> 0,
"mirostat"=> 0,
"mirostat_tau"=> 5,
"mirostat_eta"=> 0.1,
"grammar"=> "",
"n_probs"=> 0,
"prompt"=> prompt
"stream" => false,
"n_predict" => 400,
"temperature" => 0,
"stop" => ["\n@User:"],
"repeat_last_n" => 256,
"repeat_penalty" => 1,
"top_k" => 20,
"top_p" => 0.75,
"tfs_z" => 1,
"typical_p" => 1,
"presence_penalty" => 0,
"frequency_penalty" => 0,
"mirostat" => 0,
"mirostat_tau" => 5,
"mirostat_eta" => 0.1,
"grammar" => "",
"n_probs" => 0,
"prompt" => prompt,
}
return request
end #def
Expand Down
4 changes: 2 additions & 2 deletions src/modules/example_module/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#==/ Create a new instance of the standard lib /==#
shiki = Shiki.new

#==/ This proc will run inside a thread of the standard lib,
#==/ This proc will run inside a thread of the standard lib,
#==/ any functions your module needs to implement should go here
hello_world = Proc.new {
loop do # this code will print "hello world!" to the pm2 logs until stopped
shiki.pm2.log("hello world!")
end #loop
}

#==/ This proc will run inside a thread of the standard lib,
#==/ This proc will run inside a thread of the standard lib,
#==/ any functions your module needs to implement should go here
send_hello_world = Proc.new {
loop do # this code will print "hello world!" to the pm2 logs until stopped
Expand Down
6 changes: 3 additions & 3 deletions src/modules/filesystem/filesystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
update_string = %x(cat $HOME/Maildir/new/`ls $HOME/Maildir/new|head -1`)
puts "New mail(#{Time.now}): #{update_file}"
%x(mv $HOME/Maildir/new/`ls $HOME/Maildir/new|head -1` $HOME/Maildir/cur/`ls $HOME/Maildir/new|head -1`)
end#if
end #if
sleep 5
end#loop
end#thread
end #loop
end #thread

0 comments on commit 2883f39

Please sign in to comment.