chat_gpt_error_handler 0.2.2 → 0.2.2.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: 66653c69558faf46858d9892cae31406a59ef8ded01b35fc2a34a499918f0144
4
- data.tar.gz: b412a2641d9c98ae2c690576d41e85107e65015d1427e1b82311f727608ae485
3
+ metadata.gz: 8d58bdea8e5604d2160eec14444c9be586d5ebab1e6ac16ee9c76175080b8984
4
+ data.tar.gz: 0b20217fe18f736085f47bde8be9cc4a4a0905291b504490d4e39bfe76dd756f
5
5
  SHA512:
6
- metadata.gz: b4610b96802076855b71b75b7929c50f02518749afbde6643cdd04c9e1fc0e1188a221ff4372f7e60eae3304441f6f01cdd0daa8d7cdeeed7ac5dd46104e1b64
7
- data.tar.gz: b92f12739b96255631b45cec85544dbd68f8697ddca6aaa501c85dc0115e4de68f73f8882fe41c60062e72d0d9f8521bdeb775e9a88107dc503d36c94dea7a44
6
+ metadata.gz: 792a0f62cab7ffa3b770225ad9edd8c122d7e2f7bb2b506bdf381af766c60ea5cc147073b2a4babc3b1cea2494054555710fef600ead813e91f89e14405de448
7
+ data.tar.gz: 96d5581efe1cb5954c429f973fd2527d415a886da0267ea620c7deac813cc6cbcb37512c37244f453a38235057a05e72082f3240da3647503d0bf0a9243ea474
@@ -46,19 +46,12 @@ module ChatGptErrorHandler
46
46
  }
47
47
  )
48
48
 
49
- # Try a second time if the response is empty. Raise the second time
50
- if response["choices"].nil?
51
- if @retried.nil?
52
- @retried = true
53
- redo
54
- else
55
- raise "GPT returned an empty response to your error message."
56
- end
49
+ response_text = if response["choices"].nil?
50
+ "GPT returned an empty response to your error message."
51
+ else
52
+ response["choices"].map { |c| c["text"].to_s }.join("")
57
53
  end
58
54
 
59
- response_text = response["choices"].map { |c| c["text"].to_s }
60
-
61
- response_text = response_text.join("")
62
55
  shortened_response_text = []
63
56
  begin
64
57
  # try to format the response text to be 75 characters per line
@@ -1,3 +1,3 @@
1
1
  module ChatGptErrorHandler
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chat_gpt_error_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Schwaderer