jekyll-chatgpt-translate 0.0.39 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/Gemfile +5 -5
- data/README.md +2 -1
- data/features/cli.feature +1 -0
- data/jekyll-chatgpt-translate.gemspec +3 -2
- data/lib/jekyll-chatgpt-translate/chatgpt.rb +2 -1
- data/lib/jekyll-chatgpt-translate/generator.rb +5 -1
- data/lib/jekyll-chatgpt-translate/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9285d05f0fd8813ffa969d52df39481324035a038f91a4958ec9fe5e875cb3d9
|
4
|
+
data.tar.gz: 8e17f117460148801d2f8a94a7885a01853ca44e62cb38a898aed1031424c968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c375ccbe265fa4d5c8e33230f4f238de544fe5a7de6fdba18eb5891b96e3b0107af5dc8bbe659c8cf8477d39df32059c031566e7b892344d6bfbef3d5373a5f
|
7
|
+
data.tar.gz: a5f126c7abe7e84856963f17d24dadd6815fa3c4aa3beef989a96c6381ec5b663af0ee8ec0f93d43aad8ff7c436640bd10a26fb07473a2e99c3ed68fd6912615
|
data/.github/workflows/rake.yml
CHANGED
data/Gemfile
CHANGED
@@ -25,11 +25,11 @@
|
|
25
25
|
source 'https://rubygems.org'
|
26
26
|
gemspec
|
27
27
|
|
28
|
-
gem 'cucumber', '9.0
|
28
|
+
gem 'cucumber', '9.1.0', require: false
|
29
29
|
gem 'kramdown-parser-gfm', '1.1.0', require: false
|
30
|
-
gem 'minitest', '5.
|
31
|
-
gem 'rake', '13.0
|
32
|
-
gem 'rubocop', '1.
|
33
|
-
gem 'rubocop-rspec', '2.
|
30
|
+
gem 'minitest', '5.20.0', require: false
|
31
|
+
gem 'rake', '13.1.0', require: false
|
32
|
+
gem 'rubocop', '1.57.2', require: false
|
33
|
+
gem 'rubocop-rspec', '2.25.0', require: false
|
34
34
|
gem 'simplecov', '0.22.0', require: false
|
35
35
|
gem 'webmock', '3.19.1', require: false
|
data/README.md
CHANGED
@@ -9,7 +9,8 @@ works for [my blog](https://github.com/yegor256/ru.yegor256.com),
|
|
9
9
|
for example [this page](https://ru.yegor256.com/2023-08-13-dictators.html) is translated to
|
10
10
|
[English](https://ru.yegor256.com/english/2023-08-13-dictators.html).
|
11
11
|
|
12
|
-
Install it first
|
12
|
+
Install it first (you need [Ruby 3+](https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/)
|
13
|
+
and [Jekyll 3+](https://jekyllrb.com/)):
|
13
14
|
|
14
15
|
```
|
15
16
|
gem install jekyll-chatgpt-translate
|
data/features/cli.feature
CHANGED
@@ -26,9 +26,9 @@ require 'English'
|
|
26
26
|
|
27
27
|
Gem::Specification.new do |s|
|
28
28
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
29
|
-
s.required_ruby_version = '>=
|
29
|
+
s.required_ruby_version = '>= 3.0'
|
30
30
|
s.name = 'jekyll-chatgpt-translate'
|
31
|
-
s.version = '0.0.
|
31
|
+
s.version = '0.0.41'
|
32
32
|
s.license = 'MIT'
|
33
33
|
s.summary = 'Translate Jekyll Pages Through ChatGPT'
|
34
34
|
s.description = [
|
@@ -46,6 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.add_runtime_dependency 'iri', '>= 0'
|
47
47
|
s.add_runtime_dependency 'iso-639', '>= 0'
|
48
48
|
s.add_runtime_dependency 'jekyll', '>= 3'
|
49
|
+
s.add_runtime_dependency 'json', '>= 2'
|
49
50
|
s.add_runtime_dependency 'redcarpet', '>= 3'
|
50
51
|
s.add_runtime_dependency 'ruby-openai', '>= 5'
|
51
52
|
s.add_runtime_dependency 'tiktoken_ruby', '>= 0.0.6'
|
@@ -23,6 +23,7 @@
|
|
23
23
|
# SOFTWARE.
|
24
24
|
|
25
25
|
require 'jekyll'
|
26
|
+
require 'json'
|
26
27
|
require 'openai'
|
27
28
|
require 'iso-639'
|
28
29
|
require 'tiktoken_ruby'
|
@@ -131,7 +132,7 @@ class GptTranslate::ChatGPT
|
|
131
132
|
temperature: 0.7
|
132
133
|
}
|
133
134
|
)
|
134
|
-
answer = response.dig('choices', 0, 'message', 'content')
|
135
|
+
answer = JSON.parse(response).dig('choices', 0, 'message', 'content')
|
135
136
|
if answer.nil?
|
136
137
|
Jekyll.logger.error("No content returned by ChatGPT: #{response}")
|
137
138
|
raise 'No content returned by ChatGPT'
|
@@ -114,7 +114,11 @@ class GptTranslate::Generator < Jekyll::Generator
|
|
114
114
|
config['source'] || 'en',
|
115
115
|
lang
|
116
116
|
)
|
117
|
-
foreign = gpt.translate(
|
117
|
+
foreign = gpt.translate(
|
118
|
+
plain,
|
119
|
+
min: min_chars,
|
120
|
+
window_length: (config['window_length'] || '2048').to_i
|
121
|
+
)
|
118
122
|
File.write(
|
119
123
|
path,
|
120
124
|
[
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-chatgpt-translate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: humanize
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: redcarpet
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
179
|
requirements:
|
166
180
|
- - ">="
|
167
181
|
- !ruby/object:Gem::Version
|
168
|
-
version: '
|
182
|
+
version: '3.0'
|
169
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - ">="
|