sawara 0.1.0 → 0.1.1
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/.rubocop.yml +4 -0
- data/lib/sawara/config.rb +2 -2
- data/lib/sawara/talk.rb +5 -5
- data/lib/sawara/version.rb +1 -1
- data/sawara.gemspec +39 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34bee8ad292b23c3f9263d82403ae7da181151e5bd066288c557804f11258882
|
4
|
+
data.tar.gz: 7891f97562dbbc91fc25f26f9c8fa964248cfd72b0c469c17f1760219973e95b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc5e8e6127bdde3375dc1bf6955b6375937e9d98b202337ce6dbd1716ba404eecc21d89a23aaf4f0697e99622e0289543049c9454ce12c512e0fcd69022a645a
|
7
|
+
data.tar.gz: 894d27aa3d9218981c6f18462f2a5741de837872ea075ddd807c56747f7a0b6c5f188c34ae221a76ccfae555ad4c40f42967556d2f3ec31939fc9748c1944d97
|
data/.rubocop.yml
CHANGED
data/lib/sawara/config.rb
CHANGED
@@ -8,7 +8,7 @@ module Sawara
|
|
8
8
|
CONFIG_PATH = "#{Dir.home}/.sawara".freeze
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
unless File.exist?
|
11
|
+
unless File.exist?(CONFIG_PATH)
|
12
12
|
File.new(CONFIG_PATH, 'w')
|
13
13
|
update_config
|
14
14
|
end
|
@@ -28,7 +28,7 @@ module Sawara
|
|
28
28
|
def update_config
|
29
29
|
puts 'Enter your OpenAI API Key.'
|
30
30
|
api_key = $stdin.gets
|
31
|
-
store = YAML::Store.new
|
31
|
+
store = YAML::Store.new(CONFIG_PATH)
|
32
32
|
store.transaction do
|
33
33
|
store['api_key'] = api_key
|
34
34
|
end
|
data/lib/sawara/talk.rb
CHANGED
@@ -27,7 +27,7 @@ module Sawara
|
|
27
27
|
Hint 2: To exit this conversation, press "Ctrl + d" without any message.
|
28
28
|
MSG
|
29
29
|
puts
|
30
|
-
puts '
|
30
|
+
puts 'S a w a r a 🐟'.center(80)
|
31
31
|
puts '*' * 80
|
32
32
|
puts hints
|
33
33
|
puts '*' * 80
|
@@ -35,16 +35,16 @@ module Sawara
|
|
35
35
|
|
36
36
|
def await_user_content
|
37
37
|
puts
|
38
|
-
|
39
|
-
content = $stdin.readlines.join
|
38
|
+
puts 'You:'
|
39
|
+
content = $stdin.readlines.join.sub(/\n*$/, '')
|
40
40
|
@messages << { role: 'user', content: }
|
41
41
|
content
|
42
42
|
end
|
43
43
|
|
44
44
|
def await_assistant_content(client)
|
45
45
|
puts
|
46
|
-
|
47
|
-
content = client.fetch(@messages).sub
|
46
|
+
puts 'Sawara:'
|
47
|
+
content = client.fetch(@messages).sub(/^\n*/, '')
|
48
48
|
@messages << { role: 'assistant', content: }
|
49
49
|
puts content
|
50
50
|
end
|
data/lib/sawara/version.rb
CHANGED
data/sawara.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/sawara/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'sawara'
|
7
|
+
spec.version = Sawara::VERSION
|
8
|
+
spec.authors = ['yocajii']
|
9
|
+
spec.email = ['yocajii@stone.sakura.ne.jp']
|
10
|
+
|
11
|
+
spec.summary = 'This is ChatGPT CLI.'
|
12
|
+
spec.description = 'Sawara is a comannd-line tool for using ChatGPT via OpenAI API.'
|
13
|
+
|
14
|
+
spec.homepage = 'https://github.com/yocajii/sawara'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = '>= 3.1.0'
|
17
|
+
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/yocajii/sawara'
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/yocajii/sawara/blob/main/CHANGELOG.md'
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(__dir__) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(File.expand_path(f) == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
spec.bindir = 'exe'
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
# spec.add_dependency 'example-gem', '~> 1.0'
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sawara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yocajii
|
@@ -10,7 +10,7 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2023-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: Sawara is a comannd-line tool for using ChatGPT via OpenAI API.
|
14
14
|
email:
|
15
15
|
- yocajii@stone.sakura.ne.jp
|
16
16
|
executables:
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- lib/sawara/config.rb
|
34
34
|
- lib/sawara/talk.rb
|
35
35
|
- lib/sawara/version.rb
|
36
|
+
- sawara.gemspec
|
36
37
|
- sig/chatgpt_cli.rbs
|
37
38
|
homepage: https://github.com/yocajii/sawara
|
38
39
|
licenses:
|