chatgpt2023 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b89dececa8f5b5da00c97e7e745168c9a0526481f61138a03d5d2b7ff7b4576
4
- data.tar.gz: b8d72dc15a1a051493786a53d22ed3a0bf135234bddf5d7d72c1db77a264ed6c
3
+ metadata.gz: 5fa6c7ff39ad8b06d1908bdeafe1e7e695f2b49fc4a7b5c0f1fc3436bae550ca
4
+ data.tar.gz: 507e44dc68538096b23ac3d3cd17e1e6ce3e6ceabdc78469f872731c18a9cd95
5
5
  SHA512:
6
- metadata.gz: 31f3e1e57bbd60a724dff54a8317bd8501d939f797d5dd1bc673b9814f581f313d475d2e43900757057e64e5ab2d6e8106cdf055719c16ae935895f9283a2d81
7
- data.tar.gz: 96e1288e2a79d823d18aaeeb6716f7239c26bc956d1a807530cf64a78ead4a162055103256ab7f6352ef56218198b4de01f9e7e6cf2bc83ce3236729d7861862
6
+ metadata.gz: 28e5169a1d13568bcdbe83c677d125e1a0aa275318f41aabbd8acdee6376f28f0dfda6a56de4604e273d8d3d6fe18883172c556636be5fb726a79223e70a638d
7
+ data.tar.gz: 4d1e69b95f4c16c181426926ffde1d9b4d46cc97f59b8478fee5964a0d2bc216ac6f7bd5f5aeb4076154ed2b6e82ebbe083499351e978969a16f7c3905faad2c
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/chatgpt2023.rb CHANGED
@@ -39,12 +39,12 @@ end
39
39
 
40
40
  class ChatGpt2023
41
41
 
42
- def initialize(apikey: nil, debug: false)
42
+ def initialize(apikey: nil, attempts: 1, debug: false)
43
43
 
44
44
  @apiurl = "https://api.openai.com/v1"
45
45
 
46
46
  raise 'You must supply an API key!' unless apikey
47
- @apikey, @debug = apikey, debug
47
+ @apikey, @attempts, @debug = apikey, attempts, debug
48
48
 
49
49
  end
50
50
 
@@ -207,7 +207,7 @@ class ChatGpt2023
207
207
  sleep 5
208
208
  end
209
209
 
210
- end while h.has_key?(:error) and attempts <= 5
210
+ end while h.has_key?(:error) and attempts < @attempts
211
211
 
212
212
  raise ChatGpt2023Error, h[:error][:message].inspect if h.has_key? :error
213
213
 
@@ -221,9 +221,9 @@ class CGRecorder < ChatGpt2023
221
221
  attr_reader :index
222
222
 
223
223
  def initialize(apikey: nil, indexfile: 'cgindex.xml',
224
- logfile: 'chatgpt.xml', debug: false)
224
+ logfile: 'chatgpt.xml', attempts: 1, debug: false)
225
225
 
226
- super(apikey: apikey, debug: debug)
226
+ super(apikey: apikey, attempts: attempts, debug: debug)
227
227
  @dx = DynarexDaily.new filename: logfile, fields: %i(prompt result),
228
228
  autosave: true, order: 'descending', debug: false
229
229
  @index = Dynarex.new(indexfile, schema: 'entries[title]/entry(prompt, ' \
@@ -280,7 +280,7 @@ class ChatAway
280
280
  cgfile = File.join(filepath, 'chatgpt.xml')
281
281
 
282
282
  @dx = questions.is_a?(Dynarex) ? questions : Dynarex.new(questions)
283
- @chat = CGRecorder.new(apikey: apikey, indexfile: idxfile, logfile: cgfile)
283
+ @chat = CGRecorder.new(apikey: apikey, indexfile: idxfile, logfile: cgfile, attempts: 5)
284
284
  @prompts = @chat.index.all.map(&:prompt)
285
285
 
286
286
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatgpt2023
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -36,7 +36,7 @@ cert_chain:
36
36
  6FQD1/GISew7VvxUJdptXeuVNIsdNKxvL3RpfLCuFsi1WXyJ4k3odRMTmS0kAfTy
37
37
  J4sZZW9RNfabTMQQY7DIs3tUAn6i+O0r9lo=
38
38
  -----END CERTIFICATE-----
39
- date: 2023-02-14 00:00:00.000000000 Z
39
+ date: 2023-02-15 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: down
metadata.gz.sig CHANGED
Binary file