tblog_zon 0.0.15 → 0.0.37
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/lib/tblog_zon.rb +539 -427
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf47eedcd16d949cc26c11e1df7774a35d204fe3be1b4dce0fa9552ecb15f573
|
4
|
+
data.tar.gz: d878d55c3c9a52193dd4ed1aab77d21ef04213862783826f1d5afebf79dd35ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e68d89074b522b6a31c8988126d1d8c295df50d6b9e63daac3f4fcdcdcdd4c1f78e4564833d7f18706fcac0c94aa86aca02d9bb976c2013be0c3f2b545c2c91
|
7
|
+
data.tar.gz: 967c9982ee5fc281c395908199f6e69cb579e62b7eab213de0a990669c8af3a6c67cda28aa4abc257c05e211242381d38484bd0a02709620e255c3ba11d1b979
|
data/lib/tblog_zon.rb
CHANGED
@@ -25,93 +25,107 @@ include Glimmer
|
|
25
25
|
|
26
26
|
|
27
27
|
class Chat
|
28
|
-
def initialize(api_key)
|
28
|
+
def initialize(api_key, gpt_keyword_prompt)
|
29
29
|
@api_key = api_key
|
30
|
+
@gpt_keyword_prompt = gpt_keyword_prompt
|
30
31
|
end
|
31
32
|
|
32
|
-
def
|
33
|
-
|
34
|
-
h = {
|
35
|
-
'Content-Type' => 'application/json',
|
36
|
-
'Authorization' => 'Bearer ' + @api_key
|
37
|
-
}
|
38
|
-
d = {
|
39
|
-
#'model' => 'gpt-3.5-turbo',
|
40
|
-
'model' => 'gpt-4',
|
41
|
-
'messages' => [{
|
42
|
-
"role" => "assistant",
|
43
|
-
"content" => keyword.to_s+" 소개하는 글을 1500자에서 2500자 사이로 만들어줘"
|
44
|
-
}]
|
45
|
-
}
|
46
|
-
answer = ''
|
47
|
-
begin
|
48
|
-
req = HTTP.headers(h).post(url, :json => d)
|
49
|
-
print(req.to_s)
|
50
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['content']
|
51
|
-
rescue => e
|
52
|
-
begin
|
53
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['message']
|
54
|
-
rescue
|
33
|
+
def message(keyword)
|
34
|
+
puts 'Sending request to GPT...(키워드 기반 글 생성 중...)'
|
55
35
|
|
36
|
+
# "키워드 기반 글 생성 중..." 메시지 출력 스레드
|
37
|
+
thread = Thread.new do
|
38
|
+
while true
|
39
|
+
print "▶"
|
40
|
+
sleep 3
|
56
41
|
end
|
57
42
|
end
|
58
43
|
|
59
|
-
|
60
|
-
print('api return ==> ')
|
61
|
-
puts(answer)
|
62
|
-
|
63
|
-
return answer
|
64
|
-
end
|
65
|
-
|
66
|
-
def message(keyword)
|
67
|
-
puts 'chat gpt ...'
|
68
44
|
url = 'https://api.openai.com/v1/chat/completions'
|
69
|
-
|
45
|
+
headers = {
|
70
46
|
'Content-Type' => 'application/json',
|
71
47
|
'Authorization' => 'Bearer ' + @api_key
|
72
48
|
}
|
73
|
-
|
74
|
-
|
49
|
+
|
50
|
+
# 사용자로부터 받은 입력과 GPT 프롬프트의 토큰 수 계산
|
51
|
+
message_tokens = calculate_tokens(keyword) + calculate_tokens(@gpt_keyword_prompt)
|
52
|
+
|
53
|
+
# 8,192 토큰을 초과하지 않도록 최대 토큰 수를 설정
|
54
|
+
max_response_tokens = [8192 - message_tokens, 4000].min # 8,192 - 입력된 토큰 수, 4,000 이하로 설정
|
55
|
+
|
56
|
+
# 요청 데이터 설정
|
57
|
+
data = {
|
75
58
|
'model' => 'gpt-4',
|
76
|
-
'messages' => [
|
77
|
-
|
78
|
-
|
79
|
-
|
59
|
+
'messages' => [
|
60
|
+
{
|
61
|
+
"role" => "assistant",
|
62
|
+
"content" => "#{keyword}\n#{@gpt_keyword_prompt}"
|
63
|
+
}
|
64
|
+
],
|
65
|
+
'max_tokens' => max_response_tokens # 최대 응답 토큰 설정
|
80
66
|
}
|
67
|
+
|
68
|
+
|
69
|
+
|
81
70
|
answer = ''
|
82
71
|
begin
|
83
|
-
req = HTTP.headers(
|
84
|
-
print(req.to_s)
|
85
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['content']
|
86
|
-
rescue => e
|
87
|
-
begin
|
88
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['message']
|
89
|
-
rescue
|
72
|
+
req = HTTP.headers(headers).post(url, :json => data)
|
90
73
|
|
74
|
+
# 상태 코드 확인
|
75
|
+
if req.status != 200
|
76
|
+
raise "HTTP Error: #{req.status}, Response Body: #{req.body.to_s}"
|
91
77
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
78
|
+
|
79
|
+
# 응답 내용 출력 (디버깅용)
|
80
|
+
response = JSON.parse(req.to_s)
|
81
|
+
|
82
|
+
|
83
|
+
# 응답 데이터에서 안전하게 값 추출
|
84
|
+
if response['choices'] && response['choices'][0] && response['choices'][0]['message']
|
85
|
+
answer = response['choices'][0]['message']['content']
|
86
|
+
else
|
87
|
+
raise "Invalid API response format"
|
98
88
|
end
|
99
|
-
|
89
|
+
rescue => e
|
90
|
+
# 오류 메시지 출력
|
91
|
+
puts "Error occurred: #{e.message}"
|
92
|
+
answer = "오류가 발생했습니다."
|
100
93
|
end
|
101
94
|
|
102
|
-
|
103
|
-
|
95
|
+
# "생성 중..." 메시지 출력 종료
|
96
|
+
thread.kill
|
104
97
|
|
98
|
+
# 결과 로그 출력
|
99
|
+
puts "Final API response ==> #{answer}"
|
105
100
|
return answer
|
106
101
|
end
|
102
|
+
|
103
|
+
def calculate_tokens(text)
|
104
|
+
# 간단한 방식으로 텍스트의 토큰 수 계산 (정확도는 다를 수 있음)
|
105
|
+
# OpenAI API는 1토큰이 대략 4글자 정도임
|
106
|
+
text.split(/\s+/).length # 간단한 단어 수로 계산
|
107
|
+
end
|
107
108
|
end
|
108
109
|
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
109
114
|
class Chat_title
|
110
|
-
def initialize(api_key)
|
115
|
+
def initialize(api_key, gpt_title_prompt)
|
111
116
|
@api_key = api_key
|
117
|
+
@gpt_title_prompt = gpt_title_prompt
|
112
118
|
end
|
113
119
|
|
114
120
|
def message(title)
|
121
|
+
puts 'Sending request to GPT...(제목 생성 중...)'
|
122
|
+
# "키워드 기반 글 생성 중..." 메시지를 별도 스레드로 처리
|
123
|
+
thread = Thread.new do
|
124
|
+
while true
|
125
|
+
print "▶"
|
126
|
+
sleep(3)
|
127
|
+
end
|
128
|
+
end
|
115
129
|
url = 'https://api.openai.com/v1/chat/completions'
|
116
130
|
headers = {
|
117
131
|
'Content-Type' => 'application/json',
|
@@ -125,15 +139,15 @@ class Chat_title
|
|
125
139
|
},
|
126
140
|
{
|
127
141
|
"role" => "user",
|
128
|
-
"content" => "#{
|
142
|
+
"content" => "#{@gpt_title_prompt}\n#{title}"
|
129
143
|
}]
|
130
144
|
}
|
131
145
|
|
132
146
|
begin
|
133
147
|
req = HTTP.headers(headers).post(url, json: data)
|
134
|
-
|
148
|
+
|
135
149
|
response = JSON.parse(req.body.to_s)
|
136
|
-
|
150
|
+
|
137
151
|
|
138
152
|
if req.status == 429
|
139
153
|
return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
|
@@ -141,11 +155,18 @@ class Chat_title
|
|
141
155
|
|
142
156
|
# 응답 데이터에서 안전하게 값 추출
|
143
157
|
answer = response.dig('choices', 0, 'message', 'content')
|
144
|
-
|
158
|
+
|
159
|
+
# 따옴표 제거
|
160
|
+
answer = answer.gsub('"', '') if answer
|
161
|
+
|
162
|
+
answer ||= title # 응답이 없을 경우 기본 메시지 설정
|
145
163
|
rescue => e
|
146
164
|
puts "Error: #{e.message}"
|
147
165
|
answer = "오류가 발생했습니다."
|
148
166
|
end
|
167
|
+
|
168
|
+
# "생성 중..." 메시지 출력 종료
|
169
|
+
thread.kill
|
149
170
|
|
150
171
|
puts 'API return ==> '
|
151
172
|
puts answer
|
@@ -153,12 +174,23 @@ class Chat_title
|
|
153
174
|
end
|
154
175
|
end
|
155
176
|
|
177
|
+
|
156
178
|
class Chat_content
|
157
|
-
def initialize(api_key)
|
179
|
+
def initialize(api_key, gpt_content_prompt)
|
158
180
|
@api_key = api_key
|
181
|
+
@gpt_content_prompt = gpt_content_prompt
|
159
182
|
end
|
160
183
|
|
161
184
|
def message(content)
|
185
|
+
puts '주의:GPT 특성상 원고 길이가 공백 포함 4천자를 넘기면 오류가 발생할 수 있습니다.'
|
186
|
+
puts 'Sending request to GPT...(내용 변형 중...)'
|
187
|
+
# "키워드 기반 글 생성 중..." 메시지를 별도 스레드로 처리
|
188
|
+
thread = Thread.new do
|
189
|
+
while true
|
190
|
+
print "▶"
|
191
|
+
sleep(3)
|
192
|
+
end
|
193
|
+
end
|
162
194
|
|
163
195
|
url = 'https://api.openai.com/v1/chat/completions'
|
164
196
|
headers = {
|
@@ -173,15 +205,16 @@ class Chat_content
|
|
173
205
|
},
|
174
206
|
{
|
175
207
|
"role" => "user",
|
176
|
-
"content" => "#{content}
|
208
|
+
"content" => "#{@gpt_content_prompt}\n#{content}"
|
209
|
+
|
177
210
|
}]
|
178
211
|
}
|
179
212
|
|
180
213
|
begin
|
181
214
|
req = HTTP.headers(headers).post(url, json: data)
|
182
|
-
|
215
|
+
|
183
216
|
response = JSON.parse(req.body.to_s)
|
184
|
-
|
217
|
+
|
185
218
|
|
186
219
|
if req.status == 429
|
187
220
|
return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
|
@@ -195,6 +228,9 @@ class Chat_content
|
|
195
228
|
answer = "오류가 발생했습니다."
|
196
229
|
end
|
197
230
|
|
231
|
+
# "생성 중..." 메시지 출력 종료
|
232
|
+
thread.kill
|
233
|
+
|
198
234
|
puts 'API return ==> '
|
199
235
|
puts answer
|
200
236
|
answer
|
@@ -202,6 +238,7 @@ class Chat_content
|
|
202
238
|
end
|
203
239
|
|
204
240
|
|
241
|
+
|
205
242
|
#############################################gpt############################################
|
206
243
|
|
207
244
|
class Naver
|
@@ -211,69 +248,79 @@ class Naver
|
|
211
248
|
end
|
212
249
|
|
213
250
|
def chrome_start(proxy)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
251
|
+
# 공통 옵션 설정
|
252
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
253
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
254
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
255
|
+
options.add_extension('./crx/app.crx') # 확장 프로그램을 첫 번째 탭에 추가
|
256
|
+
options.add_argument('--disable-blink-features=AutomationControlled')
|
257
|
+
options.add_argument('--disable-popup-blocking')
|
258
|
+
options.add_argument('--dns-prefetch-disable')
|
259
|
+
options.add_argument('--disable-dev-shm-usage')
|
260
|
+
options.add_argument('--disable-software-rasterizer')
|
261
|
+
options.add_argument('--ignore-certificate-errors')
|
262
|
+
options.add_argument('--disable-gpu') # GPU 가속 끄기
|
263
|
+
options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36') # user-agent 위조
|
264
|
+
options.add_argument('--disable-web-security')
|
265
|
+
options.add_argument('--allow-running-insecure-content')
|
266
|
+
options.add_argument('--allow-insecure-localhost')
|
267
|
+
options.add_argument('--no-sandbox')
|
268
|
+
options.add_argument('--disable-translate')
|
269
|
+
options.add_argument('--disable-extensions-file-access-check')
|
270
|
+
options.add_argument('--disable-impl-side-painting')
|
271
|
+
|
272
|
+
# 자동화된 테스트 제거
|
273
|
+
options.exclude_switches = ['enable-automation']
|
234
274
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
242
|
-
options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
|
275
|
+
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
276
|
+
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
277
|
+
#options.add_preference("profile.managed_default_content_settings.cookies", 2) # 쿠키 관련 팝업 차단
|
278
|
+
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
279
|
+
options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
|
280
|
+
|
243
281
|
|
282
|
+
# Proxy 설정
|
283
|
+
if proxy != ''
|
284
|
+
options.add_argument('--proxy-server=' + proxy.to_s.force_encoding('utf-8'))
|
285
|
+
end
|
286
|
+
|
287
|
+
# 브라우저 실행
|
288
|
+
begin
|
289
|
+
# 'capabilities'과 'options' 배열로 설정
|
290
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
291
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
244
292
|
|
245
|
-
|
246
|
-
|
247
|
-
options.add_argument('--proxy-server=' + proxy.to_s.force_encoding('utf-8'))
|
248
|
-
end
|
293
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
294
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
249
295
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
296
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
297
|
+
|
298
|
+
sleep(1)
|
299
|
+
# 두 번째 탭에서 로그인 페이지 열기
|
300
|
+
@driver.get('https://www.tistory.com/auth/login')
|
301
|
+
sleep(1)
|
302
|
+
|
303
|
+
rescue => e
|
304
|
+
|
305
|
+
puts "Error: #{e.message}"
|
306
|
+
puts 'Using default Chrome driver without proxy'
|
307
|
+
# 'capabilities'과 'options' 배열로 설정
|
308
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
309
|
+
capabilities["goog:chromeOptions"] = options.as_json
|
262
310
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
311
|
+
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
312
|
+
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
313
|
+
|
314
|
+
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
315
|
+
|
316
|
+
# 첫 번째 탭에서 확장 프로그램을 로드
|
317
|
+
#@driver.get("chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html")
|
318
|
+
sleep(1)
|
319
|
+
# 두 번째 탭에서 로그인 페이지 열기
|
320
|
+
@driver.get('https://www.tistory.com/auth/login')
|
321
|
+
sleep(1)
|
322
|
+
end
|
275
323
|
end
|
276
|
-
end
|
277
324
|
|
278
325
|
def login(user_id, user_pw, proxy, captcha_api_key)
|
279
326
|
chrome_start(proxy)
|
@@ -1880,7 +1927,15 @@ class Wordpress
|
|
1880
1927
|
end
|
1881
1928
|
|
1882
1929
|
if @data['포스트설정']['gpt제목'].checked?
|
1883
|
-
|
1930
|
+
gpt_title_prompt = @data['포스트설정']['gpt제목_프롬프트'].text.to_s.force_encoding('utf-8')
|
1931
|
+
|
1932
|
+
# 공백을 포함한 빈 문자열을 체크하기 위해 strip을 사용
|
1933
|
+
gpt_title_prompt_sample = gpt_title_prompt.strip.empty? ? "프롬프트: 문장을 비슷한 길이로 ChatGPT의 멘트는 빼고 표현을 더 추가해서 하나만 만들어줘." : gpt_title_prompt
|
1934
|
+
|
1935
|
+
# gpt_title_prompt_sample을 Chat_title 객체에 전달
|
1936
|
+
chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_title_prompt_sample)
|
1937
|
+
|
1938
|
+
# 메시지 요청 후 title에 저장
|
1884
1939
|
gpt_text1 = chat.message(title)
|
1885
1940
|
title = gpt_text1.to_s
|
1886
1941
|
end
|
@@ -1925,18 +1980,16 @@ class Wordpress
|
|
1925
1980
|
end
|
1926
1981
|
|
1927
1982
|
if @data['포스트설정']['gpt내용'].checked?
|
1983
|
+
gpt_content_prompt = @data['포스트설정']['gpt내용_프롬프트'].text.to_s.force_encoding('utf-8')
|
1928
1984
|
api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
|
1929
|
-
#key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
|
1930
|
-
#imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
|
1931
|
-
#template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
|
1932
|
-
#ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
|
1933
|
-
#sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
|
1934
|
-
#mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
|
1935
|
-
#map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
|
1936
|
-
#inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
|
1937
|
-
|
1938
1985
|
|
1939
|
-
|
1986
|
+
# 공백을 포함한 빈 문자열을 체크하기 위해 strip을 사용
|
1987
|
+
gpt_content_prompt_sample = gpt_content_prompt.strip.empty? ? "프롬프트:ChatGPT의 멘트는 빼고 위 전체적인 내용의 형식을 똑같이 표현을 더 추가하고 유사어로 변경하여 하나 만들어줘! 전화번호,연락처,가격,홈페이지안내 ,상담안내 관련 문구는 유지해야해" : gpt_content_prompt
|
1988
|
+
|
1989
|
+
# Chat_content 객체 생성 시 api_key와 gpt_content_prompt_sample을 두 개의 인자로 전달
|
1990
|
+
chat = Chat_content.new(api_key, gpt_content_prompt_sample)
|
1991
|
+
|
1992
|
+
# 메시지 요청 후 content에 저장
|
1940
1993
|
gpt_text3 = chat.message(content)
|
1941
1994
|
content = gpt_text3.to_s
|
1942
1995
|
end
|
@@ -2142,13 +2195,17 @@ class Wordpress
|
|
2142
2195
|
@data['table'] << []
|
2143
2196
|
@data['table'].pop
|
2144
2197
|
if @data['포스트설정']['gpt키워드'].checked?
|
2145
|
-
|
2198
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2199
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2200
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2146
2201
|
gpt_text = chat.message(keyword)
|
2147
|
-
content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2202
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2203
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2148
2204
|
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2149
2205
|
content = auto_text
|
2150
2206
|
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2151
|
-
content = content + "\n(자동생성글)\n" + auto_text
|
2207
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2208
|
+
content = content + "(자동생성글)" + auto_text
|
2152
2209
|
end
|
2153
2210
|
|
2154
2211
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
@@ -2183,7 +2240,8 @@ class Wordpress
|
|
2183
2240
|
end
|
2184
2241
|
|
2185
2242
|
if @data['포스트설정']['내용을자동생성'].checked?
|
2186
|
-
content2 = content.split("\n")
|
2243
|
+
#content2 = content.split("\n")
|
2244
|
+
content2 = content.split
|
2187
2245
|
end
|
2188
2246
|
|
2189
2247
|
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
@@ -3154,162 +3212,170 @@ class Wordpress
|
|
3154
3212
|
}
|
3155
3213
|
}
|
3156
3214
|
tab_item('내용설정'){
|
3215
|
+
horizontal_box{
|
3216
|
+
vertical_box{
|
3157
3217
|
horizontal_box{
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
file_data.split("\n").each do |keyword|
|
3167
|
-
if keyword.split(' ').join('').length < 2
|
3168
|
-
|
3169
|
-
else
|
3170
|
-
@data['키워드설정']['키워드'] << [false, keyword]
|
3171
|
-
@data['키워드설정']['키워드'] << [false, keyword]
|
3172
|
-
@data['키워드설정']['키워드'].pop
|
3173
|
-
end
|
3174
|
-
end
|
3175
|
-
end
|
3176
|
-
|
3177
|
-
}
|
3178
|
-
}
|
3218
|
+
stretchy false
|
3219
|
+
button('키워드불러오기'){
|
3220
|
+
on_clicked{
|
3221
|
+
file = open_file
|
3222
|
+
if file != nil
|
3223
|
+
file_data = File.open(file, 'r', :encoding => 'utf-8').read()
|
3224
|
+
file_data.split("\n").each do |keyword|
|
3225
|
+
if keyword.split(' ').join('').length < 2
|
3179
3226
|
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
grid{
|
3184
|
-
button('전체선택'){
|
3185
|
-
top 1
|
3186
|
-
left 1
|
3187
|
-
on_clicked{
|
3188
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
3189
|
-
@data['키워드설정']['키워드'][n][0] = true
|
3190
|
-
@data['키워드설정']['키워드'] << []
|
3191
|
-
@data['키워드설정']['키워드'].pop
|
3192
|
-
end
|
3193
|
-
}
|
3194
|
-
}
|
3195
|
-
button('선택해제'){
|
3196
|
-
top 1
|
3197
|
-
left 2
|
3198
|
-
on_clicked{
|
3199
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
3200
|
-
@data['키워드설정']['키워드'][n][0] = false
|
3201
|
-
@data['키워드설정']['키워드'] << []
|
3227
|
+
else
|
3228
|
+
@data['키워드설정']['키워드'] << [false, keyword]
|
3229
|
+
@data['키워드설정']['키워드'] << [false, keyword]
|
3202
3230
|
@data['키워드설정']['키워드'].pop
|
3203
3231
|
end
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
top 1
|
3208
|
-
left 3
|
3209
|
-
on_clicked{
|
3210
|
-
m = Array.new
|
3211
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
3212
|
-
if @data['키워드설정']['키워드'][n][0] == true
|
3213
|
-
m << n
|
3214
|
-
end
|
3215
|
-
end
|
3216
|
-
|
3217
|
-
m.reverse.each do |i|
|
3218
|
-
@data['키워드설정']['키워드'].delete_at(i)
|
3219
|
-
end
|
3220
|
-
@data['키워드설정']['키워드'].delete(nil)
|
3221
|
-
}
|
3222
|
-
}
|
3232
|
+
end
|
3233
|
+
end
|
3234
|
+
|
3223
3235
|
}
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
}
|
3240
|
-
}
|
3236
|
+
}
|
3237
|
+
|
3238
|
+
}
|
3239
|
+
horizontal_box{
|
3240
|
+
stretchy false
|
3241
|
+
grid{
|
3242
|
+
button('전체선택'){
|
3243
|
+
top 1
|
3244
|
+
left 1
|
3245
|
+
on_clicked{
|
3246
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
3247
|
+
@data['키워드설정']['키워드'][n][0] = true
|
3248
|
+
@data['키워드설정']['키워드'] << []
|
3249
|
+
@data['키워드설정']['키워드'].pop
|
3250
|
+
end
|
3241
3251
|
}
|
3242
|
-
|
3243
|
-
|
3252
|
+
}
|
3253
|
+
button('선택해제'){
|
3254
|
+
top 1
|
3255
|
+
left 2
|
3256
|
+
on_clicked{
|
3257
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
3258
|
+
@data['키워드설정']['키워드'][n][0] = false
|
3259
|
+
@data['키워드설정']['키워드'] << []
|
3260
|
+
@data['키워드설정']['키워드'].pop
|
3261
|
+
end
|
3244
3262
|
}
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
@data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
|
3255
|
-
@data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
|
3256
|
-
else
|
3257
|
-
@data['포스트설정']['gpt상단'].checked = false # 체크 해제
|
3258
|
-
@data['포스트설정']['gpt상단'].enabled = false # 비활성화
|
3259
|
-
@data['포스트설정']['gpt하단'].checked = false # 체크 해제
|
3260
|
-
@data['포스트설정']['gpt하단'].enabled = false # 비활성화
|
3261
|
-
end
|
3262
|
-
}
|
3263
|
-
|
3264
|
-
}
|
3265
|
-
|
3266
|
-
@data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
|
3267
|
-
top 1
|
3268
|
-
left 1
|
3269
|
-
enabled false # 기본적으로 비활성화
|
3270
|
-
on_toggled{
|
3271
|
-
if @data['포스트설정']['gpt상단'].checked?
|
3272
|
-
@data['포스트설정']['gpt하단'].checked = false
|
3273
|
-
end
|
3274
|
-
}
|
3275
|
-
}
|
3276
|
-
|
3277
|
-
@data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
|
3278
|
-
top 1
|
3279
|
-
left 2
|
3280
|
-
enabled false # 기본적으로 비활성화
|
3281
|
-
on_toggled{
|
3282
|
-
if @data['포스트설정']['gpt하단'].checked?
|
3283
|
-
@data['포스트설정']['gpt상단'].checked = false
|
3263
|
+
}
|
3264
|
+
button('삭제하기'){
|
3265
|
+
top 1
|
3266
|
+
left 3
|
3267
|
+
on_clicked{
|
3268
|
+
m = Array.new
|
3269
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
3270
|
+
if @data['키워드설정']['키워드'][n][0] == true
|
3271
|
+
m << n
|
3284
3272
|
end
|
3285
|
-
|
3286
|
-
}
|
3287
|
-
} }
|
3288
|
-
horizontal_box{
|
3289
|
-
stretchy false
|
3290
|
-
grid{
|
3291
|
-
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
3292
|
-
} } }
|
3293
|
-
|
3294
|
-
table{
|
3295
|
-
checkbox_column('선택'){
|
3296
|
-
editable true
|
3297
|
-
}
|
3298
|
-
text_column('키워드'){
|
3299
|
-
|
3300
|
-
}
|
3273
|
+
end
|
3301
3274
|
|
3302
|
-
|
3275
|
+
m.reverse.each do |i|
|
3276
|
+
@data['키워드설정']['키워드'].delete_at(i)
|
3277
|
+
end
|
3278
|
+
@data['키워드설정']['키워드'].delete(nil)
|
3303
3279
|
}
|
3304
|
-
|
3305
3280
|
}
|
3306
|
-
|
3281
|
+
}
|
3282
|
+
|
3283
|
+
@data['키워드설정']['순서사용'] = checkbox('순서사용'){
|
3307
3284
|
stretchy false
|
3285
|
+
on_toggled{ |c|
|
3286
|
+
if c.checked?
|
3287
|
+
@data['키워드설정']['랜덤사용'].checked = false
|
3288
|
+
end
|
3289
|
+
}
|
3308
3290
|
}
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3312
|
-
|
3291
|
+
@data['키워드설정']['랜덤사용'] = checkbox('랜덤사용'){
|
3292
|
+
stretchy false
|
3293
|
+
on_toggled{ |c|
|
3294
|
+
if c.checked?
|
3295
|
+
@data['키워드설정']['순서사용'].checked = false
|
3296
|
+
end
|
3297
|
+
}
|
3298
|
+
}
|
3299
|
+
}
|
3300
|
+
vertical_separator{
|
3301
|
+
stretchy false
|
3302
|
+
}
|
3303
|
+
horizontal_box{
|
3304
|
+
stretchy false
|
3305
|
+
grid{
|
3306
|
+
@data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
|
3307
|
+
top 1
|
3308
|
+
left 0
|
3309
|
+
#enabled false # 기본적으로 비활성화
|
3310
|
+
on_toggled {
|
3311
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
3312
|
+
@data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
|
3313
|
+
@data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
|
3314
|
+
else
|
3315
|
+
@data['포스트설정']['gpt상단'].checked = false # 체크 해제
|
3316
|
+
@data['포스트설정']['gpt상단'].enabled = false # 비활성화
|
3317
|
+
@data['포스트설정']['gpt하단'].checked = false # 체크 해제
|
3318
|
+
@data['포스트설정']['gpt하단'].enabled = false # 비활성화
|
3319
|
+
end
|
3320
|
+
}
|
3321
|
+
|
3322
|
+
}
|
3323
|
+
|
3324
|
+
@data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
|
3325
|
+
top 1
|
3326
|
+
left 1
|
3327
|
+
enabled false # 기본적으로 비활성화
|
3328
|
+
on_toggled{
|
3329
|
+
if @data['포스트설정']['gpt상단'].checked?
|
3330
|
+
@data['포스트설정']['gpt하단'].checked = false
|
3331
|
+
end
|
3332
|
+
}
|
3333
|
+
}
|
3334
|
+
|
3335
|
+
@data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
|
3336
|
+
top 1
|
3337
|
+
left 2
|
3338
|
+
enabled false # 기본적으로 비활성화
|
3339
|
+
on_toggled{
|
3340
|
+
if @data['포스트설정']['gpt하단'].checked?
|
3341
|
+
@data['포스트설정']['gpt상단'].checked = false
|
3342
|
+
end
|
3343
|
+
}
|
3344
|
+
}
|
3345
|
+
} }
|
3346
|
+
horizontal_box{
|
3347
|
+
stretchy false
|
3348
|
+
@data['포스트설정']['gpt키워드_프롬프트'] = entry(){
|
3349
|
+
text '프롬프트:관련 글을 1500자에서 2500자 사이로 만들어줘'
|
3350
|
+
}}
|
3351
|
+
horizontal_box{
|
3352
|
+
stretchy false
|
3353
|
+
grid{
|
3354
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
3355
|
+
} } }
|
3356
|
+
|
3357
|
+
|
3358
|
+
table{
|
3359
|
+
checkbox_column('선택'){
|
3360
|
+
editable true
|
3361
|
+
}
|
3362
|
+
text_column('키워드'){
|
3363
|
+
|
3364
|
+
}
|
3365
|
+
|
3366
|
+
cell_rows @data['키워드설정']['키워드']
|
3367
|
+
}
|
3368
|
+
|
3369
|
+
|
3370
|
+
|
3371
|
+
}
|
3372
|
+
vertical_separator{
|
3373
|
+
stretchy false
|
3374
|
+
}
|
3375
|
+
vertical_box{
|
3376
|
+
horizontal_box{
|
3377
|
+
stretchy false
|
3378
|
+
button('제목불러오기'){
|
3313
3379
|
on_clicked{
|
3314
3380
|
file = open_file
|
3315
3381
|
if file != nil
|
@@ -3398,158 +3464,187 @@ class Wordpress
|
|
3398
3464
|
|
3399
3465
|
|
3400
3466
|
}}}
|
3467
|
+
horizontal_box{
|
3468
|
+
stretchy false
|
3469
|
+
@data['포스트설정']['gpt제목_프롬프트'] = entry(){
|
3470
|
+
text '프롬프트:비슷한 길이로 제목으로 사용할수있게 하나만 만들어줘'
|
3471
|
+
}}
|
3401
3472
|
horizontal_box{
|
3402
3473
|
stretchy false
|
3403
3474
|
grid{
|
3404
3475
|
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
3405
3476
|
} } }
|
3406
|
-
|
3407
|
-
checkbox_column('선택'){
|
3408
|
-
editable true
|
3409
|
-
}
|
3410
|
-
text_column('제목'){
|
3477
|
+
|
3411
3478
|
|
3412
|
-
|
3479
|
+
table{
|
3480
|
+
checkbox_column('선택'){
|
3481
|
+
editable true
|
3482
|
+
}
|
3483
|
+
text_column('제목'){
|
3413
3484
|
|
3414
|
-
|
3415
|
-
}
|
3485
|
+
}
|
3416
3486
|
|
3487
|
+
cell_rows @data['제목설정']['제목']
|
3488
|
+
}
|
3489
|
+
|
3490
|
+
|
3491
|
+
}
|
3492
|
+
vertical_separator{
|
3493
|
+
stretchy false
|
3494
|
+
}
|
3495
|
+
vertical_box{
|
3496
|
+
horizontal_box{
|
3497
|
+
stretchy false
|
3498
|
+
button('내용불러오기'){
|
3499
|
+
on_clicked{
|
3500
|
+
file = open_file
|
3501
|
+
if file != nil
|
3502
|
+
file_name = file.split("\\")[-1]
|
3503
|
+
file_data = File.open(file,'r', :encoding => 'utf-8').read()
|
3504
|
+
if file_data.split("\n").length < 2
|
3505
|
+
file_data = file_data + "\n"
|
3506
|
+
end
|
3507
|
+
@data['내용설정']['내용'] << [false, file_name, file_data]
|
3508
|
+
@data['내용설정']['내용'] << [false, file_name, file_data]
|
3509
|
+
@data['내용설정']['내용'].pop
|
3510
|
+
end
|
3511
|
+
}
|
3417
3512
|
}
|
3418
|
-
|
3419
|
-
|
3513
|
+
|
3514
|
+
}
|
3515
|
+
horizontal_box{
|
3516
|
+
stretchy false
|
3517
|
+
grid{
|
3518
|
+
button('전체선택'){
|
3519
|
+
top 1
|
3520
|
+
left 1
|
3521
|
+
on_clicked{
|
3522
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
3523
|
+
@data['내용설정']['내용'][n][0] = true
|
3524
|
+
@data['내용설정']['내용'] << []
|
3525
|
+
@data['내용설정']['내용'].pop
|
3526
|
+
end
|
3527
|
+
}
|
3420
3528
|
}
|
3421
|
-
|
3422
|
-
|
3423
|
-
|
3424
|
-
|
3425
|
-
|
3426
|
-
|
3427
|
-
|
3428
|
-
|
3429
|
-
|
3430
|
-
if file_data.split("\n").length < 2
|
3431
|
-
file_data = file_data + "\n"
|
3432
|
-
end
|
3433
|
-
@data['내용설정']['내용'] << [false, file_name, file_data]
|
3434
|
-
@data['내용설정']['내용'] << [false, file_name, file_data]
|
3435
|
-
@data['내용설정']['내용'].pop
|
3436
|
-
end
|
3437
|
-
}
|
3438
|
-
}
|
3439
|
-
|
3529
|
+
button('선택해제'){
|
3530
|
+
top 1
|
3531
|
+
left 2
|
3532
|
+
on_clicked{
|
3533
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
3534
|
+
@data['내용설정']['내용'][n][0] = false
|
3535
|
+
@data['내용설정']['내용'] << []
|
3536
|
+
@data['내용설정']['내용'].pop
|
3537
|
+
end
|
3440
3538
|
}
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3457
|
-
left 2
|
3458
|
-
on_clicked{
|
3459
|
-
for n in 0..@data['내용설정']['내용'].length-1
|
3460
|
-
@data['내용설정']['내용'][n][0] = false
|
3461
|
-
@data['내용설정']['내용'] << []
|
3462
|
-
@data['내용설정']['내용'].pop
|
3463
|
-
end
|
3464
|
-
}
|
3465
|
-
}
|
3466
|
-
button('삭제하기'){
|
3467
|
-
top 1
|
3468
|
-
left 3
|
3469
|
-
on_clicked{
|
3470
|
-
m = Array.new
|
3471
|
-
for n in 0..@data['내용설정']['내용'].length-1
|
3472
|
-
if @data['내용설정']['내용'][n][0] == true
|
3473
|
-
m << n
|
3474
|
-
end
|
3475
|
-
end
|
3476
|
-
|
3477
|
-
m.reverse.each do |i|
|
3478
|
-
@data['내용설정']['내용'].delete_at(i)
|
3479
|
-
end
|
3480
|
-
@data['내용설정']['내용'].delete(nil)
|
3481
|
-
}
|
3482
|
-
}
|
3539
|
+
}
|
3540
|
+
button('삭제하기'){
|
3541
|
+
top 1
|
3542
|
+
left 3
|
3543
|
+
on_clicked{
|
3544
|
+
m = Array.new
|
3545
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
3546
|
+
if @data['내용설정']['내용'][n][0] == true
|
3547
|
+
m << n
|
3548
|
+
end
|
3549
|
+
end
|
3550
|
+
|
3551
|
+
m.reverse.each do |i|
|
3552
|
+
@data['내용설정']['내용'].delete_at(i)
|
3553
|
+
end
|
3554
|
+
@data['내용설정']['내용'].delete(nil)
|
3483
3555
|
}
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3491
|
-
|
3492
|
-
@data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
|
3493
|
-
stretchy false
|
3494
|
-
on_toggled{ |c|
|
3495
|
-
if c.checked?
|
3496
|
-
@data['내용설정']['순서사용'].checked = false
|
3497
|
-
end
|
3498
|
-
}
|
3499
|
-
}
|
3556
|
+
}
|
3557
|
+
}
|
3558
|
+
@data['내용설정']['순서사용'] = checkbox('순서사용'){
|
3559
|
+
stretchy false
|
3560
|
+
on_toggled{ |c|
|
3561
|
+
if c.checked?
|
3562
|
+
@data['내용설정']['랜덤사용'].checked = false
|
3563
|
+
end
|
3500
3564
|
}
|
3501
|
-
|
3502
|
-
|
3565
|
+
}
|
3566
|
+
@data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
|
3567
|
+
stretchy false
|
3568
|
+
on_toggled{ |c|
|
3569
|
+
if c.checked?
|
3570
|
+
@data['내용설정']['순서사용'].checked = false
|
3571
|
+
end
|
3503
3572
|
}
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3507
|
-
|
3508
|
-
|
3509
|
-
|
3510
|
-
|
3511
|
-
|
3512
|
-
|
3513
|
-
|
3514
|
-
|
3515
|
-
}
|
3516
|
-
|
3517
|
-
|
3518
|
-
|
3519
|
-
|
3520
|
-
|
3573
|
+
}
|
3574
|
+
}
|
3575
|
+
vertical_separator{
|
3576
|
+
stretchy false
|
3577
|
+
}
|
3578
|
+
horizontal_box{
|
3579
|
+
stretchy false
|
3580
|
+
grid{
|
3581
|
+
@data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
|
3582
|
+
|
3583
|
+
|
3584
|
+
}}}
|
3585
|
+
horizontal_box{
|
3586
|
+
stretchy false
|
3587
|
+
@data['포스트설정']['gpt내용_프롬프트'] = entry(){
|
3588
|
+
text '프롬프트:동의어,유사어를 이용해 변경해줘'
|
3589
|
+
}}
|
3590
|
+
horizontal_box{
|
3591
|
+
stretchy false
|
3592
|
+
grid{
|
3593
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
3594
|
+
} } }
|
3595
|
+
|
3596
|
+
table{
|
3597
|
+
checkbox_column('선택'){
|
3598
|
+
editable true
|
3599
|
+
}
|
3600
|
+
text_column('내용파일'){
|
3521
3601
|
|
3522
|
-
|
3602
|
+
}
|
3523
3603
|
|
3524
|
-
|
3525
|
-
|
3604
|
+
cell_rows @data['내용설정']['내용']
|
3605
|
+
}
|
3526
3606
|
|
3527
|
-
|
3528
|
-
|
3529
|
-
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
button('폴더째로불러오기'){
|
3534
|
-
stretchy false
|
3535
|
-
on_clicked{
|
3536
|
-
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8').force_encoding('utf-8')
|
3537
|
-
Dir.entries(@data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')).each do |file|
|
3538
|
-
if file == '.' or file == '..'
|
3607
|
+
horizontal_box{
|
3608
|
+
stretchy false
|
3609
|
+
@data['이미지설정']['폴더경로2'] = entry{
|
3610
|
+
stretchy false
|
3611
|
+
text "내용폴더경로 ex)C:\\내용\\폴더1"
|
3612
|
+
}
|
3539
3613
|
|
3540
|
-
|
3541
|
-
|
3614
|
+
button('폴더째로 불러오기') {
|
3615
|
+
on_clicked {
|
3616
|
+
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
|
3617
|
+
|
3618
|
+
# 경로가 유효한지 확인
|
3619
|
+
if Dir.exist?(path)
|
3620
|
+
Dir.entries(path).each do |file|
|
3621
|
+
if file == '.' or file == '..'
|
3622
|
+
next
|
3623
|
+
else
|
3624
|
+
begin
|
3625
|
+
# 파일을 열고 내용을 읽어서 추가
|
3626
|
+
file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
|
3542
3627
|
@data['내용설정']['내용'] << [false, file, file_data]
|
3628
|
+
rescue => e
|
3629
|
+
# 파일을 열 수 없는 경우, 오류 메시지 출력
|
3630
|
+
puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
|
3543
3631
|
end
|
3544
3632
|
end
|
3545
|
-
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3633
|
+
end
|
3634
|
+
|
3635
|
+
# 내용 배열에서 마지막 빈 항목 제거
|
3636
|
+
@data['내용설정']['내용'] << []
|
3637
|
+
@data['내용설정']['내용'].pop
|
3638
|
+
else
|
3639
|
+
# 경로가 유효하지 않을 경우, 오류 메시지 출력
|
3640
|
+
puts "경로가 존재하지 않습니다: #{path}"
|
3641
|
+
end
|
3549
3642
|
}
|
3550
3643
|
}
|
3551
3644
|
}
|
3552
3645
|
}
|
3646
|
+
}
|
3647
|
+
}
|
3553
3648
|
tab_item('이미지설정'){
|
3554
3649
|
horizontal_box{
|
3555
3650
|
vertical_box{
|
@@ -4011,36 +4106,53 @@ class Wordpress
|
|
4011
4106
|
left 1
|
4012
4107
|
text 'URL'
|
4013
4108
|
}
|
4014
|
-
@data['포스트설정']['내용을자동생성'] = checkbox('키워드기반
|
4109
|
+
@data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 글만 등록(GPT사용시 체크 해제)'){
|
4015
4110
|
top 9
|
4016
4111
|
left 0
|
4017
|
-
on_toggled
|
4018
|
-
|
4019
|
-
|
4020
|
-
|
4021
|
-
|
4022
|
-
|
4023
|
-
|
4112
|
+
on_toggled{
|
4113
|
+
if @data['포스트설정']['내용을자동생성'].checked?
|
4114
|
+
@data['포스트설정']['내용과자동생성'].checked = false
|
4115
|
+
@data['포스트설정']['내용투명'].checked = false
|
4116
|
+
@data['포스트설정']['내용투명'].enabled = false # 비활성화
|
4117
|
+
|
4118
|
+
end
|
4024
4119
|
}
|
4025
4120
|
}
|
4026
|
-
|
4027
|
-
|
4121
|
+
label('※GPT사용시 내용설정 탭에서 설정'){
|
4122
|
+
top 9
|
4123
|
+
left 1
|
4124
|
+
}
|
4125
|
+
|
4126
|
+
label('※GPT 미 사용시 세팅 권장'){
|
4127
|
+
top 9
|
4128
|
+
left 3
|
4129
|
+
}
|
4130
|
+
|
4131
|
+
|
4028
4132
|
aa1 = 2
|
4029
|
-
@data['포스트설정']['내용과자동생성'] = checkbox('
|
4133
|
+
@data['포스트설정']['내용과자동생성'] = checkbox('원고+키워드기반 글 등록(GPT사용시 체크 해제)') {
|
4030
4134
|
top 10 + aa1
|
4031
4135
|
left 0
|
4032
4136
|
on_toggled {
|
4033
|
-
|
4034
|
-
|
4035
|
-
|
4036
|
-
|
4037
|
-
|
4038
|
-
|
4039
|
-
|
4040
|
-
|
4041
|
-
|
4137
|
+
if @data['포스트설정']['내용과자동생성'].checked?
|
4138
|
+
@data['포스트설정']['내용을자동생성'].checked = false
|
4139
|
+
@data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
|
4140
|
+
|
4141
|
+
else
|
4142
|
+
@data['포스트설정']['내용투명'].checked = false # 체크 해제
|
4143
|
+
@data['포스트설정']['내용투명'].enabled = false # 비활성화
|
4144
|
+
|
4145
|
+
end
|
4042
4146
|
}
|
4043
4147
|
}
|
4148
|
+
label('※GPT사용시 내용설정 탭에서 설정'){
|
4149
|
+
top 10 + aa1
|
4150
|
+
left 1
|
4151
|
+
}
|
4152
|
+
label('※GPT 미 사용시 세팅 권장'){
|
4153
|
+
top 10 + aa1
|
4154
|
+
left 3
|
4155
|
+
}
|
4044
4156
|
|
4045
4157
|
@data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
|
4046
4158
|
top 11 + aa1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tblog_zon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|