open_ai_bot 0.3.1 → 0.3.2

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: 21fff768a394b10773c77b9fafea42d01500cca136aea8c418753da1ad61024d
4
- data.tar.gz: 7b2da8e1e8e0038a5420877ed0644888c0948976876dc065f65bb0f1ba9f94f1
3
+ metadata.gz: e31ed7bc34cf94ba2d339a1efa6b57a0d9fd972aec39961a98253cb5b9dcc4df
4
+ data.tar.gz: 2f92b54b9788efacd9bf50b66004c777a8eeb3bd934ffc65a2ea93a4a12c39e6
5
5
  SHA512:
6
- metadata.gz: 82fff5e67a384cbcd0cb6d8a99bb1a3c9a42016ced7dbe9bd2d93d694183ab299f5b9b308662660c3997aa3d6407e420151e28e019ed9d63c1a8716b50bb3b6e
7
- data.tar.gz: e525381d25b1e2d81e3bbd73c6c6990753948d0287c476f531fca32f16e3980b0f8380869945e9254e639925a6247ac799a140442899496d74687554631370e2
6
+ metadata.gz: 38ff4646a9493b2771d62cce25d8a2ff0ab589bc2d300041fec4536e6e75065e33c79fe452994dd5d9a628be6646e4ed97bb97a7c28503811b3a3db1b8fefa9f
7
+ data.tar.gz: 872adfdeb95db9ccbdd8073ee736136a40d4517b1b4eddee9ddf5885638dfe286c705554dd708c654dd1e9b83c62682626fd63cf3d2e878fea536a4d79c08d67
@@ -8,6 +8,7 @@ module OpenAI
8
8
  end
9
9
 
10
10
  def new_thread(chat_id, model = nil)
11
+ model ||= config.open_ai["chat_gpt_model"].to_sym
11
12
  msgs = config.open_ai["whitelist"].include?(chat_id) ? initial_messages : []
12
13
  new_thread = ChatThread.new(msgs, model)
13
14
  threads[chat_id] = new_thread
@@ -2,8 +2,7 @@
2
2
 
3
3
  module OpenAI
4
4
  class ChatThread
5
- def initialize(defaults = [], model = nil)
6
- model ||= OpenAIBot.config.open_ai["chat_gpt_model"].to_sym
5
+ def initialize(defaults = [], model)
7
6
  @history ||= defaults
8
7
  @model = model.is_a?(Model) ? model : Model.new(model)
9
8
  puts @history
data/lib/open_ai/model.rb CHANGED
@@ -25,7 +25,9 @@ module OpenAI
25
25
  end
26
26
 
27
27
  def initialize(model)
28
- raise ArgumentError.new("Unknown model: #{model}") unless MODEL_INFO[model]
28
+ if MODEL_INFO[model].nil?
29
+ raise ArgumentError.new("Unknown model: #{model.inspect}.")
30
+ end
29
31
 
30
32
  @model = model
31
33
  end
data/open_ai_bot.gemspec CHANGED
@@ -8,7 +8,7 @@ require_relative "lib/ext/in"
8
8
 
9
9
  Gem::Specification.new do |spec|
10
10
  spec.name = "open_ai_bot"
11
- spec.version = "0.3.1"
11
+ spec.version = "0.3.2"
12
12
  spec.authors = ["bulgakke"]
13
13
  spec.email = ["vvp835@yandex.ru"]
14
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_ai_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bulgakke