pato-gpt 0.1.10 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/patogpt +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: 25006927a39868374f0f9b59bfecd61469c6b0a7b9ebbcf3dfc57df662d793d9
|
4
|
+
data.tar.gz: 3141dcf71bc35b31e77b100de4d5538003092d0a797de58eb2304f35aa64ed39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2a01486864d4274a46f8ab413c6315c760b1b60754c514d90ba251eb982a85bc6a292ace0b72ede862d0da34844f9d2516f5147463022447c978ea2e673b24c
|
7
|
+
data.tar.gz: 51b9eed0951914f6cd6db8d78e678f17c19a8f429401d88b6db99b703b50148a032ebf077a7fe0c4895ed2665f80d736f18ad621c9d01713a17119b9e611a907
|
data/README.md
CHANGED
data/bin/patogpt
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.12"
|
9
9
|
spec.authors = ["Andrew S Aguiar"]
|
10
10
|
spec.email = ["andrewaguiar6@gmail.com"]
|
11
11
|
spec.summary = 'Pato assistente'
|