cafe_buy 0.0.55 → 0.0.57
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/cafe_buy.rb +543 -469
- 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: 381969199d49ad9fdc27921fa8cf16027f7173db072ac9622e84b4c312cffe71
|
4
|
+
data.tar.gz: bc3114813a589c7876a9ca1279ec9e66d868b97ac8eb96ff52faf4b3f1716904
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e7c7a49e820937784657d9114e74b9df5926ec703a71ffef00773a5bf2e6c8b3b62e6205de08b5d6ec4c31f44e160f96c11d8aa3d197dee25a0a1e8ec8ddb75
|
7
|
+
data.tar.gz: 7e054fc36de52e5de85f95911917bfeb53799d0a41e1557aaa3f144f57b2a19ee316ec2461d11d0deec4943f23ccbc37d99cbf17d8e538773a3ec0f5a53a1f83
|
data/lib/cafe_buy.rb
CHANGED
@@ -22,97 +22,107 @@ using Rainbow
|
|
22
22
|
include Glimmer
|
23
23
|
|
24
24
|
class Chat
|
25
|
-
|
26
|
-
def initialize(api_key)
|
25
|
+
def initialize(api_key, gpt_keyword_prompt)
|
27
26
|
@api_key = api_key
|
27
|
+
@gpt_keyword_prompt = gpt_keyword_prompt
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
puts'
|
32
|
-
url = 'https://api.openai.com/v1/chat/completions'
|
33
|
-
h = {
|
34
|
-
'Content-Type' => 'application/json',
|
35
|
-
'Authorization' => 'Bearer ' + @api_key
|
36
|
-
}
|
37
|
-
d = {
|
38
|
-
#'model' => 'gpt-3.5-turbo',
|
39
|
-
'model' => 'gpt-4',
|
40
|
-
'messages' => [{
|
41
|
-
"role" => "assistant",
|
42
|
-
"content" => keyword.to_s+" 소개하는 글을 1500자에서 2500자 사이로 만들어줘"
|
43
|
-
}]
|
44
|
-
}
|
45
|
-
answer = ''
|
46
|
-
begin
|
47
|
-
req = HTTP.headers(h).post(url, :json => d)
|
48
|
-
print(req.to_s)
|
49
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['content']
|
50
|
-
rescue => e
|
51
|
-
begin
|
52
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['message']
|
53
|
-
rescue
|
30
|
+
def message(keyword)
|
31
|
+
puts 'Sending request to GPT...(키워드 기반 글 생성 중...)'
|
54
32
|
|
33
|
+
# "키워드 기반 글 생성 중..." 메시지 출력 스레드
|
34
|
+
thread = Thread.new do
|
35
|
+
while true
|
36
|
+
print "▶"
|
37
|
+
sleep 3
|
55
38
|
end
|
56
39
|
end
|
57
40
|
|
58
|
-
|
59
|
-
print('api return ==> ')
|
60
|
-
puts(answer)
|
61
|
-
|
62
|
-
return answer
|
63
|
-
end
|
64
|
-
|
65
|
-
def message(keyword)
|
66
|
-
puts 'chat gpt ...'
|
67
41
|
url = 'https://api.openai.com/v1/chat/completions'
|
68
|
-
|
42
|
+
headers = {
|
69
43
|
'Content-Type' => 'application/json',
|
70
44
|
'Authorization' => 'Bearer ' + @api_key
|
71
45
|
}
|
72
|
-
|
73
|
-
|
46
|
+
|
47
|
+
# 사용자로부터 받은 입력과 GPT 프롬프트의 토큰 수 계산
|
48
|
+
message_tokens = calculate_tokens(keyword) + calculate_tokens(@gpt_keyword_prompt)
|
49
|
+
|
50
|
+
# 8,192 토큰을 초과하지 않도록 최대 토큰 수를 설정
|
51
|
+
max_response_tokens = [8192 - message_tokens, 4000].min # 8,192 - 입력된 토큰 수, 4,000 이하로 설정
|
52
|
+
|
53
|
+
# 요청 데이터 설정
|
54
|
+
data = {
|
74
55
|
'model' => 'gpt-4',
|
75
|
-
'messages' => [
|
76
|
-
|
77
|
-
|
78
|
-
|
56
|
+
'messages' => [
|
57
|
+
{
|
58
|
+
"role" => "assistant",
|
59
|
+
"content" => "#{keyword}\n#{@gpt_keyword_prompt}"
|
60
|
+
}
|
61
|
+
],
|
62
|
+
'max_tokens' => max_response_tokens # 최대 응답 토큰 설정
|
79
63
|
}
|
64
|
+
|
65
|
+
|
66
|
+
|
80
67
|
answer = ''
|
81
68
|
begin
|
82
|
-
req = HTTP.headers(
|
83
|
-
print(req.to_s)
|
84
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['content']
|
85
|
-
rescue => e
|
86
|
-
begin
|
87
|
-
answer = JSON.parse(req.to_s)['choices'][0]['message']['message']
|
88
|
-
rescue
|
69
|
+
req = HTTP.headers(headers).post(url, :json => data)
|
89
70
|
|
71
|
+
# 상태 코드 확인
|
72
|
+
if req.status != 200
|
73
|
+
raise "HTTP Error: #{req.status}, Response Body: #{req.body.to_s}"
|
90
74
|
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
75
|
+
|
76
|
+
# 응답 내용 출력 (디버깅용)
|
77
|
+
response = JSON.parse(req.to_s)
|
78
|
+
|
79
|
+
|
80
|
+
# 응답 데이터에서 안전하게 값 추출
|
81
|
+
if response['choices'] && response['choices'][0] && response['choices'][0]['message']
|
82
|
+
answer = response['choices'][0]['message']['content']
|
83
|
+
else
|
84
|
+
raise "Invalid API response format"
|
97
85
|
end
|
98
|
-
|
86
|
+
rescue => e
|
87
|
+
# 오류 메시지 출력
|
88
|
+
puts "Error occurred: #{e.message}"
|
89
|
+
answer = "오류가 발생했습니다."
|
99
90
|
end
|
100
91
|
|
101
|
-
|
102
|
-
|
92
|
+
# "생성 중..." 메시지 출력 종료
|
93
|
+
thread.kill
|
103
94
|
|
95
|
+
# 결과 로그 출력
|
96
|
+
puts "Final API response ==> #{answer}"
|
104
97
|
return answer
|
105
98
|
end
|
99
|
+
|
100
|
+
def calculate_tokens(text)
|
101
|
+
# 간단한 방식으로 텍스트의 토큰 수 계산 (정확도는 다를 수 있음)
|
102
|
+
# OpenAI API는 1토큰이 대략 4글자 정도임
|
103
|
+
text.split(/\s+/).length # 간단한 단어 수로 계산
|
104
|
+
end
|
106
105
|
end
|
107
106
|
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
108
111
|
class Chat_title
|
109
|
-
|
110
|
-
def initialize(api_key)
|
112
|
+
def initialize(api_key, gpt_title_prompt)
|
111
113
|
@api_key = api_key
|
114
|
+
@gpt_title_prompt = gpt_title_prompt
|
112
115
|
end
|
113
116
|
|
114
117
|
def message(title)
|
115
|
-
puts'
|
118
|
+
puts 'Sending request to GPT...(제목 생성 중...)'
|
119
|
+
# "키워드 기반 글 생성 중..." 메시지를 별도 스레드로 처리
|
120
|
+
thread = Thread.new do
|
121
|
+
while true
|
122
|
+
print "▶"
|
123
|
+
sleep(3)
|
124
|
+
end
|
125
|
+
end
|
116
126
|
url = 'https://api.openai.com/v1/chat/completions'
|
117
127
|
headers = {
|
118
128
|
'Content-Type' => 'application/json',
|
@@ -126,15 +136,15 @@ class Chat_title
|
|
126
136
|
},
|
127
137
|
{
|
128
138
|
"role" => "user",
|
129
|
-
"content" => "#{
|
139
|
+
"content" => "#{@gpt_title_prompt}\n#{title}"
|
130
140
|
}]
|
131
141
|
}
|
132
142
|
|
133
143
|
begin
|
134
144
|
req = HTTP.headers(headers).post(url, json: data)
|
135
|
-
|
145
|
+
|
136
146
|
response = JSON.parse(req.body.to_s)
|
137
|
-
|
147
|
+
|
138
148
|
|
139
149
|
if req.status == 429
|
140
150
|
return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
|
@@ -142,11 +152,18 @@ class Chat_title
|
|
142
152
|
|
143
153
|
# 응답 데이터에서 안전하게 값 추출
|
144
154
|
answer = response.dig('choices', 0, 'message', 'content')
|
145
|
-
|
155
|
+
|
156
|
+
# 따옴표 제거
|
157
|
+
answer = answer.gsub('"', '') if answer
|
158
|
+
|
159
|
+
answer ||= title # 응답이 없을 경우 기본 메시지 설정
|
146
160
|
rescue => e
|
147
161
|
puts "Error: #{e.message}"
|
148
162
|
answer = "오류가 발생했습니다."
|
149
163
|
end
|
164
|
+
|
165
|
+
# "생성 중..." 메시지 출력 종료
|
166
|
+
thread.kill
|
150
167
|
|
151
168
|
puts 'API return ==> '
|
152
169
|
puts answer
|
@@ -154,14 +171,24 @@ class Chat_title
|
|
154
171
|
end
|
155
172
|
end
|
156
173
|
|
174
|
+
|
157
175
|
class Chat_content
|
158
|
-
|
159
|
-
def initialize(api_key)
|
176
|
+
def initialize(api_key, gpt_content_prompt)
|
160
177
|
@api_key = api_key
|
178
|
+
@gpt_content_prompt = gpt_content_prompt
|
161
179
|
end
|
162
180
|
|
163
181
|
def message(content)
|
164
|
-
puts'
|
182
|
+
puts '주의:GPT 특성상 원고 길이가 공백 포함 4천자를 넘기면 오류가 발생할 수 있습니다.'
|
183
|
+
puts 'Sending request to GPT...(내용 변형 중...)'
|
184
|
+
# "키워드 기반 글 생성 중..." 메시지를 별도 스레드로 처리
|
185
|
+
thread = Thread.new do
|
186
|
+
while true
|
187
|
+
print "▶"
|
188
|
+
sleep(3)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
165
192
|
url = 'https://api.openai.com/v1/chat/completions'
|
166
193
|
headers = {
|
167
194
|
'Content-Type' => 'application/json',
|
@@ -175,15 +202,16 @@ class Chat_content
|
|
175
202
|
},
|
176
203
|
{
|
177
204
|
"role" => "user",
|
178
|
-
"content" => "#{content}
|
205
|
+
"content" => "#{@gpt_content_prompt}\n#{content}"
|
206
|
+
|
179
207
|
}]
|
180
208
|
}
|
181
209
|
|
182
210
|
begin
|
183
211
|
req = HTTP.headers(headers).post(url, json: data)
|
184
|
-
|
212
|
+
|
185
213
|
response = JSON.parse(req.body.to_s)
|
186
|
-
|
214
|
+
|
187
215
|
|
188
216
|
if req.status == 429
|
189
217
|
return "API 요청 제한을 초과했습니다. 플랜 및 할당량을 확인하세요."
|
@@ -197,6 +225,9 @@ class Chat_content
|
|
197
225
|
answer = "오류가 발생했습니다."
|
198
226
|
end
|
199
227
|
|
228
|
+
# "생성 중..." 메시지 출력 종료
|
229
|
+
thread.kill
|
230
|
+
|
200
231
|
puts 'API return ==> '
|
201
232
|
puts answer
|
202
233
|
answer
|
@@ -204,6 +235,7 @@ class Chat_content
|
|
204
235
|
end
|
205
236
|
|
206
237
|
|
238
|
+
|
207
239
|
#############################################gpt############################################
|
208
240
|
|
209
241
|
class Naver
|
@@ -2540,7 +2572,15 @@ class Wordpress
|
|
2540
2572
|
end
|
2541
2573
|
|
2542
2574
|
if @data['포스트설정']['gpt제목'].checked?
|
2543
|
-
|
2575
|
+
gpt_title_prompt = @data['포스트설정']['gpt제목_프롬프트'].text.to_s.force_encoding('utf-8')
|
2576
|
+
|
2577
|
+
# 공백을 포함한 빈 문자열을 체크하기 위해 strip을 사용
|
2578
|
+
gpt_title_prompt_sample = gpt_title_prompt.strip.empty? ? "프롬프트: 문장을 비슷한 길이로 ChatGPT의 멘트는 빼고 표현을 더 추가해서 하나만 만들어줘." : gpt_title_prompt
|
2579
|
+
|
2580
|
+
# gpt_title_prompt_sample을 Chat_title 객체에 전달
|
2581
|
+
chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_title_prompt_sample)
|
2582
|
+
|
2583
|
+
# 메시지 요청 후 title에 저장
|
2544
2584
|
gpt_text1 = chat.message(title)
|
2545
2585
|
title = gpt_text1.to_s
|
2546
2586
|
end
|
@@ -2585,18 +2625,16 @@ class Wordpress
|
|
2585
2625
|
|
2586
2626
|
|
2587
2627
|
if @data['포스트설정']['gpt내용'].checked?
|
2628
|
+
gpt_content_prompt = @data['포스트설정']['gpt내용_프롬프트'].text.to_s.force_encoding('utf-8')
|
2588
2629
|
api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
|
2589
|
-
#key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
|
2590
|
-
#imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
|
2591
|
-
#template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
|
2592
|
-
#ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
|
2593
|
-
#sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
|
2594
|
-
#mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
|
2595
|
-
#map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
|
2596
|
-
#inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
|
2597
|
-
|
2598
2630
|
|
2599
|
-
|
2631
|
+
# 공백을 포함한 빈 문자열을 체크하기 위해 strip을 사용
|
2632
|
+
gpt_content_prompt_sample = gpt_content_prompt.strip.empty? ? "프롬프트:ChatGPT의 멘트는 빼고 위 전체적인 내용의 형식을 똑같이 표현을 더 추가하고 유사어로 변경하여 하나 만들어줘! 전화번호,연락처,가격,홈페이지안내 ,상담안내 관련 문구는 유지해야해" : gpt_content_prompt
|
2633
|
+
|
2634
|
+
# Chat_content 객체 생성 시 api_key와 gpt_content_prompt_sample을 두 개의 인자로 전달
|
2635
|
+
chat = Chat_content.new(api_key, gpt_content_prompt_sample)
|
2636
|
+
|
2637
|
+
# 메시지 요청 후 content에 저장
|
2600
2638
|
gpt_text3 = chat.message(content)
|
2601
2639
|
content = gpt_text3.to_s
|
2602
2640
|
end
|
@@ -2800,13 +2838,17 @@ class Wordpress
|
|
2800
2838
|
@data['table'] << []
|
2801
2839
|
@data['table'].pop
|
2802
2840
|
if @data['포스트설정']['gpt키워드'].checked?
|
2803
|
-
|
2841
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2842
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2843
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2804
2844
|
gpt_text = chat.message(keyword)
|
2805
|
-
content = content + "\n(자동생성글)\n" + gpt_text
|
2845
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2846
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2806
2847
|
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2807
2848
|
content = auto_text
|
2808
2849
|
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2809
|
-
content = content + "\n(자동생성글)\n" + auto_text
|
2850
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2851
|
+
content = content + "(자동생성글)" + auto_text
|
2810
2852
|
end
|
2811
2853
|
|
2812
2854
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
@@ -2841,7 +2883,8 @@ class Wordpress
|
|
2841
2883
|
end
|
2842
2884
|
|
2843
2885
|
if @data['포스트설정']['내용을자동생성'].checked?
|
2844
|
-
content2 = content.split("\n")
|
2886
|
+
#content2 = content.split("\n")
|
2887
|
+
content2 = content.split
|
2845
2888
|
end
|
2846
2889
|
|
2847
2890
|
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
@@ -3964,423 +4007,439 @@ class Wordpress
|
|
3964
4007
|
}
|
3965
4008
|
}
|
3966
4009
|
tab_item('내용설정'){
|
4010
|
+
horizontal_box{
|
4011
|
+
vertical_box{
|
3967
4012
|
horizontal_box{
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3971
|
-
|
3972
|
-
|
3973
|
-
|
3974
|
-
|
3975
|
-
|
3976
|
-
file_data.split("\n").each do |keyword|
|
3977
|
-
if keyword.split(' ').join('').length < 2
|
4013
|
+
stretchy false
|
4014
|
+
button('키워드불러오기'){
|
4015
|
+
on_clicked{
|
4016
|
+
file = open_file
|
4017
|
+
if file != nil
|
4018
|
+
file_data = File.open(file, 'r', :encoding => 'utf-8').read()
|
4019
|
+
file_data.split("\n").each do |keyword|
|
4020
|
+
if keyword.split(' ').join('').length < 2
|
3978
4021
|
|
3979
|
-
|
3980
|
-
|
3981
|
-
|
3982
|
-
@data['키워드설정']['키워드'].pop
|
3983
|
-
end
|
3984
|
-
end
|
3985
|
-
end
|
3986
|
-
|
3987
|
-
}
|
3988
|
-
}
|
3989
|
-
|
3990
|
-
}
|
3991
|
-
horizontal_box{
|
3992
|
-
stretchy false
|
3993
|
-
grid{
|
3994
|
-
button('전체선택'){
|
3995
|
-
top 1
|
3996
|
-
left 1
|
3997
|
-
on_clicked{
|
3998
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
3999
|
-
@data['키워드설정']['키워드'][n][0] = true
|
4000
|
-
@data['키워드설정']['키워드'] << []
|
4001
|
-
@data['키워드설정']['키워드'].pop
|
4002
|
-
end
|
4003
|
-
}
|
4004
|
-
}
|
4005
|
-
button('선택해제'){
|
4006
|
-
top 1
|
4007
|
-
left 2
|
4008
|
-
on_clicked{
|
4009
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
4010
|
-
@data['키워드설정']['키워드'][n][0] = false
|
4011
|
-
@data['키워드설정']['키워드'] << []
|
4022
|
+
else
|
4023
|
+
@data['키워드설정']['키워드'] << [false, keyword]
|
4024
|
+
@data['키워드설정']['키워드'] << [false, keyword]
|
4012
4025
|
@data['키워드설정']['키워드'].pop
|
4013
4026
|
end
|
4014
|
-
|
4015
|
-
|
4016
|
-
button('삭제하기'){
|
4017
|
-
top 1
|
4018
|
-
left 3
|
4019
|
-
on_clicked{
|
4020
|
-
m = Array.new
|
4021
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
4022
|
-
if @data['키워드설정']['키워드'][n][0] == true
|
4023
|
-
m << n
|
4024
|
-
end
|
4025
|
-
end
|
4027
|
+
end
|
4028
|
+
end
|
4026
4029
|
|
4027
|
-
m.reverse.each do |i|
|
4028
|
-
@data['키워드설정']['키워드'].delete_at(i)
|
4029
|
-
end
|
4030
|
-
@data['키워드설정']['키워드'].delete(nil)
|
4031
|
-
}
|
4032
|
-
}
|
4033
4030
|
}
|
4034
|
-
|
4035
|
-
|
4036
|
-
|
4037
|
-
|
4038
|
-
|
4039
|
-
|
4040
|
-
|
4041
|
-
|
4042
|
-
|
4043
|
-
|
4044
|
-
|
4045
|
-
|
4046
|
-
|
4047
|
-
|
4048
|
-
|
4049
|
-
}
|
4050
|
-
}
|
4031
|
+
}
|
4032
|
+
|
4033
|
+
}
|
4034
|
+
horizontal_box{
|
4035
|
+
stretchy false
|
4036
|
+
grid{
|
4037
|
+
button('전체선택'){
|
4038
|
+
top 1
|
4039
|
+
left 1
|
4040
|
+
on_clicked{
|
4041
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
4042
|
+
@data['키워드설정']['키워드'][n][0] = true
|
4043
|
+
@data['키워드설정']['키워드'] << []
|
4044
|
+
@data['키워드설정']['키워드'].pop
|
4045
|
+
end
|
4051
4046
|
}
|
4052
|
-
|
4053
|
-
|
4047
|
+
}
|
4048
|
+
button('선택해제'){
|
4049
|
+
top 1
|
4050
|
+
left 2
|
4051
|
+
on_clicked{
|
4052
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
4053
|
+
@data['키워드설정']['키워드'][n][0] = false
|
4054
|
+
@data['키워드설정']['키워드'] << []
|
4055
|
+
@data['키워드설정']['키워드'].pop
|
4056
|
+
end
|
4054
4057
|
}
|
4055
|
-
|
4056
|
-
|
4057
|
-
|
4058
|
-
|
4059
|
-
|
4060
|
-
|
4061
|
-
|
4062
|
-
|
4063
|
-
|
4064
|
-
@data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
|
4065
|
-
@data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
|
4066
|
-
else
|
4067
|
-
@data['포스트설정']['gpt상단'].checked = false # 체크 해제
|
4068
|
-
@data['포스트설정']['gpt상단'].enabled = false # 비활성화
|
4069
|
-
@data['포스트설정']['gpt하단'].checked = false # 체크 해제
|
4070
|
-
@data['포스트설정']['gpt하단'].enabled = false # 비활성화
|
4071
|
-
end
|
4072
|
-
}
|
4073
|
-
|
4074
|
-
}
|
4075
|
-
|
4076
|
-
@data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
|
4077
|
-
top 1
|
4078
|
-
left 1
|
4079
|
-
enabled false # 기본적으로 비활성화
|
4080
|
-
on_toggled{
|
4081
|
-
if @data['포스트설정']['gpt상단'].checked?
|
4082
|
-
@data['포스트설정']['gpt하단'].checked = false
|
4083
|
-
end
|
4084
|
-
}
|
4085
|
-
}
|
4086
|
-
|
4087
|
-
@data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
|
4088
|
-
top 1
|
4089
|
-
left 2
|
4090
|
-
enabled false # 기본적으로 비활성화
|
4091
|
-
on_toggled{
|
4092
|
-
if @data['포스트설정']['gpt하단'].checked?
|
4093
|
-
@data['포스트설정']['gpt상단'].checked = false
|
4058
|
+
}
|
4059
|
+
button('삭제하기'){
|
4060
|
+
top 1
|
4061
|
+
left 3
|
4062
|
+
on_clicked{
|
4063
|
+
m = Array.new
|
4064
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
4065
|
+
if @data['키워드설정']['키워드'][n][0] == true
|
4066
|
+
m << n
|
4094
4067
|
end
|
4095
|
-
|
4096
|
-
}
|
4097
|
-
} }
|
4098
|
-
horizontal_box{
|
4099
|
-
stretchy false
|
4100
|
-
grid{
|
4101
|
-
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4102
|
-
} } }
|
4103
|
-
|
4104
|
-
|
4105
|
-
table{
|
4106
|
-
checkbox_column('선택'){
|
4107
|
-
editable true
|
4108
|
-
}
|
4109
|
-
text_column('키워드'){
|
4110
|
-
|
4111
|
-
}
|
4068
|
+
end
|
4112
4069
|
|
4113
|
-
|
4070
|
+
m.reverse.each do |i|
|
4071
|
+
@data['키워드설정']['키워드'].delete_at(i)
|
4072
|
+
end
|
4073
|
+
@data['키워드설정']['키워드'].delete(nil)
|
4114
4074
|
}
|
4115
|
-
|
4116
|
-
|
4117
|
-
|
4118
4075
|
}
|
4119
|
-
|
4076
|
+
}
|
4077
|
+
|
4078
|
+
@data['키워드설정']['순서사용'] = checkbox('순서사용'){
|
4120
4079
|
stretchy false
|
4080
|
+
on_toggled{ |c|
|
4081
|
+
if c.checked?
|
4082
|
+
@data['키워드설정']['랜덤사용'].checked = false
|
4083
|
+
end
|
4084
|
+
}
|
4085
|
+
}
|
4086
|
+
@data['키워드설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4087
|
+
stretchy false
|
4088
|
+
on_toggled{ |c|
|
4089
|
+
if c.checked?
|
4090
|
+
@data['키워드설정']['순서사용'].checked = false
|
4091
|
+
end
|
4092
|
+
}
|
4093
|
+
}
|
4094
|
+
}
|
4095
|
+
vertical_separator{
|
4096
|
+
stretchy false
|
4097
|
+
}
|
4098
|
+
horizontal_box{
|
4099
|
+
stretchy false
|
4100
|
+
grid{
|
4101
|
+
@data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
|
4102
|
+
top 1
|
4103
|
+
left 0
|
4104
|
+
#enabled false # 기본적으로 비활성화
|
4105
|
+
on_toggled {
|
4106
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
4107
|
+
@data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
|
4108
|
+
@data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
|
4109
|
+
else
|
4110
|
+
@data['포스트설정']['gpt상단'].checked = false # 체크 해제
|
4111
|
+
@data['포스트설정']['gpt상단'].enabled = false # 비활성화
|
4112
|
+
@data['포스트설정']['gpt하단'].checked = false # 체크 해제
|
4113
|
+
@data['포스트설정']['gpt하단'].enabled = false # 비활성화
|
4114
|
+
end
|
4115
|
+
}
|
4116
|
+
|
4117
|
+
}
|
4118
|
+
|
4119
|
+
@data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
|
4120
|
+
top 1
|
4121
|
+
left 1
|
4122
|
+
enabled false # 기본적으로 비활성화
|
4123
|
+
on_toggled{
|
4124
|
+
if @data['포스트설정']['gpt상단'].checked?
|
4125
|
+
@data['포스트설정']['gpt하단'].checked = false
|
4126
|
+
end
|
4127
|
+
}
|
4121
4128
|
}
|
4122
|
-
vertical_box{
|
4123
|
-
horizontal_box{
|
4124
|
-
stretchy false
|
4125
|
-
button('제목불러오기'){
|
4126
|
-
on_clicked{
|
4127
|
-
file = open_file
|
4128
|
-
if file != nil
|
4129
|
-
file_data = File.open(file, 'r', :encoding => 'utf-8').read()
|
4130
|
-
file_data.split("\n").each do |title|
|
4131
|
-
if title.split(" ").join('').length < 2
|
4132
|
-
|
4133
|
-
else
|
4134
|
-
@data['제목설정']['제목'] << [false, title]
|
4135
|
-
@data['제목설정']['제목'] << [false, title]
|
4136
|
-
@data['제목설정']['제목'].pop
|
4137
|
-
end
|
4138
|
-
end
|
4139
|
-
end
|
4140
|
-
}
|
4141
|
-
}
|
4142
4129
|
|
4130
|
+
@data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
|
4131
|
+
top 1
|
4132
|
+
left 2
|
4133
|
+
enabled false # 기본적으로 비활성화
|
4134
|
+
on_toggled{
|
4135
|
+
if @data['포스트설정']['gpt하단'].checked?
|
4136
|
+
@data['포스트설정']['gpt상단'].checked = false
|
4137
|
+
end
|
4143
4138
|
}
|
4144
|
-
|
4145
|
-
|
4146
|
-
|
4147
|
-
|
4148
|
-
|
4149
|
-
|
4150
|
-
|
4151
|
-
|
4152
|
-
|
4153
|
-
|
4154
|
-
|
4155
|
-
|
4156
|
-
|
4157
|
-
|
4158
|
-
|
4159
|
-
|
4160
|
-
|
4161
|
-
|
4162
|
-
|
4163
|
-
|
4164
|
-
|
4139
|
+
}
|
4140
|
+
} }
|
4141
|
+
horizontal_box{
|
4142
|
+
stretchy false
|
4143
|
+
@data['포스트설정']['gpt키워드_프롬프트'] = entry(){
|
4144
|
+
text '프롬프트:관련 글을 1500자에서 2500자 사이로 만들어줘'
|
4145
|
+
}}
|
4146
|
+
horizontal_box{
|
4147
|
+
stretchy false
|
4148
|
+
grid{
|
4149
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4150
|
+
} } }
|
4151
|
+
|
4152
|
+
|
4153
|
+
table{
|
4154
|
+
checkbox_column('선택'){
|
4155
|
+
editable true
|
4156
|
+
}
|
4157
|
+
text_column('키워드'){
|
4158
|
+
|
4159
|
+
}
|
4160
|
+
|
4161
|
+
cell_rows @data['키워드설정']['키워드']
|
4162
|
+
}
|
4163
|
+
|
4164
|
+
|
4165
|
+
|
4166
|
+
}
|
4167
|
+
vertical_separator{
|
4168
|
+
stretchy false
|
4169
|
+
}
|
4170
|
+
vertical_box{
|
4171
|
+
horizontal_box{
|
4172
|
+
stretchy false
|
4173
|
+
button('제목불러오기'){
|
4174
|
+
on_clicked{
|
4175
|
+
file = open_file
|
4176
|
+
if file != nil
|
4177
|
+
file_data = File.open(file, 'r', :encoding => 'utf-8').read()
|
4178
|
+
file_data.split("\n").each do |title|
|
4179
|
+
if title.split(" ").join('').length < 2
|
4180
|
+
|
4181
|
+
else
|
4182
|
+
@data['제목설정']['제목'] << [false, title]
|
4183
|
+
@data['제목설정']['제목'] << [false, title]
|
4165
4184
|
@data['제목설정']['제목'].pop
|
4166
4185
|
end
|
4167
|
-
|
4168
|
-
|
4169
|
-
|
4170
|
-
|
4171
|
-
left 3
|
4172
|
-
on_clicked{
|
4173
|
-
m = Array.new
|
4174
|
-
for n in 0..@data['제목설정']['제목'].length-1
|
4175
|
-
if @data['제목설정']['제목'][n][0] == true
|
4176
|
-
m << n
|
4177
|
-
end
|
4178
|
-
end
|
4186
|
+
end
|
4187
|
+
end
|
4188
|
+
}
|
4189
|
+
}
|
4179
4190
|
|
4180
|
-
|
4181
|
-
|
4182
|
-
|
4183
|
-
|
4184
|
-
|
4185
|
-
|
4191
|
+
}
|
4192
|
+
horizontal_box{
|
4193
|
+
stretchy false
|
4194
|
+
grid{
|
4195
|
+
button('전체선택'){
|
4196
|
+
top 1
|
4197
|
+
left 1
|
4198
|
+
on_clicked{
|
4199
|
+
for n in 0..@data['제목설정']['제목'].length-1
|
4200
|
+
@data['제목설정']['제목'][n][0] = true
|
4201
|
+
@data['제목설정']['제목'] << []
|
4202
|
+
@data['제목설정']['제목'].pop
|
4203
|
+
end
|
4186
4204
|
}
|
4187
|
-
|
4188
|
-
|
4189
|
-
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
|
-
|
4194
|
-
|
4195
|
-
|
4196
|
-
|
4197
|
-
on_toggled{ |c|
|
4198
|
-
if c.checked?
|
4199
|
-
@data['제목설정']['순서사용'].checked = false
|
4200
|
-
end
|
4201
|
-
}
|
4202
|
-
}
|
4205
|
+
}
|
4206
|
+
button('선택해제'){
|
4207
|
+
top 1
|
4208
|
+
left 2
|
4209
|
+
on_clicked{
|
4210
|
+
for n in 0..@data['제목설정']['제목'].length-1
|
4211
|
+
@data['제목설정']['제목'][n][0] = false
|
4212
|
+
@data['제목설정']['제목'] << []
|
4213
|
+
@data['제목설정']['제목'].pop
|
4214
|
+
end
|
4203
4215
|
}
|
4204
|
-
|
4205
|
-
|
4216
|
+
}
|
4217
|
+
button('삭제하기'){
|
4218
|
+
top 1
|
4219
|
+
left 3
|
4220
|
+
on_clicked{
|
4221
|
+
m = Array.new
|
4222
|
+
for n in 0..@data['제목설정']['제목'].length-1
|
4223
|
+
if @data['제목설정']['제목'][n][0] == true
|
4224
|
+
m << n
|
4225
|
+
end
|
4226
|
+
end
|
4227
|
+
|
4228
|
+
m.reverse.each do |i|
|
4229
|
+
@data['제목설정']['제목'].delete_at(i)
|
4230
|
+
end
|
4231
|
+
@data['제목설정']['제목'].delete(nil)
|
4206
4232
|
}
|
4207
|
-
|
4208
|
-
|
4209
|
-
|
4210
|
-
|
4211
|
-
|
4212
|
-
|
4213
|
-
|
4214
|
-
|
4215
|
-
|
4216
|
-
|
4217
|
-
|
4218
|
-
|
4219
|
-
|
4233
|
+
}
|
4234
|
+
}
|
4235
|
+
@data['제목설정']['순서사용'] = checkbox('순서사용'){
|
4236
|
+
stretchy false
|
4237
|
+
on_toggled{ |c|
|
4238
|
+
if c.checked?
|
4239
|
+
@data['제목설정']['랜덤사용'].checked = false
|
4240
|
+
end
|
4241
|
+
}
|
4242
|
+
}
|
4243
|
+
@data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4244
|
+
stretchy false
|
4245
|
+
on_toggled{ |c|
|
4246
|
+
if c.checked?
|
4247
|
+
@data['제목설정']['순서사용'].checked = false
|
4248
|
+
end
|
4249
|
+
}
|
4250
|
+
}
|
4251
|
+
}
|
4252
|
+
vertical_separator{
|
4253
|
+
stretchy false
|
4254
|
+
}
|
4255
|
+
horizontal_box{
|
4256
|
+
stretchy false
|
4257
|
+
grid{
|
4258
|
+
@data['포스트설정']['gpt제목'] = checkbox('제목을 이용해 GPT로 비슷한 제목 생성'){
|
4259
|
+
|
4260
|
+
|
4261
|
+
}}}
|
4262
|
+
horizontal_box{
|
4263
|
+
stretchy false
|
4264
|
+
@data['포스트설정']['gpt제목_프롬프트'] = entry(){
|
4265
|
+
text '프롬프트:비슷한 길이로 제목으로 사용할수있게 하나만 만들어줘'
|
4266
|
+
}}
|
4267
|
+
horizontal_box{
|
4268
|
+
stretchy false
|
4269
|
+
grid{
|
4270
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4271
|
+
} } }
|
4272
|
+
|
4220
4273
|
|
4221
|
-
|
4222
|
-
|
4223
|
-
|
4224
|
-
|
4225
|
-
|
4274
|
+
table{
|
4275
|
+
checkbox_column('선택'){
|
4276
|
+
editable true
|
4277
|
+
}
|
4278
|
+
text_column('제목'){
|
4226
4279
|
|
4227
|
-
|
4280
|
+
}
|
4228
4281
|
|
4229
|
-
|
4230
|
-
|
4231
|
-
|
4282
|
+
cell_rows @data['제목설정']['제목']
|
4283
|
+
}
|
4284
|
+
|
4232
4285
|
|
4286
|
+
}
|
4287
|
+
vertical_separator{
|
4288
|
+
stretchy false
|
4289
|
+
}
|
4290
|
+
vertical_box{
|
4291
|
+
horizontal_box{
|
4292
|
+
stretchy false
|
4293
|
+
button('내용불러오기'){
|
4294
|
+
on_clicked{
|
4295
|
+
file = open_file
|
4296
|
+
if file != nil
|
4297
|
+
file_name = file.split("\\")[-1]
|
4298
|
+
file_data = File.open(file,'r', :encoding => 'utf-8').read()
|
4299
|
+
if file_data.split("\n").length < 2
|
4300
|
+
file_data = file_data + "\n"
|
4301
|
+
end
|
4302
|
+
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4303
|
+
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4304
|
+
@data['내용설정']['내용'].pop
|
4305
|
+
end
|
4306
|
+
}
|
4233
4307
|
}
|
4234
|
-
vertical_separator{
|
4235
|
-
stretchy false
|
4236
|
-
}
|
4237
|
-
vertical_box{
|
4238
|
-
horizontal_box{
|
4239
|
-
stretchy false
|
4240
|
-
button('내용불러오기'){
|
4241
|
-
on_clicked{
|
4242
|
-
file = open_file
|
4243
|
-
if file != nil
|
4244
|
-
file_name = file.split("\\")[-1]
|
4245
|
-
file_data = File.open(file,'r', :encoding => 'utf-8').read()
|
4246
|
-
if file_data.split("\n").length < 2
|
4247
|
-
file_data = file_data + "\n"
|
4248
|
-
end
|
4249
|
-
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4250
|
-
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4251
|
-
@data['내용설정']['내용'].pop
|
4252
|
-
end
|
4253
|
-
}
|
4254
|
-
}
|
4255
4308
|
|
4309
|
+
}
|
4310
|
+
horizontal_box{
|
4311
|
+
stretchy false
|
4312
|
+
grid{
|
4313
|
+
button('전체선택'){
|
4314
|
+
top 1
|
4315
|
+
left 1
|
4316
|
+
on_clicked{
|
4317
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
4318
|
+
@data['내용설정']['내용'][n][0] = true
|
4319
|
+
@data['내용설정']['내용'] << []
|
4320
|
+
@data['내용설정']['내용'].pop
|
4321
|
+
end
|
4256
4322
|
}
|
4257
|
-
|
4258
|
-
|
4259
|
-
|
4260
|
-
|
4261
|
-
|
4262
|
-
|
4263
|
-
|
4264
|
-
|
4265
|
-
|
4266
|
-
|
4267
|
-
|
4268
|
-
|
4269
|
-
|
4270
|
-
|
4271
|
-
|
4272
|
-
|
4273
|
-
|
4274
|
-
|
4275
|
-
|
4276
|
-
|
4277
|
-
|
4278
|
-
|
4279
|
-
end
|
4280
|
-
}
|
4281
|
-
}
|
4282
|
-
button('삭제하기'){
|
4283
|
-
top 1
|
4284
|
-
left 3
|
4285
|
-
on_clicked{
|
4286
|
-
m = Array.new
|
4287
|
-
for n in 0..@data['내용설정']['내용'].length-1
|
4288
|
-
if @data['내용설정']['내용'][n][0] == true
|
4289
|
-
m << n
|
4290
|
-
end
|
4291
|
-
end
|
4323
|
+
}
|
4324
|
+
button('선택해제'){
|
4325
|
+
top 1
|
4326
|
+
left 2
|
4327
|
+
on_clicked{
|
4328
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
4329
|
+
@data['내용설정']['내용'][n][0] = false
|
4330
|
+
@data['내용설정']['내용'] << []
|
4331
|
+
@data['내용설정']['내용'].pop
|
4332
|
+
end
|
4333
|
+
}
|
4334
|
+
}
|
4335
|
+
button('삭제하기'){
|
4336
|
+
top 1
|
4337
|
+
left 3
|
4338
|
+
on_clicked{
|
4339
|
+
m = Array.new
|
4340
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
4341
|
+
if @data['내용설정']['내용'][n][0] == true
|
4342
|
+
m << n
|
4343
|
+
end
|
4344
|
+
end
|
4292
4345
|
|
4293
|
-
|
4294
|
-
|
4295
|
-
|
4296
|
-
|
4297
|
-
}
|
4298
|
-
}
|
4346
|
+
m.reverse.each do |i|
|
4347
|
+
@data['내용설정']['내용'].delete_at(i)
|
4348
|
+
end
|
4349
|
+
@data['내용설정']['내용'].delete(nil)
|
4299
4350
|
}
|
4300
|
-
|
4301
|
-
|
4302
|
-
|
4303
|
-
|
4304
|
-
|
4305
|
-
|
4306
|
-
|
4307
|
-
|
4308
|
-
@data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4309
|
-
stretchy false
|
4310
|
-
on_toggled{ |c|
|
4311
|
-
if c.checked?
|
4312
|
-
@data['내용설정']['순서사용'].checked = false
|
4313
|
-
end
|
4314
|
-
}
|
4315
|
-
}
|
4351
|
+
}
|
4352
|
+
}
|
4353
|
+
@data['내용설정']['순서사용'] = checkbox('순서사용'){
|
4354
|
+
stretchy false
|
4355
|
+
on_toggled{ |c|
|
4356
|
+
if c.checked?
|
4357
|
+
@data['내용설정']['랜덤사용'].checked = false
|
4358
|
+
end
|
4316
4359
|
}
|
4317
|
-
|
4318
|
-
|
4360
|
+
}
|
4361
|
+
@data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4362
|
+
stretchy false
|
4363
|
+
on_toggled{ |c|
|
4364
|
+
if c.checked?
|
4365
|
+
@data['내용설정']['순서사용'].checked = false
|
4366
|
+
end
|
4319
4367
|
}
|
4320
|
-
|
4321
|
-
|
4322
|
-
|
4323
|
-
|
4324
|
-
|
4325
|
-
|
4326
|
-
|
4327
|
-
|
4328
|
-
|
4329
|
-
|
4330
|
-
|
4331
|
-
}
|
4332
|
-
|
4333
|
-
|
4334
|
-
|
4335
|
-
|
4336
|
-
|
4337
|
-
|
4368
|
+
}
|
4369
|
+
}
|
4370
|
+
vertical_separator{
|
4371
|
+
stretchy false
|
4372
|
+
}
|
4373
|
+
horizontal_box{
|
4374
|
+
stretchy false
|
4375
|
+
grid{
|
4376
|
+
@data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
|
4377
|
+
|
4378
|
+
|
4379
|
+
}}}
|
4380
|
+
horizontal_box{
|
4381
|
+
stretchy false
|
4382
|
+
@data['포스트설정']['gpt내용_프롬프트'] = entry(){
|
4383
|
+
text '프롬프트:동의어,유사어를 이용해 변경해줘'
|
4384
|
+
}}
|
4385
|
+
horizontal_box{
|
4386
|
+
stretchy false
|
4387
|
+
grid{
|
4388
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4389
|
+
} } }
|
4390
|
+
|
4391
|
+
table{
|
4392
|
+
checkbox_column('선택'){
|
4393
|
+
editable true
|
4394
|
+
}
|
4395
|
+
text_column('내용파일'){
|
4338
4396
|
|
4339
|
-
|
4397
|
+
}
|
4340
4398
|
|
4341
|
-
|
4342
|
-
|
4399
|
+
cell_rows @data['내용설정']['내용']
|
4400
|
+
}
|
4343
4401
|
|
4344
|
-
|
4345
|
-
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
4350
|
-
button('폴더째로 불러오기') {
|
4351
|
-
on_clicked {
|
4352
|
-
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
|
4402
|
+
horizontal_box{
|
4403
|
+
stretchy false
|
4404
|
+
@data['이미지설정']['폴더경로2'] = entry{
|
4405
|
+
stretchy false
|
4406
|
+
text "내용폴더경로 ex)C:\\내용\\폴더1"
|
4407
|
+
}
|
4353
4408
|
|
4354
|
-
|
4355
|
-
|
4356
|
-
|
4357
|
-
if file == '.' or file == '..'
|
4358
|
-
next
|
4359
|
-
else
|
4360
|
-
begin
|
4361
|
-
# 파일을 열고 내용을 읽어서 추가
|
4362
|
-
file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
|
4363
|
-
@data['내용설정']['내용'] << [false, file, file_data]
|
4364
|
-
rescue => e
|
4365
|
-
# 파일을 열 수 없는 경우, 오류 메시지 출력
|
4366
|
-
puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
|
4367
|
-
end
|
4368
|
-
end
|
4369
|
-
end
|
4409
|
+
button('폴더째로 불러오기') {
|
4410
|
+
on_clicked {
|
4411
|
+
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
|
4370
4412
|
|
4371
|
-
|
4372
|
-
|
4373
|
-
|
4413
|
+
# 경로가 유효한지 확인
|
4414
|
+
if Dir.exist?(path)
|
4415
|
+
Dir.entries(path).each do |file|
|
4416
|
+
if file == '.' or file == '..'
|
4417
|
+
next
|
4374
4418
|
else
|
4375
|
-
|
4376
|
-
|
4419
|
+
begin
|
4420
|
+
# 파일을 열고 내용을 읽어서 추가
|
4421
|
+
file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
|
4422
|
+
@data['내용설정']['내용'] << [false, file, file_data]
|
4423
|
+
rescue => e
|
4424
|
+
# 파일을 열 수 없는 경우, 오류 메시지 출력
|
4425
|
+
puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
|
4426
|
+
end
|
4377
4427
|
end
|
4378
|
-
|
4379
|
-
|
4428
|
+
end
|
4429
|
+
|
4430
|
+
# 내용 배열에서 마지막 빈 항목 제거
|
4431
|
+
@data['내용설정']['내용'] << []
|
4432
|
+
@data['내용설정']['내용'].pop
|
4433
|
+
else
|
4434
|
+
# 경로가 유효하지 않을 경우, 오류 메시지 출력
|
4435
|
+
puts "경로가 존재하지 않습니다: #{path}"
|
4436
|
+
end
|
4380
4437
|
}
|
4381
4438
|
}
|
4382
4439
|
}
|
4383
4440
|
}
|
4441
|
+
}
|
4442
|
+
}
|
4384
4443
|
tab_item('이미지설정'){
|
4385
4444
|
horizontal_box{
|
4386
4445
|
vertical_box{
|
@@ -4854,7 +4913,7 @@ class Wordpress
|
|
4854
4913
|
left 1
|
4855
4914
|
text 'URL'
|
4856
4915
|
}
|
4857
|
-
@data['포스트설정']['내용을자동생성'] = checkbox('키워드기반
|
4916
|
+
@data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 글만 등록(GPT사용시 체크 해제)'){
|
4858
4917
|
top 9
|
4859
4918
|
left 0
|
4860
4919
|
on_toggled{
|
@@ -4862,31 +4921,46 @@ class Wordpress
|
|
4862
4921
|
@data['포스트설정']['내용과자동생성'].checked = false
|
4863
4922
|
@data['포스트설정']['내용투명'].checked = false
|
4864
4923
|
@data['포스트설정']['자동글 수식에 입력'].checked = false
|
4865
|
-
|
4924
|
+
|
4866
4925
|
end
|
4867
4926
|
}
|
4868
4927
|
}
|
4869
|
-
|
4928
|
+
label('※GPT사용시 내용설정 탭에서 설정'){
|
4929
|
+
top 9
|
4930
|
+
left 1
|
4931
|
+
}
|
4932
|
+
|
4933
|
+
label('※GPT 미 사용시 세팅 권장'){
|
4934
|
+
top 9
|
4935
|
+
left 3
|
4936
|
+
}
|
4870
4937
|
|
4871
|
-
|
4872
|
-
|
4938
|
+
|
4873
4939
|
aa1 = 2
|
4874
|
-
|
4940
|
+
@data['포스트설정']['내용과자동생성'] = checkbox('원고+키워드기반 글 등록(GPT사용시 체크 해제)') {
|
4875
4941
|
top 10 + aa1
|
4876
4942
|
left 0
|
4877
4943
|
on_toggled {
|
4878
|
-
|
4944
|
+
if @data['포스트설정']['내용과자동생성'].checked?
|
4879
4945
|
@data['포스트설정']['내용을자동생성'].checked = false
|
4880
4946
|
@data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
|
4881
4947
|
@data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
|
4882
|
-
|
4948
|
+
else
|
4883
4949
|
@data['포스트설정']['내용투명'].checked = false # 체크 해제
|
4884
4950
|
@data['포스트설정']['내용투명'].enabled = false # 비활성화
|
4885
4951
|
@data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
|
4886
4952
|
@data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
|
4887
|
-
|
4953
|
+
end
|
4888
4954
|
}
|
4889
|
-
|
4955
|
+
}
|
4956
|
+
label('※GPT사용시 내용설정 탭에서 설정'){
|
4957
|
+
top 10 + aa1
|
4958
|
+
left 1
|
4959
|
+
}
|
4960
|
+
label('※GPT 미 사용시 세팅 권장'){
|
4961
|
+
top 10 + aa1
|
4962
|
+
left 3
|
4963
|
+
}
|
4890
4964
|
|
4891
4965
|
@data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
|
4892
4966
|
top 11 + aa1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.57
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
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
|