pato-gpt 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/patogpt.rb +5 -14
  4. data/pato-gpt.gemspec +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af007fe5d84b55713d5c909ce1952e780c72c2badb1bcd265941d3508bdacb8f
4
- data.tar.gz: 7eb61d2c34387ea0181522b22e0253ae18c489c56f0a859b483c558ff3ff3edb
3
+ metadata.gz: ebc8cef437d2c456f98cdb49d6fa8dd4c2f08fbe1f984f5466ca0fb2f8020342
4
+ data.tar.gz: 90a8bd191964ca7d8d06587fabbadc0604065630a7c1ee486068c67ada0959f0
5
5
  SHA512:
6
- metadata.gz: 331b37dcc30e105f1ff1fc65cb9309013fe54b4a47143297f18ab575bd53c18c9744f82d6617d06627e7dc4ca6c5afdc07cbff0d89ababda1640ef8645ca9704
7
- data.tar.gz: c527ba05bf9121c52c50a93984b8d727bb6e91abe4eab7448becbe4dd9ab7ecb3a90d30fb311d69af7827f56f5e56b9efbf09cabe4efc91edf732ceacee47790
6
+ metadata.gz: 6852264f713a6c0f8c189030a48c3dbc5dd68f330aa694f80542fbac9682edc417f767e78a2aa6fc713b65e1919f2967cb7a05e718c321be0fcfcd326a053e1f
7
+ data.tar.gz: 18c85dceac884a70d5753a1ef2b07f030f0b03f0e4f08889d0172ee7f9de6c01cea84e170194eb1248901db5e6b12f2050ba8e9aa055e414f4cffbf5675d2f68
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PatoGpt
2
2
 
3
- ![PatoGpt](patogpt.png)
3
+ ![PatoGpt](patogpt.jpg)
4
4
 
5
5
  ## Installation
6
6
 
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 #{ENV['OPENAI_API_KEY']}"
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(_args)
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.10"
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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pato-gpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew S Aguiar