dorian-chat 1.1.2 → 2.0.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/chat +13 -11
  3. metadata +13 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bdbaec6c20e98306814cb9ddc8bfcca86ed38bf8c46c262372a1271a4d8a938
4
- data.tar.gz: 57f6d949992283c96c45ffa0ee0812158959dba0ed0b44565533a96ce3e23678
3
+ metadata.gz: 84520b867a73eded98a44029da0442e6b980da237e3edf6f2fed7976f041b923
4
+ data.tar.gz: d98c37bc01e61b0eafa1259ad476515b7f0fd94458274b14c35e61e87d31c117
5
5
  SHA512:
6
- metadata.gz: 63650da3ba3ec6be1d5faa052182e59461f147176938c2489f5788eb44868c45eb384102618344ff02e75fa191e5883779aabccdf9ca8be711ce3d4b22b6f949
7
- data.tar.gz: ec54b74015fb7d68d40a711307bd0d0673a00469939245570ec4702fb5eb340868bf3c1307dd51aade12cb2ff3a483f2d8547ef126cd7f093a91291c85f68a30
6
+ metadata.gz: 6815e791feadf2d763a5a494db8e78bd7e052ec1344c786b597bbf6cea093f040105d976d46c7bb3818bfc16650f8eb4f3d383d98e71d131948d0ebc0432ad6f
7
+ data.tar.gz: 1c1e82d292875841d108806323e889f6d2a259849f211c68ab383816bae63a92743118cd5ecf2872f7deebe5872639d207a1075a828a8fc6b17e441f1cf69f75
data/bin/chat CHANGED
@@ -8,15 +8,6 @@ require "uri"
8
8
 
9
9
  TOKEN_FILE = File.join(Dir.home, ".chat")
10
10
 
11
- if File.exist?(TOKEN_FILE)
12
- TOKEN = File.read(TOKEN_FILE).strip
13
- else
14
- print "token: "
15
- TOKEN = gets.strip
16
- File.write(TOKEN_FILE, TOKEN)
17
- puts "token written to #{TOKEN_FILE}"
18
- end
19
-
20
11
  parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
21
12
 
22
13
  abort parsed.help if parsed.options.help
@@ -25,6 +16,17 @@ if parsed.options.version
25
16
  abort File.read(File.expand_path("../VERSION", __dir__))
26
17
  end
27
18
 
19
+ token =
20
+ if File.exist?(TOKEN_FILE)
21
+ File.read(TOKEN_FILE).strip
22
+ else
23
+ print "token: "
24
+ token = gets.strip
25
+ File.write(TOKEN_FILE, token)
26
+ puts "token written to #{TOKEN_FILE}"
27
+ token
28
+ end
29
+
28
30
  content = parsed.arguments.join(" ")
29
31
  content += parsed.files.map { |file| File.read(file) }.join("\n")
30
32
  content = $stdin.each_line.to_a.join if content.strip.empty?
@@ -39,13 +41,13 @@ request =
39
41
  uri.path,
40
42
  {
41
43
  "Content-Type" => "application/json",
42
- "Authorization" => "Bearer #{TOKEN}"
44
+ "Authorization" => "Bearer #{token}"
43
45
  }
44
46
  )
45
47
 
46
48
  request.body = {
47
49
  model: "gpt-4o",
48
- messages: [{ role: "user", content: }]
50
+ messages: [{ role: "user", content: content }]
49
51
  }.to_json
50
52
 
51
53
  response = http.request(request)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dorian-arguments
@@ -16,15 +15,21 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
18
+ version: 1.2.3
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '2'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - ">="
25
27
  - !ruby/object:Gem::Version
26
- version: '0'
27
- description: chat with ai
28
+ version: 1.2.3
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '2'
32
+ description: Provides a small command line chat helper for AI-backed conversations.
28
33
  email: dorian@dorianmarie.com
29
34
  executables:
30
35
  - chat
@@ -37,7 +42,6 @@ licenses:
37
42
  - MIT
38
43
  metadata:
39
44
  rubygems_mfa_required: 'true'
40
- post_install_message:
41
45
  rdoc_options: []
42
46
  require_paths:
43
47
  - lib
@@ -45,15 +49,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
49
  requirements:
46
50
  - - ">="
47
51
  - !ruby/object:Gem::Version
48
- version: 3.3.0
52
+ version: '4.0'
49
53
  required_rubygems_version: !ruby/object:Gem::Requirement
50
54
  requirements:
51
55
  - - ">="
52
56
  - !ruby/object:Gem::Version
53
57
  version: '0'
54
58
  requirements: []
55
- rubygems_version: 3.5.16
56
- signing_key:
59
+ rubygems_version: 4.0.15
57
60
  specification_version: 4
58
61
  summary: chat with ai
59
62
  test_files: []