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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af007fe5d84b55713d5c909ce1952e780c72c2badb1bcd265941d3508bdacb8f
4
- data.tar.gz: 7eb61d2c34387ea0181522b22e0253ae18c489c56f0a859b483c558ff3ff3edb
3
+ metadata.gz: 25006927a39868374f0f9b59bfecd61469c6b0a7b9ebbcf3dfc57df662d793d9
4
+ data.tar.gz: 3141dcf71bc35b31e77b100de4d5538003092d0a797de58eb2304f35aa64ed39
5
5
  SHA512:
6
- metadata.gz: 331b37dcc30e105f1ff1fc65cb9309013fe54b4a47143297f18ab575bd53c18c9744f82d6617d06627e7dc4ca6c5afdc07cbff0d89ababda1640ef8645ca9704
7
- data.tar.gz: c527ba05bf9121c52c50a93984b8d727bb6e91abe4eab7448becbe4dd9ab7ecb3a90d30fb311d69af7827f56f5e56b9efbf09cabe4efc91edf732ceacee47790
6
+ metadata.gz: b2a01486864d4274a46f8ab413c6315c760b1b60754c514d90ba251eb982a85bc6a292ace0b72ede862d0da34844f9d2516f5147463022447c978ea2e673b24c
7
+ data.tar.gz: 51b9eed0951914f6cd6db8d78e678f17c19a8f429401d88b6db99b703b50148a032ebf077a7fe0c4895ed2665f80d736f18ad621c9d01713a17119b9e611a907
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/bin/patogpt CHANGED
@@ -3,4 +3,4 @@
3
3
 
4
4
  require "patogpt"
5
5
 
6
- Patogpt.start(ARGV)
6
+ Patogpt.start(ARGV[0])
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.12"
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.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew S Aguiar