pato-gpt 0.1.10 → 0.1.11
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 +4 -4
- data/README.md +1 -1
- data/lib/patogpt.rb +5 -14
- data/pato-gpt.gemspec +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: ebc8cef437d2c456f98cdb49d6fa8dd4c2f08fbe1f984f5466ca0fb2f8020342
|
4
|
+
data.tar.gz: 90a8bd191964ca7d8d06587fabbadc0604065630a7c1ee486068c67ada0959f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6852264f713a6c0f8c189030a48c3dbc5dd68f330aa694f80542fbac9682edc417f767e78a2aa6fc713b65e1919f2967cb7a05e718c321be0fcfcd326a053e1f
|
7
|
+
data.tar.gz: 18c85dceac884a70d5753a1ef2b07f030f0b03f0e4f08889d0172ee7f9de6c01cea84e170194eb1248901db5e6b12f2050ba8e9aa055e414f4cffbf5675d2f68
|
data/README.md
CHANGED
data/lib/patogpt.rb
CHANGED
@@ -4,7 +4,7 @@ require 'tty-markdown'
|
|
4
4
|
require 'pastel'
|
5
5
|
|
6
6
|
class Patogpt
|
7
|
-
def self.ask(q)
|
7
|
+
def self.ask(q, key)
|
8
8
|
payload = {
|
9
9
|
model: 'gpt-3.5-turbo',
|
10
10
|
messages: [{ role: 'user', content: q }]
|
@@ -17,7 +17,7 @@ class Patogpt
|
|
17
17
|
|
18
18
|
request = Net::HTTP::Post.new(uri)
|
19
19
|
request["Content-Type"] = "application/json"
|
20
|
-
request["Authorization"] = "Bearer #{
|
20
|
+
request["Authorization"] = "Bearer #{key}"
|
21
21
|
request.body = JSON.generate(payload)
|
22
22
|
|
23
23
|
response = https.request(request)
|
@@ -27,21 +27,12 @@ class Patogpt
|
|
27
27
|
resp_json['choices'][0].dig('message', 'content')
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.start(
|
30
|
+
def self.start(key)
|
31
|
+
key = key || ENV['OPENAI_API_KEY']
|
31
32
|
q = ''
|
32
33
|
|
33
34
|
pastel = Pastel.new
|
34
35
|
|
35
|
-
puts " _____ _ _____ _ "
|
36
|
-
puts " | __ \ | | / ____| | | "
|
37
|
-
puts " | |__) |_ _| |_ ___ | | __ _ __ | |_ "
|
38
|
-
puts " | ___/ _` | __/ _ \| | |_ | '_ \| __|"
|
39
|
-
puts " | | | (_| | || (_) | |__| | |_) | |_ "
|
40
|
-
puts " |_| \__,_|\__\___/ \_____| .__/ \__|"
|
41
|
-
puts " | | "
|
42
|
-
puts " |_| "
|
43
|
-
puts ""
|
44
|
-
|
45
36
|
while true
|
46
37
|
puts '..........................................................................................'
|
47
38
|
puts ''
|
@@ -52,7 +43,7 @@ class Patogpt
|
|
52
43
|
break if q == "exit"
|
53
44
|
|
54
45
|
if q.strip.length > 0
|
55
|
-
a = ask(q)
|
46
|
+
a = ask(q, key)
|
56
47
|
|
57
48
|
puts ''
|
58
49
|
print '@PatoGtp: '
|
data/pato-gpt.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "pato-gpt"
|
8
|
-
spec.version = "0.1.
|
8
|
+
spec.version = "0.1.11"
|
9
9
|
spec.authors = ["Andrew S Aguiar"]
|
10
10
|
spec.email = ["andrewaguiar6@gmail.com"]
|
11
11
|
spec.summary = 'Pato assistente'
|