ssboost commited on
Commit
8b72279
ยท
verified ยท
1 Parent(s): 465653e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -147
app.py CHANGED
@@ -116,24 +116,39 @@ def call_api(content, system_message, max_tokens, temperature, top_p):
116
  def analyze_info(category, style, topic, references1, references2, references3):
117
  return f"์„ ํƒํ•œ ์นดํ…Œ๊ณ ๋ฆฌ: {category}\n์„ ํƒํ•œ ํฌ์ŠคํŒ… ์Šคํƒ€์ผ: {style}\n๋ธ”๋กœ๊ทธ ์ฃผ์ œ: {topic}\n์ฐธ๊ณ  ๊ธ€1: {references1}\n์ฐธ๊ณ  ๊ธ€2: {references2}\n์ฐธ๊ณ  ๊ธ€3: {references3}"
118
 
119
- def suggest_title(category, style, topic, references1, references2, references3, category_prompt, style_prompt, max_tokens, temperature, top_p):
120
  full_content = analyze_info(category, style, topic, references1, references2, references3)
 
 
 
 
 
121
  combined_prompt = f"{category_prompt}\n\n{style_prompt}"
122
  modified_text, input_tokens, output_tokens, total_tokens = call_api(full_content, combined_prompt, max_tokens, temperature, top_p)
123
  token_usage_message = f"[์ž…๋ ฅ ํ† ํฐ์ˆ˜: {input_tokens}]\n[์ถœ๋ ฅ ํ† ํฐ์ˆ˜: {output_tokens}]\n[์ด ํ† ํฐ์ˆ˜: {total_tokens}]"
124
  return modified_text, token_usage_message
125
 
126
- def generate_outline(category, style, topic, references1, references2, references3, title, category_prompt, style_prompt, max_tokens, temperature, top_p):
127
  full_content = analyze_info(category, style, topic, references1, references2, references3)
128
  content = f"{full_content}\nTitle: {title}"
 
 
 
 
 
129
  combined_prompt = f"{category_prompt}\n\n{style_prompt}"
130
  modified_text, input_tokens, output_tokens, total_tokens = call_api(content, combined_prompt, max_tokens, temperature, top_p)
131
  token_usage_message = f"[์ž…๋ ฅ ํ† ํฐ์ˆ˜: {input_tokens}]\n[์ถœ๋ ฅ ํ† ํฐ์ˆ˜: {output_tokens}]\n[์ด ํ† ํฐ์ˆ˜: {total_tokens}]"
132
  return modified_text, token_usage_message
133
 
134
- def generate_blog_post(category, style, topic, references1, references2, references3, title, outline, category_prompt, style_prompt, max_tokens, temperature, top_p):
135
  full_content = analyze_info(category, style, topic, references1, references2, references3)
136
  content = f"{full_content}\nTitle: {title}\nOutline: {outline}"
 
 
 
 
 
137
  combined_prompt = f"{category_prompt}\n\n{style_prompt}"
138
  modified_text, input_tokens, output_tokens, total_tokens = call_api(content, combined_prompt, max_tokens, temperature, top_p)
139
  formatted_text = modified_text.replace('\n', '\n\n')
@@ -156,7 +171,7 @@ def fetch_references(topic):
156
 
157
  return "์ฐธ๊ณ ๊ธ€ ์ƒ์„ฑ ์™„๋ฃŒ", references1_content, references2_content, references3_content
158
 
159
- def fetch_references_and_generate_all_steps(category, style, topic, blog_title, system_message_outline, max_tokens_outline, temperature_outline, top_p_outline, system_message_blog_post, max_tokens_blog_post, temperature_blog_post, top_p_blog_post):
160
  search_url = generate_naver_search_url(topic)
161
  session = setup_session()
162
  if session is None:
@@ -172,10 +187,10 @@ def fetch_references_and_generate_all_steps(category, style, topic, blog_title,
172
  references3_content = f"์ œ๋ชฉ: {selected_results[2]['์ œ๋ชฉ']}\n๋‚ด์šฉ: {crawl_blog_content(selected_results[2]['๋งํฌ'], session)}"
173
 
174
  # ์•„์›ƒ๋ผ์ธ ์ƒ์„ฑ
175
- outline_result, outline_token_usage = generate_outline(category, style, topic, references1_content, references2_content, references3_content, blog_title, system_message_outline, max_tokens_outline, temperature_outline, top_p_outline)
176
 
177
  # ๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑ
178
- blog_post_result, blog_post_token_usage = generate_blog_post(category, style, topic, references1_content, references2_content, references3_content, blog_title, outline_result, system_message_blog_post, max_tokens_blog_post, temperature_blog_post, top_p_blog_post)
179
 
180
  return references1_content, references2_content, references3_content, outline_result, outline_token_usage, blog_post_result, blog_post_token_usage
181
 
@@ -183,150 +198,30 @@ def get_title_prompt(category):
183
  if (category == "์ผ๋ฐ˜"):
184
  return """
185
  # ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ ์ƒ์„ฑ ๊ทœ์น™(์ผ๋ฐ˜)
186
- ##[๊ธฐ๋ณธ๊ทœ์น™]
187
- 1. ๋ฐ˜๋“œ์‹œ ๏ฟฝ๏ฟฝ๊ตญ์–ด(ํ•œ๊ธ€)๋กœ ์ž‘์„ฑํ•˜๋ผ.
188
- 2. ๋„ˆ๋Š” ๊ฐ€์žฅ ์ฃผ๋ชฉ๋ฐ›๋Š” ๋งˆ์ผ€ํ„ฐ์ด๋ฉฐ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
189
- 3. ํŠนํžˆ ๋„ˆ๋Š” '์ •๋ณด์„ฑ(Informative)' ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
190
- 4. ์ •๋ณด ์ œ๊ณต์— ์ดˆ์ ์„ ๋งž์ถ”์–ด ์ž‘์„ฑํ•œ๋‹ค.
191
-
192
- ##[๋ธ”๋กœ๊ทธ ์ œ๋ชฉ ์ž‘์„ฑ ๊ทœ์น™]
193
- 1. ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ 10๊ฐœ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ์ œ๋ชฉ 10๊ฐœ๋งŒ ์ถœ๋ ฅํ•˜๋ผ.
194
- 2. ์ œ๋ชฉ์€ 40์ž ์ด๋‚ด๋กœ ์ž‘์„ฑํ•˜๋ผ.
195
- 3. ์ œ๊ณต๋œ ์ฐธ๊ณ ๊ธ€์— ๋งž์ถฐ ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ 10๊ฐœ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
196
- 4. ๋ฐ˜๋“œ์‹œ ํ•ต์‹ฌํ‚ค์›Œ๋“œ(Topic)๊ฐ€ ๋ฌธ์žฅ ์•ž์ชฝ์— ๋“ค์–ด๊ฐ€๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
197
- 5. ํ•ต์‹ฌ ํ‚ค์›Œ๋“œ์™€ ์—ฐ๊ด€์„ฑ ๋†’์€ ์ฃผ์ œ๋ฅผ ํฌํ•จํ•˜์—ฌ ์ž‘์„ฑํ•˜๋ผ.
198
  """
199
  elif (category == "๊ฑด๊ฐ•์ •๋ณด"):
200
  return """
201
  # ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ ์ƒ์„ฑ ๊ทœ์น™(๊ฑด๊ฐ•์ •๋ณด)
202
- ##[๊ธฐ๋ณธ๊ทœ์น™]
203
- 1. ๋ฐ˜๋“œ์‹œ ํ•œ๊ตญ์–ด(ํ•œ๊ธ€)๋กœ ์ž‘์„ฑํ•˜๋ผ.
204
- 2. ๋„ˆ๋Š” ๊ฐ€์žฅ ์ฃผ๋ชฉ๋ฐ›๋Š” ๋งˆ์ผ€ํ„ฐ์ด๋ฉฐ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
205
- 3. ํŠนํžˆ ๋„ˆ๋Š” '๊ฑด๊ฐ•, ์˜ํ•™ ์ •๋ณด' ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํ„ฐ์ด๋‹ค.
206
- 4. ์ •ํ™•ํ•˜๊ณ  ์ „๋ฌธ์ ์ธ ์ •๋ณด ์ œ๊ณต์— ์ดˆ์ ์„ ๋งž์ถ”์–ด ์ž‘์„ฑํ•œ๋‹ค.
207
-
208
- ##[๋ธ”๋กœ๊ทธ ์ œ๋ชฉ ์ž‘์„ฑ ๊ทœ์น™]
209
- 1. ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ 10๊ฐœ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ์ œ๋ชฉ 10๊ฐœ๋งŒ ์ถœ๋ ฅํ•˜๋ผ.
210
- 2. ์ œ๋ชฉ์€ 40์ž ์ด๋‚ด๋กœ ์ž‘์„ฑํ•˜๋ผ.
211
- 3. ์ œ๊ณต๋œ ์ฐธ๊ณ ๊ธ€์— ๋งž์ถฐ ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ 10๊ฐœ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
212
- 4. ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ๋ธ”๋กœ๊ทธ ์ฃผ์ œ, ํ•ต์‹ฌํ‚ค์›Œ๋“œ(Topic)๊ฐ€ ๋ฌธ์žฅ ์•ž์ชฝ์— ๋“ค์–ด๊ฐ€๋„๋ก ์ œ๋ชฉ์„ ์ž‘์„ฑํ•˜๋ผ.
213
- 5. ์ฐธ๊ณ ๊ธ€์„ ๋ถ„์„ํ•˜์—ฌ ๋…์ž๋“ค์ด ๊ฑด๊ฐ•ํ•œ ์ƒํ™œ์„ ์œ ์ง€ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ๋ฐ˜์˜ํ•˜๋ผ.
214
  """
215
 
216
  def get_outline_prompt(category):
217
  if (category == "์ผ๋ฐ˜"):
218
  return """
219
  # ๋ธ”๋กœ๊ทธ ์†Œ์ฃผ์ œ(Subtopic) ์ƒ์„ฑ ๊ทœ์น™(์ผ๋ฐ˜)
220
- ##[๊ธฐ๋ณธ๊ทœ์น™]
221
- 1. ๋ฐ˜๋“œ์‹œ ํ•œ๊ตญ์–ด(ํ•œ๊ธ€)๋กœ ์ž‘์„ฑํ•˜๋ผ.
222
- 2. ๋„ˆ๋Š” ๊ฐ€์žฅ ์ฃผ๋ชฉ๋ฐ›๋Š” ๋งˆ์ผ€ํ„ฐ์ด๋ฉฐ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
223
- 3. ํŠนํžˆ ๋„ˆ๋Š” '์ •๋ณด์„ฑ(Informative)' ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
224
- 4. ์ •๋ณด ์ œ๊ณต์— ์ดˆ์ ์„ ๋งž์ถ”์–ด ์ž‘์„ฑํ•œ๋‹ค.
225
-
226
- ##[์†Œ์ฃผ์ œ ์ž‘์„ฑ๊ทœ์น™]
227
- 1. [๊ธฐ๋ณธ๊ทœ์น™]์„ ๊ธฐ๋ณธ ์ ์šฉํ•˜๋ผ.
228
- 2. ๋ธ”๋กœ๊ทธ ๊ธ€์„ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์†Œ์ฃผ์ œ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
229
- 3. ์ œ๊ณต๋œ ์ฐธ๊ณ ๊ธ€๊ณผ ๋ธ”๋กœ๊ทธ ์ฃผ์ œ, ์ œ๋ชฉ์„ ๋ฐ”ํƒ•์œผ๋กœ ํ•ต์‹ฌ ์ฃผ์ œ๋ฅผ ํŒŒ์•…ํ•˜์—ฌ ์†Œ์ฃผ์ œ๋ฅผ ์ƒ์„ฑํ•˜๋ผ.
230
- 4. ์ „์ฒด ๋งฅ๋ฝ์— ๋งž๊ฒŒ ์†Œ์ฃผ์ œ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
231
- 5. ์†Œ์ œ๋ชฉ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก 20์ž ๋‚ด์™ธ๋กœ ์ž‘์„ฑํ•˜๋ผ.
232
- 6. ๋…์ž๊ฐ€ ์–ป๊ณ ์ž ํ•˜๋Š” ์ •๋ณด์™€ ํฅ๋ฏธ๋กœ์šด ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋„๋ก ์†Œ์ฃผ์ œ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
233
- 7. ์†Œ์ฃผ์ œ์˜ ๋ณธ๋ก ์˜ ๋‚ด์šฉ์ด ์ถฉ๋ถ„ํžˆ ์ž‘์„ฑ๋  ์ˆ˜ ์žˆ๋Š” ์†Œ์ฃผ์ œ๋กœ ์„ค์ •ํ•˜๋ผ.
234
- 8. ๋ฐ˜๋“œ์‹œ [์†Œ์ฃผ์ œ ๊ตฌ์„ฑ]์— ๋งž๊ฒŒ ์ถœ๋ ฅํ•˜๋ผ.
235
-
236
- ##[์†Œ์ฃผ์ œ ๊ตฌ์„ฑ]
237
- 1. ๋ฐ˜๋“œ์‹œ [๋„์ž…๋ถ€] - 1๊ฐœ, [๋ณธ๋ก 1~5] - 5๊ฐœ, [๊ฒฐ๋ก ] - 1๊ฐœ๋กœ ๊ตฌ์„ฑํ•˜์—ฌ ์ถœ๋ ฅํ•˜๋ผ.
238
- 2. ๋ฐ˜๋“œ์‹œ [๋„์ž…๋ถ€]์™€ [๊ฒฐ๋ก ]์˜ ์ œ๋ชฉ์ด ์ค‘๋ณต๋˜์ง€ ์•Š๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
239
  """
240
  elif (category == "๊ฑด๊ฐ•์ •๋ณด"):
241
  return """
242
  # ๋ธ”๋กœ๊ทธ ์†Œ์ฃผ์ œ(Subtopic) ์ƒ์„ฑ ๊ทœ์น™(๊ฑด๊ฐ•์ •๋ณด)
243
- ##[๊ธฐ๋ณธ๊ทœ์น™]
244
- 1. ๋ฐ˜๋“œ์‹œ ํ•œ๊ตญ์–ด(ํ•œ๊ธ€)๋กœ ์ž‘์„ฑํ•˜๋ผ.
245
- 2. ๋„ˆ๋Š” ๊ฐ€์žฅ ์ฃผ๋ชฉ๋ฐ›๋Š” ๋งˆ์ผ€ํ„ฐ์ด๋ฉฐ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
246
- 3. ํŠนํžˆ ๋„ˆ๋Š” '๊ฑด๊ฐ•, ์˜ํ•™ ์ •๋ณด' ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํ„ฐ์ด๋‹ค.
247
- 4. ์ •ํ™•ํ•˜๊ณ  ์ „๋ฌธ์ ์ธ ์ •๋ณด ์ œ๊ณต์— ์ดˆ์ ์„ ๋งž์ถ”์–ด ์ž‘์„ฑํ•œ๋‹ค.
248
-
249
- ##[์†Œ์ฃผ์ œ ์ž‘์„ฑ๊ทœ์น™]
250
- 1. [๊ธฐ๋ณธ๊ทœ์น™]์„ ๊ธฐ๋ณธ ์ ์šฉํ•˜๋ผ.
251
- 2. ๋ธ”๋กœ๊ทธ ๊ธ€์„ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์†Œ์ฃผ์ œ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
252
- 3. ์ œ๊ณต๋œ ์ฐธ๊ณ ๊ธ€๊ณผ ๋ธ”๋กœ๊ทธ ์ฃผ์ œ, ์ œ๋ชฉ์„ ๋ฐ”ํƒ•์œผ๋กœ ํ•ต์‹ฌ ์ฃผ์ œ๋ฅผ ํŒŒ์•…ํ•˜์—ฌ ์†Œ์ฃผ์ œ๋ฅผ ์ƒ์„ฑํ•˜๋ผ.
253
- 4. ์ „์ฒด ๋งฅ๋ฝ์— ๋งž๊ฒŒ ์†Œ์ฃผ์ œ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
254
- 5. ์†Œ์ œ๋ชฉ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก 20์ž ๋‚ด์™ธ๋กœ ์ž‘์„ฑํ•˜๋ผ.
255
- 6. ๋…์ž๊ฐ€ ์–ป๊ณ ์ž ํ•˜๋Š” ์ •ํ™•ํ•œ ์ •๋ณด์™€ ๊ฑด๊ฐ•ํ•œ ์ƒํ™œ์„ ์œ ์ง€ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋„๋ก ์†Œ์ฃผ์ œ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
256
- 7. ์†Œ์ฃผ์ œ์˜ ๋ณธ๋ก ์˜ ๋‚ด์šฉ์ด ์ถฉ๋ถ„ํžˆ ์ž‘์„ฑ๋  ์ˆ˜ ์žˆ๋Š” ์†Œ์ฃผ์ œ๋กœ ์„ค์ •ํ•˜๋ผ.
257
- 8. ๋ฐ˜๋“œ์‹œ [์†Œ์ฃผ์ œ ๊ตฌ์„ฑ]์— ๋งž์ถฐ ์†Œ์ฃผ์ œ๋งŒ ์ถœ๋ ฅํ•˜๋ผ.
258
-
259
- ##[์†Œ์ฃผ์ œ ๊ตฌ์„ฑ]
260
- 1. ๋ฐ˜๋“œ์‹œ [๋„์ž…๋ถ€] - 1๊ฐœ, [๋ณธ๋ก 1~5] - 5๊ฐœ, [๊ฒฐ๋ก ] - 1๊ฐœ๋กœ ๊ตฌ์„ฑํ•˜์—ฌ ์ถœ๋ ฅํ•˜๋ผ.
261
- 2. ๋ฐ˜๋“œ์‹œ [๋„์ž…๋ถ€]์™€ [๊ฒฐ๋ก ]์˜ ์ œ๋ชฉ์ด ์ค‘๋ณต๋˜์ง€ ์•Š๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
262
  """
263
 
264
  def get_blog_post_prompt(category):
265
  if (category == "์ผ๋ฐ˜"):
266
  return """
267
  # ๋ธ”๋กœ๊ทธ ํ…์ŠคํŠธ ์ƒ์„ฑ ๊ทœ์น™(์ผ๋ฐ˜)
268
- ##[๊ธฐ๋ณธ๊ทœ์น™]
269
- 1. ๋ฐ˜๋“œ์‹œ ํ•œ๊ตญ์–ด(ํ•œ๊ธ€)๋กœ ์ž‘์„ฑํ•˜๋ผ.
270
- 2. ๋„ˆ๋Š” ๊ฐ€์žฅ ์ฃผ๋ชฉ๋ฐ›๋Š” ๋งˆ์ผ€ํ„ฐ์ด๋ฉฐ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
271
- 3. ํŠนํžˆ ๋„ˆ๋Š” '์ •๋ณด์„ฑ(Informative)' ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
272
- 4. ์ •๋ณด ์ œ๊ณต์— ์ดˆ์ ์„ ๋งž์ถ”์–ด ์ž‘์„ฑํ•œ๋‹ค.
273
-
274
- ##[ํ…์ŠคํŠธ ์ž‘์„ฑ ๊ทœ์น™]
275
- 1. ๋ฐ˜๋“œ์‹œ ์ž…๋ ฅ๋œ [์†Œ์ฃผ์ œ]์— ๋งž๊ฒŒ ํ…์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
276
- 2. ์†Œ์ฃผ์ œ์˜ [๋ณธ๋ก ] 5๊ฐœ๋ฅผ ๊ฐ๊ฐ 300์ž ์ด์ƒ์œผ๋กœ ์ž‘์„ฑํ•˜๋ผ.
277
- 3. ์†Œ์ฃผ์ œ์˜ [๋ณธ๋ก ] ์ด 300์ž ์ด์ƒ ์ƒ์„ฑ๋˜์ง€ ์•Š๋Š”๋‹ค๋ฉด, ์ „์ฒด๊ธ€์ด 2000์ž ์ด์ƒ๋˜๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
278
- 4. ์ „์ฒด ๋งฅ๋ฝ์„ ์ดํ•ดํ•˜๊ณ  ๋ฌธ์žฅ์˜ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•˜๋ผ.
279
- 5. ์ฃผ์ œ์— ๋งž๋Š” ๋‹‰๋„ค์ž„, ํŽ˜๋ฅด์†Œ๋‚˜๋ฅผ ์ ์šฉํ•˜์—ฌ ์ž‘์„ฑํ•˜๋ผ.
280
- 6. ์ œ๊ณต๋œ ์ฐธ๊ณ ๊ธ€๏ฟฝ๏ฟฝ๏ฟฝ ์–ดํˆฌ๋ฅผ ๋ฐ˜์˜ํ•˜๋˜, [ํฌ์ŠคํŒ… ์Šคํƒ€์ผ]์— ๋งž๊ฒŒ ์ ์šฉํ•˜๋ผ.
281
- 7. ์ ˆ๋Œ€๋กœ ์ฐธ๊ณ ๊ธ€์„ ํ•œ๋ฌธ์žฅ ์ด์ƒ ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅํ•˜์ง€ ๋ง ๊ฒƒ.
282
- 8. ์ฃผ์ œ์™€ ์ƒํ™ฉ์— ๋งž๋Š” ์ ์ ˆํ•œ ์–ดํœ˜๋ฅผ ์„ ํƒํ•˜๋ผ.
283
- 9. ํ•œ๊ธ€ ์–ดํœ˜์˜ ๋‚œ์ด๋„๋Š” ์‰ฝ๊ฒŒ ์ž‘์„ฑํ•˜๋ผ.
284
- 10. ์ ˆ๋Œ€ ๋ฌธ์žฅ์˜ ๋์— '๋‹ต๋‹ˆ๋‹ค'๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ๋ง ๊ฒƒ.
285
-
286
- ###[์ •๋ณด์„ฑ ๋ธ”๋กœ๊ทธ ์ž‘์„ฑ ๊ทœ์น™]
287
- 1. ๋…์ž๊ฐ€ ์–ป๊ณ ์ž ํ•˜๋Š” ์œ ์šฉํ•œ ์ •๋ณด์™€ ํฅ๋ฏธ๋กœ์šด ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
288
- 2. ๋…์ž์˜ ๊ณต๊ฐ์„ ์ด๋Œ์–ด๋‚ด๊ณ  ๊ถ๊ธˆ์ฆ์„ ํ•ด๊ฒฐํ•˜๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
289
- 3. ๋…์ž์˜ ๊ด€์‹ฌ์‚ฌ๋ฅผ ์ถฉ์กฑ์‹œํ‚ค๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
290
- 4. ๋…์ž์—๊ฒŒ ์ด๋“์ด ๋˜๋Š” ์ •๋ณด๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
291
-
292
- ##[์ œ์™ธ ๊ทœ์น™]
293
- 1. ๋ฐ˜๋“œ์‹œ ๋น„์†์–ด ๋ฐ ์š•์„ค(expletive, abusive language, slang)์€ ์ œ์™ธํ•˜๋ผ.
294
- 2. ๋ฐ˜๋“œ์‹œ ์ฐธ๊ณ ๊ธ€์˜ ๋งํฌ(URL)๋Š” ์ œ์™ธํ•˜๋ผ.
295
- 3. ์ฐธ๊ณ ๊ธ€์—์„œ '๋งํฌ๋ฅผ ํ™•์ธํ•ด์ฃผ์„ธ์š”'์™€ ๊ฐ™์€ ๋งํฌ ์ด๋™์˜ ๋ฌธ๊ตฌ๋Š” ์ œ์™ธํ•˜๋ผ.
296
- 4. ์ฐธ๊ณ ๊ธ€์— ์žˆ๋Š” ์ž‘์„ฑ์ž, ํ™”์ž, ์œ ํŠœ๋ฒ„, ๊ธฐ์ž(Writer, speaker, YouTuber, reporter)์˜ ์ด๋ฆ„, ์• ์นญ, ๋‹‰๋„ค์ž„(Name, Nkickname)์€ ๋ฐ˜๋“œ์‹œ ์ œ์™ธํ•˜๋ผ.
297
- 5. ๋ฐ˜๋“œ์‹œ ๋ฌธ์žฅ์˜ ๋๋ถ€๋ถ„์ด ์–ด์ƒ‰ํ•œ ํ•œ๊ตญ์–ด ํ‘œํ˜„์€ ์ œ์™ธํ•˜๋ผ('์˜ˆ์š”', '๋‹ต๋‹ˆ๋‹ค', 'ํ•ด์š”', 'ํ•ด์ฃผ์ฃ ', '๋์ฃ ', '๋์–ด์š”', '๊ณ ์š”' ๋“ฑ.)
298
  """
299
  elif (category == "๊ฑด๊ฐ•์ •๋ณด"):
300
  return """
301
  # ๋ธ”๋กœ๊ทธ ํ…์ŠคํŠธ ์ƒ์„ฑ ๊ทœ์น™(๊ฑด๊ฐ•์ •๋ณด)
302
- ##[๊ธฐ๋ณธ๊ทœ์น™]
303
- 1. ๋ฐ˜๋“œ์‹œ ํ•œ๊ตญ์–ด(ํ•œ๊ธ€)๋กœ ์ž‘์„ฑํ•˜๋ผ.
304
- 2. ๋„ˆ๋Š” ๊ฐ€์žฅ ์ฃผ๋ชฉ๋ฐ›๋Š” ๋งˆ์ผ€ํ„ฐ์ด๋ฉฐ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํŒ… ์ „๋ฌธ๊ฐ€์ด๋‹ค.
305
- 3. ํŠนํžˆ ๋„ˆ๋Š” '๊ฑด๊ฐ•, ์˜ํ•™ ์ •๋ณด' ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํ„ฐ์ด๋‹ค.
306
- 4. ์ •ํ™•ํ•˜๊ณ  ์ „๋ฌธ์ ์ธ ์ •๋ณด ์ œ๊ณต์— ์ดˆ์ ์„ ๋งž์ถ”์–ด ์ž‘์„ฑํ•œ๋‹ค.
307
-
308
- ##[ํ…์ŠคํŠธ ์ž‘์„ฑ ๊ทœ์น™]
309
- 1. ๋ฐ˜๋“œ์‹œ ์ž…๋ ฅ๋œ [์†Œ์ฃผ์ œ]์— ๋งž์ถฐ์„œ ํ…์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
310
- 2. ๋ฐ˜๋“œ์‹œ ์ž…๋ ฅ๋œ [์†Œ์ฃผ์ œ]๋Š” ๋ณ€๊ฒฝํ•˜์ง€ ๋ง๊ณ  ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅํ•˜๋ผ.
311
- 3. ์†Œ์ฃผ์ œ์˜ [๋„์ž…๋ถ€]๋Š” ๊ฐ€๋ณ๊ฒŒ ์ž‘์„ฑํ•˜๋˜ ๊ณต๊ฐ๊ณผ ํฅ๋ฏธ, ๋ฌธ์ œ์ œ๊ธฐ, ๊ธ€์˜ ๋ชฉ์ , ๋ณธ๋ฌธ์œผ๋กœ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ด์–ด์ง€๋Š” ์ „ํ™˜๋ฌธ์žฅ๋“ฑ์„ ์ถœ๋ ฅํ•˜๋ผ.
312
- 3. ์†Œ์ฃผ์ œ์˜ [๋ณธ๋ก ] 5๊ฐœ์˜ ๋‚ด์šฉ์ด ๊ฐ๊ฐ 500์ž ์ด์ƒ์ด ๋˜๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
313
- 4. ๋ฐ˜๋“œ์‹œ ๋„ˆ๊ฐ€ ์ž‘์„ฑํ•œ ์ „์ฒด๊ธ€์ด 2500์ž ์ด์ƒ์ด ๋˜๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
314
- 5. ์ „์ฒด ๋งฅ๋ฝ์„ ์ดํ•ดํ•˜๊ณ  ๋ฌธ์žฅ์˜ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•˜๋ผ.
315
- 6. ์ฐธ๊ณ ๊ธ€์„ ๋ฐ”ํƒ•์œผ๋กœ ์ž‘์„ฑํ•œ ๊ธ€์— ๋งž๋Š” ๋‹‰๋„ค์ž„, ํŽ˜๋ฅด์†Œ๋‚˜๋ฅผ ์ ์šฉํ•˜์—ฌ ์ž‘์„ฑํ•˜๋ผ.
316
- 7. ์–ดํˆฌ๋Š” ์ œ๊ณต๋œ ์ฐธ๊ณ ๊ธ€์˜ ์–ดํˆฌ๋ฅผ ๋ฐ˜์˜ํ•˜๋˜, '๊ฑด๊ฐ•, ์˜ํ•™ ์ •๋ณด' ์ „๋ฌธ ๋ธ”๋กœ๊ทธ ๋งˆ์ผ€ํ„ฐ๋กœ์„œ ์ž‘์„ฑํ•˜๋ผ.
317
- 8. ์ ˆ๋Œ€๋กœ ์ฐธ๊ณ ๊ธ€์„ ํ•œ๋ฌธ์žฅ ์ด์ƒ ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅํ•˜์ง€ ๋ง ๊ฒƒ.
318
- 9. ์ฃผ์ œ์™€ ์ƒํ™ฉ์— ๋งž๋Š” ์ ์ ˆํ•œ ์–ดํœ˜๋ฅผ ์„ ํƒํ•˜๋ผ.
319
-
320
- ###[์ •๋ณด์„ฑ ๋ธ”๋กœ๊ทธ ์ž‘์„ฑ ๊ทœ์น™]
321
- 1. ๋…์ž๊ฐ€ ์–ป๊ณ ์ž ํ•˜๋Š” ์ •ํ™•ํ•œ ์ •๋ณด์™€ ๊ฑด๊ฐ•ํ•œ ์ƒํ™œ์„ ์œ ์ง€ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋„๋ก ์†Œ์ฃผ์ œ์— ๋งž๊ฒŒ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜๋ผ.
322
- 2. ๋…์ž์˜ ๊ณต๊ฐ์„ ์ด๋Œ์–ด๋‚ด๊ณ  ๊ถ๊ธˆ์ฆ์„ ํ•ด๊ฒฐํ•˜๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
323
- 3. ๋…์ž์˜ ๊ด€์‹ฌ์‚ฌ๋ฅผ ์ถฉ์กฑ์‹œํ‚ค๋„๋ก ์ž‘์„ฑํ•˜๋ผ.
324
- 4. ๋…์ž์—๊ฒŒ ์ด๋“์ด ๋˜๋Š” ์ •๋ณด๋ฅผ ์ž‘์„ฑํ•˜๋ผ.
325
-
326
- ##[์ œ์™ธ ๊ทœ์น™]
327
- 1. ๋ฐ˜๋“œ์‹œ ์ฐธ๊ณ ๊ธ€์˜ ๋งํฌ(URL)๋Š” ์ œ์™ธํ•˜๋ผ.
328
- 2. ์ฐธ๊ณ ๊ธ€์—์„œ '๋งํฌ๋ฅผ ํ™•์ธํ•ด์ฃผ์„ธ์š”'์™€ ๊ฐ™์€ ๋งํฌ ์ด๋™์˜ ๋ฌธ๊ตฌ๋Š” ์ œ์™ธํ•˜๋ผ.
329
- 3. ์ฐธ๊ณ ๊ธ€์— ์žˆ๋Š” ์ž‘์„ฑ์ž, ํ™”์ž, ์œ ํŠœ๋ฒ„, ๊ธฐ์ž(Writer, speaker, YouTuber, reporter)์˜ ์ด๋ฆ„, ์• ์นญ, ๋‹‰๋„ค์ž„(Name, Nkickname)์€ ๋ฐ˜๋“œ์‹œ ์ œ์™ธํ•˜๋ผ.
330
  """
331
 
332
  def get_style_prompt(style):
@@ -515,36 +410,19 @@ with gr.Blocks() as demo:
515
 
516
  # ์ œ๋ชฉ ์ถ”์ฒœ
517
  gr.Markdown("### 4๋‹จ๊ณ„ : ์ œ๋ชฉ ์ถ”์ฒœํ•˜๊ธฐ")
518
-
519
- with gr.Accordion("์ œ๋ชฉ ์„ค์ •", open=True):
520
- title_system_message = gr.Textbox(label="์‹œ์Šคํ…œ ๋ฉ”์‹œ์ง€", value=get_title_prompt("์ผ๋ฐ˜"), lines=15)
521
- title_max_tokens = gr.Slider(label="Max Tokens", minimum=1000, maximum=8000, value=5000, step=1000)
522
- title_temperature = gr.Slider(label="Temperature", minimum=0.1, maximum=1.0, value=0.8, step=0.1)
523
- title_top_p = gr.Slider(label="Top P", minimum=0.1, maximum=1.0, value=0.95, step=0.05)
524
 
525
  title_suggestions = gr.Textbox(label="์ œ๋ชฉ ์ถ”์ฒœ", lines=10)
526
  title_token_output = gr.Markdown(label="์‚ฌ์šฉ๋œ ํ† ํฐ ์ˆ˜")
527
 
528
  # ์ œ๋ชฉ ์ถ”์ฒœ ๋ฒ„ํŠผ
529
  title_btn = gr.Button("์ œ๋ชฉ ์ถ”์ฒœํ•˜๊ธฐ")
530
- title_btn.click(fn=suggest_title, inputs=[category, style, topic, references1, references2, references3, title_system_message, style, title_max_tokens, title_temperature, title_top_p], outputs=[title_suggestions, title_token_output])
531
 
532
  blog_title = gr.Textbox(label="๋ธ”๋กœ๊ทธ ์ œ๋ชฉ", placeholder="๋ธ”๋กœ๊ทธ ์ œ๋ชฉ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”")
533
 
534
  # ๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑ
535
  gr.Markdown("### 5๋‹จ๊ณ„ : ๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑํ•˜๊ธฐ")
536
  gr.HTML("<span style='color: grey;'>[๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑํ•˜๊ธฐ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์•„์›ƒ๋ผ์ธ ์ƒ์„ฑ ๋ฐ ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž‘์„ฑ์ด ์ž๋™์œผ๋กœ ์ง„ํ–‰๋ฉ๋‹ˆ๋‹ค.]</span>")
537
-
538
- with gr.Accordion("๋ธ”๋กœ๊ทธ ๊ธ€ ์„ค์ •", open=True):
539
- outline_system_message = gr.Textbox(label="์‹œ์Šคํ…œ ๋ฉ”์‹œ์ง€", value=get_outline_prompt("์ผ๋ฐ˜"), lines=20)
540
- outline_max_tokens = gr.Slider(label="Max Tokens", minimum=1000, maximum=8000, value=6000, step=1000)
541
- outline_temperature = gr.Slider(label="Temperature", minimum=0.1, maximum=1.0, value=0.8, step=0.1)
542
- outline_top_p = gr.Slider(label="Top P", minimum=0.1, maximum=1.0, value=0.95, step=0.05)
543
-
544
- blog_system_message = gr.Textbox(label="์‹œ์Šคํ…œ ๋ฉ”์‹œ์ง€", value=get_blog_post_prompt("์ผ๋ฐ˜"), lines=20)
545
- blog_max_tokens = gr.Slider(label="Max Tokens", minimum=1000, maximum=12000, value=8000, step=1000)
546
- blog_temperature = gr.Slider(label="Temperature", minimum=0.1, maximum=1.0, value=0.8, step=0.1)
547
- blog_top_p = gr.Slider(label="Top P", minimum=0.1, maximum=1.0, value=0.95, step=0.05)
548
 
549
  outline_result = gr.Textbox(label="์•„์›ƒ๋ผ์ธ ๊ฒฐ๊ณผ", lines=15, visible=False)
550
  outline_token_output = gr.Markdown(label="์‚ฌ์šฉ๋œ ํ† ํฐ ์ˆ˜", visible=False)
@@ -555,7 +433,7 @@ with gr.Blocks() as demo:
555
  generate_post_btn = gr.Button("๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑํ•˜๊ธฐ")
556
  generate_post_btn.click(
557
  fn=fetch_references_and_generate_all_steps,
558
- inputs=[category, style, topic, blog_title, outline_system_message, outline_max_tokens, outline_temperature, outline_top_p, blog_system_message, blog_max_tokens, blog_temperature, blog_top_p],
559
  outputs=[references1, references2, references3, outline_result, outline_token_output, output, token_output]
560
  )
561
 
@@ -564,7 +442,7 @@ with gr.Blocks() as demo:
564
 
565
  save_pdf_btn.click(fn=save_content_to_pdf, inputs=[output], outputs=[pdf_output])
566
 
567
- category.change(fn=update_prompts_and_description, inputs=category, outputs=[title_system_message, outline_system_message, blog_system_message, style_description])
568
- style.change(fn=update_prompts_and_description, inputs=category, outputs=[title_system_message, outline_system_message, blog_system_message, style_description])
569
 
570
  demo.launch()
 
116
  def analyze_info(category, style, topic, references1, references2, references3):
117
  return f"์„ ํƒํ•œ ์นดํ…Œ๊ณ ๋ฆฌ: {category}\n์„ ํƒํ•œ ํฌ์ŠคํŒ… ์Šคํƒ€์ผ: {style}\n๋ธ”๋กœ๊ทธ ์ฃผ์ œ: {topic}\n์ฐธ๊ณ  ๊ธ€1: {references1}\n์ฐธ๊ณ  ๊ธ€2: {references2}\n์ฐธ๊ณ  ๊ธ€3: {references3}"
118
 
119
+ def suggest_title(category, style, topic, references1, references2, references3):
120
  full_content = analyze_info(category, style, topic, references1, references2, references3)
121
+ category_prompt = get_title_prompt(category)
122
+ style_prompt = get_style_prompt(style)
123
+ max_tokens = 5000
124
+ temperature = 0.8
125
+ top_p = 0.95
126
  combined_prompt = f"{category_prompt}\n\n{style_prompt}"
127
  modified_text, input_tokens, output_tokens, total_tokens = call_api(full_content, combined_prompt, max_tokens, temperature, top_p)
128
  token_usage_message = f"[์ž…๋ ฅ ํ† ํฐ์ˆ˜: {input_tokens}]\n[์ถœ๋ ฅ ํ† ํฐ์ˆ˜: {output_tokens}]\n[์ด ํ† ํฐ์ˆ˜: {total_tokens}]"
129
  return modified_text, token_usage_message
130
 
131
+ def generate_outline(category, style, topic, references1, references2, references3, title):
132
  full_content = analyze_info(category, style, topic, references1, references2, references3)
133
  content = f"{full_content}\nTitle: {title}"
134
+ category_prompt = get_outline_prompt(category)
135
+ style_prompt = get_style_prompt(style)
136
+ max_tokens = 6000
137
+ temperature = 0.8
138
+ top_p = 0.95
139
  combined_prompt = f"{category_prompt}\n\n{style_prompt}"
140
  modified_text, input_tokens, output_tokens, total_tokens = call_api(content, combined_prompt, max_tokens, temperature, top_p)
141
  token_usage_message = f"[์ž…๋ ฅ ํ† ํฐ์ˆ˜: {input_tokens}]\n[์ถœ๋ ฅ ํ† ํฐ์ˆ˜: {output_tokens}]\n[์ด ํ† ํฐ์ˆ˜: {total_tokens}]"
142
  return modified_text, token_usage_message
143
 
144
+ def generate_blog_post(category, style, topic, references1, references2, references3, title, outline):
145
  full_content = analyze_info(category, style, topic, references1, references2, references3)
146
  content = f"{full_content}\nTitle: {title}\nOutline: {outline}"
147
+ category_prompt = get_blog_post_prompt(category)
148
+ style_prompt = get_style_prompt(style)
149
+ max_tokens = 8000
150
+ temperature = 0.8
151
+ top_p = 0.95
152
  combined_prompt = f"{category_prompt}\n\n{style_prompt}"
153
  modified_text, input_tokens, output_tokens, total_tokens = call_api(content, combined_prompt, max_tokens, temperature, top_p)
154
  formatted_text = modified_text.replace('\n', '\n\n')
 
171
 
172
  return "์ฐธ๊ณ ๊ธ€ ์ƒ์„ฑ ์™„๋ฃŒ", references1_content, references2_content, references3_content
173
 
174
+ def fetch_references_and_generate_all_steps(category, style, topic, blog_title):
175
  search_url = generate_naver_search_url(topic)
176
  session = setup_session()
177
  if session is None:
 
187
  references3_content = f"์ œ๋ชฉ: {selected_results[2]['์ œ๋ชฉ']}\n๋‚ด์šฉ: {crawl_blog_content(selected_results[2]['๋งํฌ'], session)}"
188
 
189
  # ์•„์›ƒ๋ผ์ธ ์ƒ์„ฑ
190
+ outline_result, outline_token_usage = generate_outline(category, style, topic, references1_content, references2_content, references3_content, blog_title)
191
 
192
  # ๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑ
193
+ blog_post_result, blog_post_token_usage = generate_blog_post(category, style, topic, references1_content, references2_content, references3_content, blog_title, outline_result)
194
 
195
  return references1_content, references2_content, references3_content, outline_result, outline_token_usage, blog_post_result, blog_post_token_usage
196
 
 
198
  if (category == "์ผ๋ฐ˜"):
199
  return """
200
  # ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ ์ƒ์„ฑ ๊ทœ์น™(์ผ๋ฐ˜)
 
 
 
 
 
 
 
 
 
 
 
 
201
  """
202
  elif (category == "๊ฑด๊ฐ•์ •๋ณด"):
203
  return """
204
  # ๋ธ”๋กœ๊ทธ ์ œ๋ชฉ ์ƒ์„ฑ ๊ทœ์น™(๊ฑด๊ฐ•์ •๋ณด)
 
 
 
 
 
 
 
 
 
 
 
 
205
  """
206
 
207
  def get_outline_prompt(category):
208
  if (category == "์ผ๋ฐ˜"):
209
  return """
210
  # ๋ธ”๋กœ๊ทธ ์†Œ์ฃผ์ œ(Subtopic) ์ƒ์„ฑ ๊ทœ์น™(์ผ๋ฐ˜)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  """
212
  elif (category == "๊ฑด๊ฐ•์ •๋ณด"):
213
  return """
214
  # ๋ธ”๋กœ๊ทธ ์†Œ์ฃผ์ œ(Subtopic) ์ƒ์„ฑ ๊ทœ์น™(๊ฑด๊ฐ•์ •๋ณด)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  """
216
 
217
  def get_blog_post_prompt(category):
218
  if (category == "์ผ๋ฐ˜"):
219
  return """
220
  # ๋ธ”๋กœ๊ทธ ํ…์ŠคํŠธ ์ƒ์„ฑ ๊ทœ์น™(์ผ๋ฐ˜)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  """
222
  elif (category == "๊ฑด๊ฐ•์ •๋ณด"):
223
  return """
224
  # ๋ธ”๋กœ๊ทธ ํ…์ŠคํŠธ ์ƒ์„ฑ ๊ทœ์น™(๊ฑด๊ฐ•์ •๋ณด)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  """
226
 
227
  def get_style_prompt(style):
 
410
 
411
  # ์ œ๋ชฉ ์ถ”์ฒœ
412
  gr.Markdown("### 4๋‹จ๊ณ„ : ์ œ๋ชฉ ์ถ”์ฒœํ•˜๊ธฐ")
 
 
 
 
 
 
413
 
414
  title_suggestions = gr.Textbox(label="์ œ๋ชฉ ์ถ”์ฒœ", lines=10)
415
  title_token_output = gr.Markdown(label="์‚ฌ์šฉ๋œ ํ† ํฐ ์ˆ˜")
416
 
417
  # ์ œ๋ชฉ ์ถ”์ฒœ ๋ฒ„ํŠผ
418
  title_btn = gr.Button("์ œ๋ชฉ ์ถ”์ฒœํ•˜๊ธฐ")
419
+ title_btn.click(fn=suggest_title, inputs=[category, style, topic, references1, references2, references3], outputs=[title_suggestions, title_token_output])
420
 
421
  blog_title = gr.Textbox(label="๋ธ”๋กœ๊ทธ ์ œ๋ชฉ", placeholder="๋ธ”๋กœ๊ทธ ์ œ๋ชฉ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”")
422
 
423
  # ๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑ
424
  gr.Markdown("### 5๋‹จ๊ณ„ : ๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑํ•˜๊ธฐ")
425
  gr.HTML("<span style='color: grey;'>[๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑํ•˜๊ธฐ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์•„์›ƒ๋ผ์ธ ์ƒ์„ฑ ๋ฐ ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž‘์„ฑ์ด ์ž๋™์œผ๋กœ ์ง„ํ–‰๋ฉ๋‹ˆ๋‹ค.]</span>")
 
 
 
 
 
 
 
 
 
 
 
426
 
427
  outline_result = gr.Textbox(label="์•„์›ƒ๋ผ์ธ ๊ฒฐ๊ณผ", lines=15, visible=False)
428
  outline_token_output = gr.Markdown(label="์‚ฌ์šฉ๋œ ํ† ํฐ ์ˆ˜", visible=False)
 
433
  generate_post_btn = gr.Button("๋ธ”๋กœ๊ทธ ๊ธ€ ์ƒ์„ฑํ•˜๊ธฐ")
434
  generate_post_btn.click(
435
  fn=fetch_references_and_generate_all_steps,
436
+ inputs=[category, style, topic, blog_title],
437
  outputs=[references1, references2, references3, outline_result, outline_token_output, output, token_output]
438
  )
439
 
 
442
 
443
  save_pdf_btn.click(fn=save_content_to_pdf, inputs=[output], outputs=[pdf_output])
444
 
445
+ category.change(fn=update_prompts_and_description, inputs=category, outputs=[style_description])
446
+ style.change(fn=update_prompts_and_description, inputs=category, outputs=[style_description])
447
 
448
  demo.launch()