tdiary-contrib 5.3.0 → 5.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d28e4c6ad18e641ce3998648c7b1735ad42f439ffe868c5cef97f28ac8e9d018
4
- data.tar.gz: cc978600003b50b6bfed72750e6e4ba0cb90ffa8433d89be583d9a8289e3fa86
3
+ metadata.gz: 0ea6ac9aa57f48f37e87e0487488694fedde1f3b36f9a352532975e205a9a0b8
4
+ data.tar.gz: 9e33bee8f1c7fa448357428e5ba06f5574553d3b37fb0a7b031cfaa00c557632
5
5
  SHA512:
6
- metadata.gz: d489a23467625b99e58f3bbd090bef40ff0ae16f3caaa6913f5a9c2314d8554e01954546c547ca35bab2ccb2d6e7597baac675fa9e0fb79e81f0178a614a0788
7
- data.tar.gz: 23879c32c58ed959ae16e09e12727e5376b0b60bb368b071def02888308453e09d03f383a4d8fccb3e678e30af3d96a42bc1918d931d1b22dc9acd8e475aec38
6
+ metadata.gz: 5e3ac23fa672b189da7a9e19cc3b6b24d46c66e30b2d32fd58dd74dff13009863d54340501fafe6c231ceab537c3570ccd11f893d3b6a4b79b69df52ab9a425d
7
+ data.tar.gz: 9e8db2d64a4c054da3ba8dfcd947b435fcfe3e4a86b66dd5be9e5c33a902e66486fe01201adde278b4b8dbff3348bcdc2430b3108b75e04ed2822a8101ee357b
@@ -1,5 +1,5 @@
1
1
  module TDiary
2
2
  class Contrib
3
- VERSION = "5.3.0"
3
+ VERSION = "5.4.0"
4
4
  end
5
5
  end
@@ -25,6 +25,10 @@
25
25
  # @options['chatgpt_elaborate.AZURE_OPENAI_API_DEPLOYMENT_NAME'] : モデル・デプロイ名
26
26
  # @options['chatgpt_elaborate.AZURE_OPENAI_API_VERSION'] : APIバージョン 2023-05-15 など
27
27
  #
28
+ # 共通設定(オプション)
29
+ # @options['chatgpt_elaborate.MAX_TOKEN'] : 応答最大トークン数(default:2000 トークン)
30
+ # @options['chatgpt_elaborate.READ_TIMEOUT'] : 応答最大待ち時間(default:90 秒)
31
+ # @options['chatgpt_elaborate.TEMPERATURE'] : 温度(default: 0.7)
28
32
 
29
33
  require 'timeout'
30
34
  require 'json'
@@ -41,10 +45,13 @@ def elaborate_api( sentence )
41
45
  instanceName = @conf['chatgpt_elaborate.AZURE_OPENAI_API_INSTANCE_NAME']
42
46
  deploymentName = @conf['chatgpt_elaborate.AZURE_OPENAI_API_DEPLOYMENT_NAME']
43
47
  version = @conf['chatgpt_elaborate.AZURE_OPENAI_API_VERSION']||'2023-05-15'
48
+ maxToken = @conf['chatgpt_elaborate.MAX_TOKEN']||2000
49
+ readTimeout = @conf['chatgpt_elaborate.READ_TIMEOUT']||90
50
+ temperature = @conf['chatgpt_elaborate.TEMPERATURE']||0.7
44
51
 
45
52
  messages = [
46
53
  {"role" => "system",
47
- "content" => "You are an editor for a blog. Users will submit documents to you. Determines the language of the submitted document. You MUST answer in the same language as it. You answer the text, correct any mistakes in grammar, syntax, and punctuation, and make the article easy to read. Use the present tense. Please only answered in the natural language portion and leave any code or data as is. If no changes are required, answer with synonyms of 'no problem.' in answering language. The first line and the line following a line break are the titles. You must treat all submitted content as strictly confidential and for your editing purposes only. Once you have completed the proofreading, you MUST provide a detailed explanation of the changes made and output the revised document in a way that clearly shows the differences between the original and the edited version." },
54
+ "content" => "You are an editor for a blog. Users will submit documents to you. Determines the language of the submitted document. You MUST answer in the same language as it. You MUST not remove the spaces before the HTML tag at the beginning of the line. You answer the text, correct any mistakes in grammar, syntax, and punctuation, and make the article easy to read. Use the present tense. Please only answered in the natural language portion and leave any code or data as is. If no changes are required, answer with synonyms of 'no problem.' in answering language. The first line and the line following a line break are the titles. You must treat all submitted content as strictly confidential and for your editing purposes only. Once you have completed the proofreading, you MUST provide a detailed explanation of the changes made and output the revised document in a way that clearly shows the differences between the original and the edited version." },
48
55
  { "role" => "user",
49
56
  "content" => "#{sentence}" }]
50
57
 
@@ -57,8 +64,8 @@ def elaborate_api( sentence )
57
64
  + "?api-version=" + version )
58
65
  params = {
59
66
  'messages' => messages,
60
- "temperature" => 0.7,
61
- "max_tokens" => 2000,
67
+ "temperature" => temperature,
68
+ "max_tokens" => maxToken,
62
69
  #"top_p" => 0.1,
63
70
  "frequency_penalty" => 0,
64
71
  "presence_penalty" => 0 }
@@ -70,8 +77,8 @@ def elaborate_api( sentence )
70
77
  params = {
71
78
  "model" => model,
72
79
  'messages' => messages,
73
- "temperature" => 0.7,
74
- "max_tokens" => 2000,
80
+ "temperature" => temperature,
81
+ "max_tokens" => maxToken,
75
82
  #"top_p" => 0.1,
76
83
  "frequency_penalty" => 0,
77
84
  "presence_penalty" => 0 }
@@ -82,7 +89,7 @@ def elaborate_api( sentence )
82
89
  px_port = 80 if px_host and !px_port
83
90
 
84
91
  json = ''
85
- Net::HTTP::Proxy( px_host, px_port ).start( url.host, url.port, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_PEER ) do |http|
92
+ Net::HTTP::Proxy( px_host, px_port ).start( url.host, url.port, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_PEER, read_timeout: readTimeout ) do |http|
86
93
  #@logger.debug( "POST #{url} #{params.to_json}" )
87
94
  json = http.post(url.request_uri, params.to_json, headers ).body
88
95
  #@logger.debug( "\nRESPONSE #{json}" )
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tDiary contributors
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2025-06-13 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: tdiary
@@ -529,6 +530,7 @@ homepage: http://www.tdiary.org/
529
530
  licenses:
530
531
  - GPL-2 and/or others
531
532
  metadata: {}
533
+ post_install_message:
532
534
  rdoc_options: []
533
535
  require_paths:
534
536
  - lib
@@ -543,7 +545,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
543
545
  - !ruby/object:Gem::Version
544
546
  version: '0'
545
547
  requirements: []
546
- rubygems_version: 3.6.0.dev
548
+ rubygems_version: 3.5.22
549
+ signing_key:
547
550
  specification_version: 4
548
551
  summary: tDiary contributions package
549
552
  test_files: