diff options
| author | sigoden <sigoden@gmail.com> | 2024-06-05 18:37:52 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-05 18:37:52 +0800 |
| commit | 005d23030dab2b7708996e779dc78dd5f8ebdb8d (patch) | |
| tree | 0d05583d462a4795a4236a5006befc096047e969 /cmd/cmd.rb | |
| parent | 7e3f47093f2dcb36cf94a35403027ec72bf7b084 (diff) | |
| download | llm-functions-docker-005d23030dab2b7708996e779dc78dd5f8ebdb8d.tar.gz | |
feat: adjust project structure (#16)
Diffstat (limited to 'cmd/cmd.rb')
| -rwxr-xr-x | cmd/cmd.rb | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/cmd/cmd.rb b/cmd/cmd.rb deleted file mode 100755 index f8ca5dd..0000000 --- a/cmd/cmd.rb +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env ruby - -require 'json' -require 'pathname' - -def parse_argv - func_file = __FILE__ - func_data = nil - - if func_file.end_with?("cmd.rb") - func_file = ARGV[0] - func_data = ARGV[1] - else - func_file = File.basename(func_file) - func_data = ARGV[0] - end - - func_file += '.rb' unless func_file.end_with?(".rb") - - [func_file, func_data] -end - -def load_func(func_file) - func_path = File.expand_path("../rb/#{func_file}", __dir__) - - begin - require func_path - rescue LoadError - puts "Invalid function: #{func_file}" - exit 1 - end -end - -func_file, func_data = parse_argv - -if ENV["LLM_FUNCTION_ACTION"] == "declarate" - load_func(func_file) - puts JSON.pretty_generate(declarate) -else - if func_data.nil? - puts "No json data" - exit 1 - end - - begin - args = JSON.parse(func_data) - rescue JSON::ParserError - puts "Invalid json data" - exit 1 - end - - load_func(func_file) - execute(args) -end
\ No newline at end of file |
