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 +4 -4
- data/lib/chat_gpt_error_handler/error_handler.rb +4 -11
- data/lib/chat_gpt_error_handler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d58bdea8e5604d2160eec14444c9be586d5ebab1e6ac16ee9c76175080b8984
|
4
|
+
data.tar.gz: 0b20217fe18f736085f47bde8be9cc4a4a0905291b504490d4e39bfe76dd756f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 792a0f62cab7ffa3b770225ad9edd8c122d7e2f7bb2b506bdf381af766c60ea5cc147073b2a4babc3b1cea2494054555710fef600ead813e91f89e14405de448
|
7
|
+
data.tar.gz: 96d5581efe1cb5954c429f973fd2527d415a886da0267ea620c7deac813cc6cbcb37512c37244f453a38235057a05e72082f3240da3647503d0bf0a9243ea474
|
@@ -46,19 +46,12 @@ module ChatGptErrorHandler
|
|
46
46
|
}
|
47
47
|
)
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|