cafe_buy_duo 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_duo.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: bd76f8603534e26c03452d8701eae5fdb07131051c68c1fcac6ecd3e59afbd6c
|
4
|
+
data.tar.gz: 8d55cacf169731ffcfabec7b2656f634d98f14380513cc1fbcfcbf9ad1490c0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e295ebda38e0bd1b590ecc9d154a3a67421d2e091b93cca7b09d5179c45779ced7093cac5c3f024aa51ce9e115c44205bc9f2d0f94d45400ebdaa6ec16ce621f
|
7
|
+
data.tar.gz: e47ef8612d18ecc2370e63c481a87242f38a22c4a875ed6138b5c3289dbd0163ac83771e20de7ce98915d470cb049d4245c619edd309846e2772c9e0c0afef56
|
data/lib/cafe_buy_duo.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
|
@@ -2609,7 +2641,15 @@ class Wordpress
|
|
2609
2641
|
end
|
2610
2642
|
|
2611
2643
|
if @data['포스트설정']['gpt제목'].checked?
|
2612
|
-
|
2644
|
+
gpt_title_prompt = @data['포스트설정']['gpt제목_프롬프트'].text.to_s.force_encoding('utf-8')
|
2645
|
+
|
2646
|
+
# 공백을 포함한 빈 문자열을 체크하기 위해 strip을 사용
|
2647
|
+
gpt_title_prompt_sample = gpt_title_prompt.strip.empty? ? "프롬프트: 문장을 비슷한 길이로 ChatGPT의 멘트는 빼고 표현을 더 추가해서 하나만 만들어줘." : gpt_title_prompt
|
2648
|
+
|
2649
|
+
# gpt_title_prompt_sample을 Chat_title 객체에 전달
|
2650
|
+
chat = Chat_title.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_title_prompt_sample)
|
2651
|
+
|
2652
|
+
# 메시지 요청 후 title에 저장
|
2613
2653
|
gpt_text1 = chat.message(title)
|
2614
2654
|
title = gpt_text1.to_s
|
2615
2655
|
end
|
@@ -2654,18 +2694,16 @@ class Wordpress
|
|
2654
2694
|
|
2655
2695
|
|
2656
2696
|
if @data['포스트설정']['gpt내용'].checked?
|
2697
|
+
gpt_content_prompt = @data['포스트설정']['gpt내용_프롬프트'].text.to_s.force_encoding('utf-8')
|
2657
2698
|
api_key = @data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8')
|
2658
|
-
#key_change = @data['포스트설정']['특정단어키워드로변경값'].text.to_s.force_encoding('utf-8')
|
2659
|
-
#imotcon_change = @data['포스트설정']['스티커로변경단어'].text.to_s.force_encoding('utf-8')
|
2660
|
-
#template_change = @data['포스트설정']['내템플릿변경단어'].text.to_s.force_encoding('utf-8')
|
2661
|
-
#ttdanar_change = @data['포스트설정']['단어링크적용단어'].text.to_s.force_encoding('utf-8')
|
2662
|
-
#sajine_change = @data['포스트설정']['단어사진으로변경단어'].text.to_s.force_encoding('utf-8')
|
2663
|
-
#mov_change = @data['포스트설정']['영상으로변경단어'].text.to_s.force_encoding('utf-8')
|
2664
|
-
#map_change = @data['포스트설정']['지도로변경단어'].text.to_s.force_encoding('utf-8')
|
2665
|
-
#inyong9_change = @data['포스트설정']['인용구변경단어'].text.to_s.force_encoding('utf-8')
|
2666
|
-
|
2667
2699
|
|
2668
|
-
|
2700
|
+
# 공백을 포함한 빈 문자열을 체크하기 위해 strip을 사용
|
2701
|
+
gpt_content_prompt_sample = gpt_content_prompt.strip.empty? ? "프롬프트:ChatGPT의 멘트는 빼고 위 전체적인 내용의 형식을 똑같이 표현을 더 추가하고 유사어로 변경하여 하나 만들어줘! 전화번호,연락처,가격,홈페이지안내 ,상담안내 관련 문구는 유지해야해" : gpt_content_prompt
|
2702
|
+
|
2703
|
+
# Chat_content 객체 생성 시 api_key와 gpt_content_prompt_sample을 두 개의 인자로 전달
|
2704
|
+
chat = Chat_content.new(api_key, gpt_content_prompt_sample)
|
2705
|
+
|
2706
|
+
# 메시지 요청 후 content에 저장
|
2669
2707
|
gpt_text3 = chat.message(content)
|
2670
2708
|
content = gpt_text3.to_s
|
2671
2709
|
end
|
@@ -2869,13 +2907,17 @@ class Wordpress
|
|
2869
2907
|
@data['table'] << []
|
2870
2908
|
@data['table'].pop
|
2871
2909
|
if @data['포스트설정']['gpt키워드'].checked?
|
2872
|
-
|
2910
|
+
gpt_keyword_prompt = @data['포스트설정']['gpt키워드_프롬프트'].text.to_s.force_encoding('utf-8')
|
2911
|
+
gpt_keyword_prompt_sample = gpt_keyword_prompt.strip.empty? ? "프롬프트: 관련된 글을 1500자에서 2500자 사이로 만들어줘" : gpt_keyword_prompt
|
2912
|
+
chat = Chat.new(@data['포스트설정']['api_key'].text.to_s.force_encoding('utf-8'), gpt_keyword_prompt)
|
2873
2913
|
gpt_text = chat.message(keyword)
|
2874
|
-
content = content + "\n(자동생성글)\n" + gpt_text
|
2914
|
+
#content = content.to_s + "\n(자동생성글)\n" + gpt_text.to_s
|
2915
|
+
content = content.to_s + "(자동생성글)" + gpt_text.to_s
|
2875
2916
|
elsif @data['포스트설정']['내용을자동생성'].checked?
|
2876
2917
|
content = auto_text
|
2877
2918
|
elsif @data['포스트설정']['내용과자동생성'].checked?
|
2878
|
-
content = content + "\n(자동생성글)\n" + auto_text
|
2919
|
+
#content = content + "\n(자동생성글)\n" + auto_text
|
2920
|
+
content = content + "(자동생성글)" + auto_text
|
2879
2921
|
end
|
2880
2922
|
|
2881
2923
|
if @data['포스트설정']['내용키워드삽입'].checked?
|
@@ -2910,7 +2952,8 @@ class Wordpress
|
|
2910
2952
|
end
|
2911
2953
|
|
2912
2954
|
if @data['포스트설정']['내용을자동생성'].checked?
|
2913
|
-
content2 = content.split("\n")
|
2955
|
+
#content2 = content.split("\n")
|
2956
|
+
content2 = content.split
|
2914
2957
|
end
|
2915
2958
|
|
2916
2959
|
if @data['포스트설정']['내용과자동생성'].checked? or @data['포스트설정']['gpt키워드'].checked?
|
@@ -4039,423 +4082,439 @@ class Wordpress
|
|
4039
4082
|
}
|
4040
4083
|
}
|
4041
4084
|
tab_item('내용설정'){
|
4085
|
+
horizontal_box{
|
4086
|
+
vertical_box{
|
4042
4087
|
horizontal_box{
|
4043
|
-
|
4044
|
-
|
4045
|
-
|
4046
|
-
|
4047
|
-
|
4048
|
-
|
4049
|
-
|
4050
|
-
|
4051
|
-
file_data.split("\n").each do |keyword|
|
4052
|
-
if keyword.split(' ').join('').length < 2
|
4088
|
+
stretchy false
|
4089
|
+
button('키워드불러오기'){
|
4090
|
+
on_clicked{
|
4091
|
+
file = open_file
|
4092
|
+
if file != nil
|
4093
|
+
file_data = File.open(file, 'r', :encoding => 'utf-8').read()
|
4094
|
+
file_data.split("\n").each do |keyword|
|
4095
|
+
if keyword.split(' ').join('').length < 2
|
4053
4096
|
|
4054
|
-
|
4055
|
-
|
4056
|
-
|
4057
|
-
@data['키워드설정']['키워드'].pop
|
4058
|
-
end
|
4059
|
-
end
|
4060
|
-
end
|
4061
|
-
|
4062
|
-
}
|
4063
|
-
}
|
4064
|
-
|
4065
|
-
}
|
4066
|
-
horizontal_box{
|
4067
|
-
stretchy false
|
4068
|
-
grid{
|
4069
|
-
button('전체선택'){
|
4070
|
-
top 1
|
4071
|
-
left 1
|
4072
|
-
on_clicked{
|
4073
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
4074
|
-
@data['키워드설정']['키워드'][n][0] = true
|
4075
|
-
@data['키워드설정']['키워드'] << []
|
4076
|
-
@data['키워드설정']['키워드'].pop
|
4077
|
-
end
|
4078
|
-
}
|
4079
|
-
}
|
4080
|
-
button('선택해제'){
|
4081
|
-
top 1
|
4082
|
-
left 2
|
4083
|
-
on_clicked{
|
4084
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
4085
|
-
@data['키워드설정']['키워드'][n][0] = false
|
4086
|
-
@data['키워드설정']['키워드'] << []
|
4097
|
+
else
|
4098
|
+
@data['키워드설정']['키워드'] << [false, keyword]
|
4099
|
+
@data['키워드설정']['키워드'] << [false, keyword]
|
4087
4100
|
@data['키워드설정']['키워드'].pop
|
4088
4101
|
end
|
4089
|
-
|
4090
|
-
|
4091
|
-
button('삭제하기'){
|
4092
|
-
top 1
|
4093
|
-
left 3
|
4094
|
-
on_clicked{
|
4095
|
-
m = Array.new
|
4096
|
-
for n in 0..@data['키워드설정']['키워드'].length-1
|
4097
|
-
if @data['키워드설정']['키워드'][n][0] == true
|
4098
|
-
m << n
|
4099
|
-
end
|
4100
|
-
end
|
4102
|
+
end
|
4103
|
+
end
|
4101
4104
|
|
4102
|
-
m.reverse.each do |i|
|
4103
|
-
@data['키워드설정']['키워드'].delete_at(i)
|
4104
|
-
end
|
4105
|
-
@data['키워드설정']['키워드'].delete(nil)
|
4106
|
-
}
|
4107
|
-
}
|
4108
4105
|
}
|
4109
|
-
|
4110
|
-
|
4111
|
-
|
4112
|
-
|
4113
|
-
|
4114
|
-
|
4115
|
-
|
4116
|
-
|
4117
|
-
|
4118
|
-
|
4119
|
-
|
4120
|
-
|
4121
|
-
|
4122
|
-
|
4123
|
-
|
4124
|
-
}
|
4125
|
-
}
|
4106
|
+
}
|
4107
|
+
|
4108
|
+
}
|
4109
|
+
horizontal_box{
|
4110
|
+
stretchy false
|
4111
|
+
grid{
|
4112
|
+
button('전체선택'){
|
4113
|
+
top 1
|
4114
|
+
left 1
|
4115
|
+
on_clicked{
|
4116
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
4117
|
+
@data['키워드설정']['키워드'][n][0] = true
|
4118
|
+
@data['키워드설정']['키워드'] << []
|
4119
|
+
@data['키워드설정']['키워드'].pop
|
4120
|
+
end
|
4126
4121
|
}
|
4127
|
-
|
4128
|
-
|
4122
|
+
}
|
4123
|
+
button('선택해제'){
|
4124
|
+
top 1
|
4125
|
+
left 2
|
4126
|
+
on_clicked{
|
4127
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
4128
|
+
@data['키워드설정']['키워드'][n][0] = false
|
4129
|
+
@data['키워드설정']['키워드'] << []
|
4130
|
+
@data['키워드설정']['키워드'].pop
|
4131
|
+
end
|
4129
4132
|
}
|
4130
|
-
|
4131
|
-
|
4132
|
-
|
4133
|
-
|
4134
|
-
|
4135
|
-
|
4136
|
-
|
4137
|
-
|
4138
|
-
|
4139
|
-
@data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
|
4140
|
-
@data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
|
4141
|
-
else
|
4142
|
-
@data['포스트설정']['gpt상단'].checked = false # 체크 해제
|
4143
|
-
@data['포스트설정']['gpt상단'].enabled = false # 비활성화
|
4144
|
-
@data['포스트설정']['gpt하단'].checked = false # 체크 해제
|
4145
|
-
@data['포스트설정']['gpt하단'].enabled = false # 비활성화
|
4146
|
-
end
|
4147
|
-
}
|
4148
|
-
|
4149
|
-
}
|
4150
|
-
|
4151
|
-
@data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
|
4152
|
-
top 1
|
4153
|
-
left 1
|
4154
|
-
enabled false # 기본적으로 비활성화
|
4155
|
-
on_toggled{
|
4156
|
-
if @data['포스트설정']['gpt상단'].checked?
|
4157
|
-
@data['포스트설정']['gpt하단'].checked = false
|
4158
|
-
end
|
4159
|
-
}
|
4160
|
-
}
|
4161
|
-
|
4162
|
-
@data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
|
4163
|
-
top 1
|
4164
|
-
left 2
|
4165
|
-
enabled false # 기본적으로 비활성화
|
4166
|
-
on_toggled{
|
4167
|
-
if @data['포스트설정']['gpt하단'].checked?
|
4168
|
-
@data['포스트설정']['gpt상단'].checked = false
|
4133
|
+
}
|
4134
|
+
button('삭제하기'){
|
4135
|
+
top 1
|
4136
|
+
left 3
|
4137
|
+
on_clicked{
|
4138
|
+
m = Array.new
|
4139
|
+
for n in 0..@data['키워드설정']['키워드'].length-1
|
4140
|
+
if @data['키워드설정']['키워드'][n][0] == true
|
4141
|
+
m << n
|
4169
4142
|
end
|
4170
|
-
|
4171
|
-
}
|
4172
|
-
} }
|
4173
|
-
horizontal_box{
|
4174
|
-
stretchy false
|
4175
|
-
grid{
|
4176
|
-
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4177
|
-
} } }
|
4178
|
-
|
4179
|
-
|
4180
|
-
table{
|
4181
|
-
checkbox_column('선택'){
|
4182
|
-
editable true
|
4183
|
-
}
|
4184
|
-
text_column('키워드'){
|
4185
|
-
|
4186
|
-
}
|
4143
|
+
end
|
4187
4144
|
|
4188
|
-
|
4145
|
+
m.reverse.each do |i|
|
4146
|
+
@data['키워드설정']['키워드'].delete_at(i)
|
4147
|
+
end
|
4148
|
+
@data['키워드설정']['키워드'].delete(nil)
|
4189
4149
|
}
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
4150
|
}
|
4194
|
-
|
4151
|
+
}
|
4152
|
+
|
4153
|
+
@data['키워드설정']['순서사용'] = checkbox('순서사용'){
|
4195
4154
|
stretchy false
|
4155
|
+
on_toggled{ |c|
|
4156
|
+
if c.checked?
|
4157
|
+
@data['키워드설정']['랜덤사용'].checked = false
|
4158
|
+
end
|
4159
|
+
}
|
4160
|
+
}
|
4161
|
+
@data['키워드설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4162
|
+
stretchy false
|
4163
|
+
on_toggled{ |c|
|
4164
|
+
if c.checked?
|
4165
|
+
@data['키워드설정']['순서사용'].checked = false
|
4166
|
+
end
|
4167
|
+
}
|
4168
|
+
}
|
4169
|
+
}
|
4170
|
+
vertical_separator{
|
4171
|
+
stretchy false
|
4172
|
+
}
|
4173
|
+
horizontal_box{
|
4174
|
+
stretchy false
|
4175
|
+
grid{
|
4176
|
+
@data['포스트설정']['gpt키워드'] = checkbox('GPT 키워드 기반 글 생성'){
|
4177
|
+
top 1
|
4178
|
+
left 0
|
4179
|
+
#enabled false # 기본적으로 비활성화
|
4180
|
+
on_toggled {
|
4181
|
+
if @data['포스트설정']['gpt키워드'].checked?
|
4182
|
+
@data['포스트설정']['gpt상단'].enabled = true # '내용투명' 활성화
|
4183
|
+
@data['포스트설정']['gpt하단'].enabled = true # '내용투명' 활성화
|
4184
|
+
else
|
4185
|
+
@data['포스트설정']['gpt상단'].checked = false # 체크 해제
|
4186
|
+
@data['포스트설정']['gpt상단'].enabled = false # 비활성화
|
4187
|
+
@data['포스트설정']['gpt하단'].checked = false # 체크 해제
|
4188
|
+
@data['포스트설정']['gpt하단'].enabled = false # 비활성화
|
4189
|
+
end
|
4190
|
+
}
|
4191
|
+
|
4192
|
+
}
|
4193
|
+
|
4194
|
+
@data['포스트설정']['gpt상단'] = checkbox('원고 위에 넣기'){
|
4195
|
+
top 1
|
4196
|
+
left 1
|
4197
|
+
enabled false # 기본적으로 비활성화
|
4198
|
+
on_toggled{
|
4199
|
+
if @data['포스트설정']['gpt상단'].checked?
|
4200
|
+
@data['포스트설정']['gpt하단'].checked = false
|
4201
|
+
end
|
4202
|
+
}
|
4196
4203
|
}
|
4197
|
-
vertical_box{
|
4198
|
-
horizontal_box{
|
4199
|
-
stretchy false
|
4200
|
-
button('제목불러오기'){
|
4201
|
-
on_clicked{
|
4202
|
-
file = open_file
|
4203
|
-
if file != nil
|
4204
|
-
file_data = File.open(file, 'r', :encoding => 'utf-8').read()
|
4205
|
-
file_data.split("\n").each do |title|
|
4206
|
-
if title.split(" ").join('').length < 2
|
4207
|
-
|
4208
|
-
else
|
4209
|
-
@data['제목설정']['제목'] << [false, title]
|
4210
|
-
@data['제목설정']['제목'] << [false, title]
|
4211
|
-
@data['제목설정']['제목'].pop
|
4212
|
-
end
|
4213
|
-
end
|
4214
|
-
end
|
4215
|
-
}
|
4216
|
-
}
|
4217
4204
|
|
4205
|
+
@data['포스트설정']['gpt하단'] = checkbox('원고 아래 넣기'){
|
4206
|
+
top 1
|
4207
|
+
left 2
|
4208
|
+
enabled false # 기본적으로 비활성화
|
4209
|
+
on_toggled{
|
4210
|
+
if @data['포스트설정']['gpt하단'].checked?
|
4211
|
+
@data['포스트설정']['gpt상단'].checked = false
|
4212
|
+
end
|
4218
4213
|
}
|
4219
|
-
|
4220
|
-
|
4221
|
-
|
4222
|
-
|
4223
|
-
|
4224
|
-
|
4225
|
-
|
4226
|
-
|
4227
|
-
|
4228
|
-
|
4229
|
-
|
4230
|
-
|
4231
|
-
|
4232
|
-
|
4233
|
-
|
4234
|
-
|
4235
|
-
|
4236
|
-
|
4237
|
-
|
4238
|
-
|
4239
|
-
|
4214
|
+
}
|
4215
|
+
} }
|
4216
|
+
horizontal_box{
|
4217
|
+
stretchy false
|
4218
|
+
@data['포스트설정']['gpt키워드_프롬프트'] = entry(){
|
4219
|
+
text '프롬프트:관련 글을 1500자에서 2500자 사이로 만들어줘'
|
4220
|
+
}}
|
4221
|
+
horizontal_box{
|
4222
|
+
stretchy false
|
4223
|
+
grid{
|
4224
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4225
|
+
} } }
|
4226
|
+
|
4227
|
+
|
4228
|
+
table{
|
4229
|
+
checkbox_column('선택'){
|
4230
|
+
editable true
|
4231
|
+
}
|
4232
|
+
text_column('키워드'){
|
4233
|
+
|
4234
|
+
}
|
4235
|
+
|
4236
|
+
cell_rows @data['키워드설정']['키워드']
|
4237
|
+
}
|
4238
|
+
|
4239
|
+
|
4240
|
+
|
4241
|
+
}
|
4242
|
+
vertical_separator{
|
4243
|
+
stretchy false
|
4244
|
+
}
|
4245
|
+
vertical_box{
|
4246
|
+
horizontal_box{
|
4247
|
+
stretchy false
|
4248
|
+
button('제목불러오기'){
|
4249
|
+
on_clicked{
|
4250
|
+
file = open_file
|
4251
|
+
if file != nil
|
4252
|
+
file_data = File.open(file, 'r', :encoding => 'utf-8').read()
|
4253
|
+
file_data.split("\n").each do |title|
|
4254
|
+
if title.split(" ").join('').length < 2
|
4255
|
+
|
4256
|
+
else
|
4257
|
+
@data['제목설정']['제목'] << [false, title]
|
4258
|
+
@data['제목설정']['제목'] << [false, title]
|
4240
4259
|
@data['제목설정']['제목'].pop
|
4241
4260
|
end
|
4242
|
-
|
4243
|
-
|
4244
|
-
|
4245
|
-
|
4246
|
-
left 3
|
4247
|
-
on_clicked{
|
4248
|
-
m = Array.new
|
4249
|
-
for n in 0..@data['제목설정']['제목'].length-1
|
4250
|
-
if @data['제목설정']['제목'][n][0] == true
|
4251
|
-
m << n
|
4252
|
-
end
|
4253
|
-
end
|
4261
|
+
end
|
4262
|
+
end
|
4263
|
+
}
|
4264
|
+
}
|
4254
4265
|
|
4255
|
-
|
4256
|
-
|
4257
|
-
|
4258
|
-
|
4259
|
-
|
4260
|
-
|
4266
|
+
}
|
4267
|
+
horizontal_box{
|
4268
|
+
stretchy false
|
4269
|
+
grid{
|
4270
|
+
button('전체선택'){
|
4271
|
+
top 1
|
4272
|
+
left 1
|
4273
|
+
on_clicked{
|
4274
|
+
for n in 0..@data['제목설정']['제목'].length-1
|
4275
|
+
@data['제목설정']['제목'][n][0] = true
|
4276
|
+
@data['제목설정']['제목'] << []
|
4277
|
+
@data['제목설정']['제목'].pop
|
4278
|
+
end
|
4261
4279
|
}
|
4262
|
-
|
4263
|
-
|
4264
|
-
|
4265
|
-
|
4266
|
-
|
4267
|
-
|
4268
|
-
|
4269
|
-
|
4270
|
-
|
4271
|
-
|
4272
|
-
on_toggled{ |c|
|
4273
|
-
if c.checked?
|
4274
|
-
@data['제목설정']['순서사용'].checked = false
|
4275
|
-
end
|
4276
|
-
}
|
4277
|
-
}
|
4280
|
+
}
|
4281
|
+
button('선택해제'){
|
4282
|
+
top 1
|
4283
|
+
left 2
|
4284
|
+
on_clicked{
|
4285
|
+
for n in 0..@data['제목설정']['제목'].length-1
|
4286
|
+
@data['제목설정']['제목'][n][0] = false
|
4287
|
+
@data['제목설정']['제목'] << []
|
4288
|
+
@data['제목설정']['제목'].pop
|
4289
|
+
end
|
4278
4290
|
}
|
4279
|
-
|
4280
|
-
|
4291
|
+
}
|
4292
|
+
button('삭제하기'){
|
4293
|
+
top 1
|
4294
|
+
left 3
|
4295
|
+
on_clicked{
|
4296
|
+
m = Array.new
|
4297
|
+
for n in 0..@data['제목설정']['제목'].length-1
|
4298
|
+
if @data['제목설정']['제목'][n][0] == true
|
4299
|
+
m << n
|
4300
|
+
end
|
4301
|
+
end
|
4302
|
+
|
4303
|
+
m.reverse.each do |i|
|
4304
|
+
@data['제목설정']['제목'].delete_at(i)
|
4305
|
+
end
|
4306
|
+
@data['제목설정']['제목'].delete(nil)
|
4281
4307
|
}
|
4282
|
-
|
4283
|
-
|
4284
|
-
|
4285
|
-
|
4286
|
-
|
4287
|
-
|
4288
|
-
|
4289
|
-
|
4290
|
-
|
4291
|
-
|
4292
|
-
|
4293
|
-
|
4294
|
-
|
4308
|
+
}
|
4309
|
+
}
|
4310
|
+
@data['제목설정']['순서사용'] = checkbox('순서사용'){
|
4311
|
+
stretchy false
|
4312
|
+
on_toggled{ |c|
|
4313
|
+
if c.checked?
|
4314
|
+
@data['제목설정']['랜덤사용'].checked = false
|
4315
|
+
end
|
4316
|
+
}
|
4317
|
+
}
|
4318
|
+
@data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4319
|
+
stretchy false
|
4320
|
+
on_toggled{ |c|
|
4321
|
+
if c.checked?
|
4322
|
+
@data['제목설정']['순서사용'].checked = false
|
4323
|
+
end
|
4324
|
+
}
|
4325
|
+
}
|
4326
|
+
}
|
4327
|
+
vertical_separator{
|
4328
|
+
stretchy false
|
4329
|
+
}
|
4330
|
+
horizontal_box{
|
4331
|
+
stretchy false
|
4332
|
+
grid{
|
4333
|
+
@data['포스트설정']['gpt제목'] = checkbox('제목을 이용해 GPT로 비슷한 제목 생성'){
|
4334
|
+
|
4335
|
+
|
4336
|
+
}}}
|
4337
|
+
horizontal_box{
|
4338
|
+
stretchy false
|
4339
|
+
@data['포스트설정']['gpt제목_프롬프트'] = entry(){
|
4340
|
+
text '프롬프트:비슷한 길이로 제목으로 사용할수있게 하나만 만들어줘'
|
4341
|
+
}}
|
4342
|
+
horizontal_box{
|
4343
|
+
stretchy false
|
4344
|
+
grid{
|
4345
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4346
|
+
} } }
|
4347
|
+
|
4295
4348
|
|
4296
|
-
|
4297
|
-
|
4298
|
-
|
4299
|
-
|
4300
|
-
|
4349
|
+
table{
|
4350
|
+
checkbox_column('선택'){
|
4351
|
+
editable true
|
4352
|
+
}
|
4353
|
+
text_column('제목'){
|
4301
4354
|
|
4302
|
-
|
4355
|
+
}
|
4303
4356
|
|
4304
|
-
|
4305
|
-
|
4306
|
-
|
4357
|
+
cell_rows @data['제목설정']['제목']
|
4358
|
+
}
|
4359
|
+
|
4307
4360
|
|
4361
|
+
}
|
4362
|
+
vertical_separator{
|
4363
|
+
stretchy false
|
4364
|
+
}
|
4365
|
+
vertical_box{
|
4366
|
+
horizontal_box{
|
4367
|
+
stretchy false
|
4368
|
+
button('내용불러오기'){
|
4369
|
+
on_clicked{
|
4370
|
+
file = open_file
|
4371
|
+
if file != nil
|
4372
|
+
file_name = file.split("\\")[-1]
|
4373
|
+
file_data = File.open(file,'r', :encoding => 'utf-8').read()
|
4374
|
+
if file_data.split("\n").length < 2
|
4375
|
+
file_data = file_data + "\n"
|
4376
|
+
end
|
4377
|
+
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4378
|
+
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4379
|
+
@data['내용설정']['내용'].pop
|
4380
|
+
end
|
4381
|
+
}
|
4308
4382
|
}
|
4309
|
-
vertical_separator{
|
4310
|
-
stretchy false
|
4311
|
-
}
|
4312
|
-
vertical_box{
|
4313
|
-
horizontal_box{
|
4314
|
-
stretchy false
|
4315
|
-
button('내용불러오기'){
|
4316
|
-
on_clicked{
|
4317
|
-
file = open_file
|
4318
|
-
if file != nil
|
4319
|
-
file_name = file.split("\\")[-1]
|
4320
|
-
file_data = File.open(file,'r', :encoding => 'utf-8').read()
|
4321
|
-
if file_data.split("\n").length < 2
|
4322
|
-
file_data = file_data + "\n"
|
4323
|
-
end
|
4324
|
-
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4325
|
-
@data['내용설정']['내용'] << [false, file_name, file_data]
|
4326
|
-
@data['내용설정']['내용'].pop
|
4327
|
-
end
|
4328
|
-
}
|
4329
|
-
}
|
4330
4383
|
|
4384
|
+
}
|
4385
|
+
horizontal_box{
|
4386
|
+
stretchy false
|
4387
|
+
grid{
|
4388
|
+
button('전체선택'){
|
4389
|
+
top 1
|
4390
|
+
left 1
|
4391
|
+
on_clicked{
|
4392
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
4393
|
+
@data['내용설정']['내용'][n][0] = true
|
4394
|
+
@data['내용설정']['내용'] << []
|
4395
|
+
@data['내용설정']['내용'].pop
|
4396
|
+
end
|
4331
4397
|
}
|
4332
|
-
|
4333
|
-
|
4334
|
-
|
4335
|
-
|
4336
|
-
|
4337
|
-
|
4338
|
-
|
4339
|
-
|
4340
|
-
|
4341
|
-
|
4342
|
-
|
4343
|
-
|
4344
|
-
|
4345
|
-
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
4350
|
-
|
4351
|
-
|
4352
|
-
|
4353
|
-
|
4354
|
-
end
|
4355
|
-
}
|
4356
|
-
}
|
4357
|
-
button('삭제하기'){
|
4358
|
-
top 1
|
4359
|
-
left 3
|
4360
|
-
on_clicked{
|
4361
|
-
m = Array.new
|
4362
|
-
for n in 0..@data['내용설정']['내용'].length-1
|
4363
|
-
if @data['내용설정']['내용'][n][0] == true
|
4364
|
-
m << n
|
4365
|
-
end
|
4366
|
-
end
|
4398
|
+
}
|
4399
|
+
button('선택해제'){
|
4400
|
+
top 1
|
4401
|
+
left 2
|
4402
|
+
on_clicked{
|
4403
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
4404
|
+
@data['내용설정']['내용'][n][0] = false
|
4405
|
+
@data['내용설정']['내용'] << []
|
4406
|
+
@data['내용설정']['내용'].pop
|
4407
|
+
end
|
4408
|
+
}
|
4409
|
+
}
|
4410
|
+
button('삭제하기'){
|
4411
|
+
top 1
|
4412
|
+
left 3
|
4413
|
+
on_clicked{
|
4414
|
+
m = Array.new
|
4415
|
+
for n in 0..@data['내용설정']['내용'].length-1
|
4416
|
+
if @data['내용설정']['내용'][n][0] == true
|
4417
|
+
m << n
|
4418
|
+
end
|
4419
|
+
end
|
4367
4420
|
|
4368
|
-
|
4369
|
-
|
4370
|
-
|
4371
|
-
|
4372
|
-
}
|
4373
|
-
}
|
4421
|
+
m.reverse.each do |i|
|
4422
|
+
@data['내용설정']['내용'].delete_at(i)
|
4423
|
+
end
|
4424
|
+
@data['내용설정']['내용'].delete(nil)
|
4374
4425
|
}
|
4375
|
-
|
4376
|
-
|
4377
|
-
|
4378
|
-
|
4379
|
-
|
4380
|
-
|
4381
|
-
|
4382
|
-
|
4383
|
-
@data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4384
|
-
stretchy false
|
4385
|
-
on_toggled{ |c|
|
4386
|
-
if c.checked?
|
4387
|
-
@data['내용설정']['순서사용'].checked = false
|
4388
|
-
end
|
4389
|
-
}
|
4390
|
-
}
|
4426
|
+
}
|
4427
|
+
}
|
4428
|
+
@data['내용설정']['순서사용'] = checkbox('순서사용'){
|
4429
|
+
stretchy false
|
4430
|
+
on_toggled{ |c|
|
4431
|
+
if c.checked?
|
4432
|
+
@data['내용설정']['랜덤사용'].checked = false
|
4433
|
+
end
|
4391
4434
|
}
|
4392
|
-
|
4393
|
-
|
4435
|
+
}
|
4436
|
+
@data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
|
4437
|
+
stretchy false
|
4438
|
+
on_toggled{ |c|
|
4439
|
+
if c.checked?
|
4440
|
+
@data['내용설정']['순서사용'].checked = false
|
4441
|
+
end
|
4394
4442
|
}
|
4395
|
-
|
4396
|
-
|
4397
|
-
|
4398
|
-
|
4399
|
-
|
4400
|
-
|
4401
|
-
|
4402
|
-
|
4403
|
-
|
4404
|
-
|
4405
|
-
|
4406
|
-
}
|
4407
|
-
|
4408
|
-
|
4409
|
-
|
4410
|
-
|
4411
|
-
|
4412
|
-
|
4443
|
+
}
|
4444
|
+
}
|
4445
|
+
vertical_separator{
|
4446
|
+
stretchy false
|
4447
|
+
}
|
4448
|
+
horizontal_box{
|
4449
|
+
stretchy false
|
4450
|
+
grid{
|
4451
|
+
@data['포스트설정']['gpt내용'] = checkbox('내용파일을 이용해 GPT로 글 변형'){
|
4452
|
+
|
4453
|
+
|
4454
|
+
}}}
|
4455
|
+
horizontal_box{
|
4456
|
+
stretchy false
|
4457
|
+
@data['포스트설정']['gpt내용_프롬프트'] = entry(){
|
4458
|
+
text '프롬프트:동의어,유사어를 이용해 변경해줘'
|
4459
|
+
}}
|
4460
|
+
horizontal_box{
|
4461
|
+
stretchy false
|
4462
|
+
grid{
|
4463
|
+
label('※ GPT 기능 사용시 포스트설정1에서 GPT사용에 체크 필수'){
|
4464
|
+
} } }
|
4465
|
+
|
4466
|
+
table{
|
4467
|
+
checkbox_column('선택'){
|
4468
|
+
editable true
|
4469
|
+
}
|
4470
|
+
text_column('내용파일'){
|
4413
4471
|
|
4414
|
-
|
4472
|
+
}
|
4415
4473
|
|
4416
|
-
|
4417
|
-
|
4474
|
+
cell_rows @data['내용설정']['내용']
|
4475
|
+
}
|
4418
4476
|
|
4419
|
-
|
4420
|
-
|
4421
|
-
|
4422
|
-
|
4423
|
-
|
4424
|
-
|
4425
|
-
button('폴더째로 불러오기') {
|
4426
|
-
on_clicked {
|
4427
|
-
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
|
4477
|
+
horizontal_box{
|
4478
|
+
stretchy false
|
4479
|
+
@data['이미지설정']['폴더경로2'] = entry{
|
4480
|
+
stretchy false
|
4481
|
+
text "내용폴더경로 ex)C:\\내용\\폴더1"
|
4482
|
+
}
|
4428
4483
|
|
4429
|
-
|
4430
|
-
|
4431
|
-
|
4432
|
-
if file == '.' or file == '..'
|
4433
|
-
next
|
4434
|
-
else
|
4435
|
-
begin
|
4436
|
-
# 파일을 열고 내용을 읽어서 추가
|
4437
|
-
file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
|
4438
|
-
@data['내용설정']['내용'] << [false, file, file_data]
|
4439
|
-
rescue => e
|
4440
|
-
# 파일을 열 수 없는 경우, 오류 메시지 출력
|
4441
|
-
puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
|
4442
|
-
end
|
4443
|
-
end
|
4444
|
-
end
|
4484
|
+
button('폴더째로 불러오기') {
|
4485
|
+
on_clicked {
|
4486
|
+
path = @data['이미지설정']['폴더경로2'].text.to_s.force_encoding('utf-8')
|
4445
4487
|
|
4446
|
-
|
4447
|
-
|
4448
|
-
|
4488
|
+
# 경로가 유효한지 확인
|
4489
|
+
if Dir.exist?(path)
|
4490
|
+
Dir.entries(path).each do |file|
|
4491
|
+
if file == '.' or file == '..'
|
4492
|
+
next
|
4449
4493
|
else
|
4450
|
-
|
4451
|
-
|
4494
|
+
begin
|
4495
|
+
# 파일을 열고 내용을 읽어서 추가
|
4496
|
+
file_data = File.open(path + '/' + file, 'r', encoding: 'utf-8').read
|
4497
|
+
@data['내용설정']['내용'] << [false, file, file_data]
|
4498
|
+
rescue => e
|
4499
|
+
# 파일을 열 수 없는 경우, 오류 메시지 출력
|
4500
|
+
puts "파일을 열 수 없습니다: #{file}, 오류: #{e.message}"
|
4501
|
+
end
|
4452
4502
|
end
|
4453
|
-
|
4454
|
-
|
4503
|
+
end
|
4504
|
+
|
4505
|
+
# 내용 배열에서 마지막 빈 항목 제거
|
4506
|
+
@data['내용설정']['내용'] << []
|
4507
|
+
@data['내용설정']['내용'].pop
|
4508
|
+
else
|
4509
|
+
# 경로가 유효하지 않을 경우, 오류 메시지 출력
|
4510
|
+
puts "경로가 존재하지 않습니다: #{path}"
|
4511
|
+
end
|
4455
4512
|
}
|
4456
4513
|
}
|
4457
4514
|
}
|
4458
4515
|
}
|
4516
|
+
}
|
4517
|
+
}
|
4459
4518
|
tab_item('이미지설정'){
|
4460
4519
|
horizontal_box{
|
4461
4520
|
vertical_box{
|
@@ -4929,7 +4988,7 @@ class Wordpress
|
|
4929
4988
|
left 1
|
4930
4989
|
text 'URL'
|
4931
4990
|
}
|
4932
|
-
@data['포스트설정']['내용을자동생성'] = checkbox('키워드기반
|
4991
|
+
@data['포스트설정']['내용을자동생성'] = checkbox('키워드기반 글만 등록(GPT사용시 체크 해제)'){
|
4933
4992
|
top 9
|
4934
4993
|
left 0
|
4935
4994
|
on_toggled{
|
@@ -4937,31 +4996,46 @@ class Wordpress
|
|
4937
4996
|
@data['포스트설정']['내용과자동생성'].checked = false
|
4938
4997
|
@data['포스트설정']['내용투명'].checked = false
|
4939
4998
|
@data['포스트설정']['자동글 수식에 입력'].checked = false
|
4940
|
-
|
4999
|
+
|
4941
5000
|
end
|
4942
5001
|
}
|
4943
5002
|
}
|
4944
|
-
|
5003
|
+
label('※GPT사용시 내용설정 탭에서 설정'){
|
5004
|
+
top 9
|
5005
|
+
left 1
|
5006
|
+
}
|
5007
|
+
|
5008
|
+
label('※GPT 미 사용시 세팅 권장'){
|
5009
|
+
top 9
|
5010
|
+
left 3
|
5011
|
+
}
|
4945
5012
|
|
4946
|
-
|
4947
|
-
|
5013
|
+
|
4948
5014
|
aa1 = 2
|
4949
|
-
|
5015
|
+
@data['포스트설정']['내용과자동생성'] = checkbox('원고+키워드기반 글 등록(GPT사용시 체크 해제)') {
|
4950
5016
|
top 10 + aa1
|
4951
5017
|
left 0
|
4952
5018
|
on_toggled {
|
4953
|
-
|
5019
|
+
if @data['포스트설정']['내용과자동생성'].checked?
|
4954
5020
|
@data['포스트설정']['내용을자동생성'].checked = false
|
4955
5021
|
@data['포스트설정']['내용투명'].enabled = true # '내용투명' 활성화
|
4956
5022
|
@data['포스트설정']['자동글 수식에 입력'].enabled = true # '내용투명' 활성화
|
4957
|
-
|
5023
|
+
else
|
4958
5024
|
@data['포스트설정']['내용투명'].checked = false # 체크 해제
|
4959
5025
|
@data['포스트설정']['내용투명'].enabled = false # 비활성화
|
4960
5026
|
@data['포스트설정']['자동글 수식에 입력'].checked = false # 체크 해제
|
4961
5027
|
@data['포스트설정']['자동글 수식에 입력'].enabled = false # 비활성화
|
4962
|
-
|
5028
|
+
end
|
4963
5029
|
}
|
4964
|
-
|
5030
|
+
}
|
5031
|
+
label('※GPT사용시 내용설정 탭에서 설정'){
|
5032
|
+
top 10 + aa1
|
5033
|
+
left 1
|
5034
|
+
}
|
5035
|
+
label('※GPT 미 사용시 세팅 권장'){
|
5036
|
+
top 10 + aa1
|
5037
|
+
left 3
|
5038
|
+
}
|
4965
5039
|
|
4966
5040
|
@data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리') {
|
4967
5041
|
top 11 + aa1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_buy_duo
|
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
|