»Ë»Ñ Æ÷·³
IT °³¹ßÀÚ°£ Á¤º¸¸¦ °øÀ¯ÇÏ°í ³íÀÇ°¡ ÀÌ·ç¾îÁö´Â °ø°£ÀÔ´Ï´Ù.

ChatGPT¿Í Wordpress API¸¦ ÀÌ¿ëÇؼ­ ºí·Î±× ÀÚµ¿À¸·Î ¸¸µé¾îÁÖ´Â ÇÁ·Î±×·¥ ¸¸µé¾ú½À´Ï´Ù. ÇÁ·ÒÇÁÆ® °ø°³

  • ÀÏõI
  • µî·ÏÀÏ 2023-04-14 22:47
  • Á¶È¸¼ö 1069
ChatGPT API¸¦ È£ÃâÇÏ´Â ·ÎÁ÷À» ¾Æ·¡¿Í °°ÀÌ ÇÔ¼ö·Î ¸¸µé°í
      def runChatGPT003(prompt, mt):
openai.api_key = AccessKey.chatgpt_key

response = openai.Completion.create(
model="text-davinci-003",
prompt=prompt,
temperature=0.7,
max_tokens=mt,
n=1,
stop=None,
)

return response.choices[0].text.strip()

 

Topic¿¡ ´ëÇÑ Category ¸¸µé¾îÁà´Â ´ÙÀ½ ÇÁ·ÒÇÁÆ® »ç¿ëÇß½À´Ï´Ù.

 

      def genCategory(topic_name, num, db_name):

if fetchTopicExistToGen(topic_name, db_name):
prompt_temp = f"Select {num} categories for a blog in CSV format without numbering. The topic of blog is"
prompt = prompt_temp + " " + topic_name

 

±×¸®°í °¢ Ä«Å×°í¸®¿¡ ´ëÇÑ ±Û Á¦¸ñ ¸¸µé¾îÁà´Â ´ÙÀ½ ÇÁ·ÒÇÁÆ® »ç¿ëÇÏ°í¿ä

 

      def genArticle(topic_name, cate_name, num, db_name):
if fetchCateExistToGen(topic_name, cate_name, db_name):
prompt_temp = \
f"Generate {num} articles titles for a blog" \
"Titles are seperated by comma. " \
"The topic of the blog is"
prompt = prompt_temp + " " + topic_name + " of " + cate_name + "."

 

¸¶Áö¸·À¸·Î ±ÛÀ» ½áÁà´Â ´ÙÀ½ ÇÁ·ÒÇÁÆ®¸¦ »ç¿ëÇß½À´Ï´Ù.

±¸Ã¼ÀûÀ¸·Î Àû¾î¾ß ±æ°Ô ÀÛ¼ºÇØÁÖ´õ¶ó±¸¿ä

 

      def fillArticleDB(dbname):
# Filling Article Text
rows = fetchArticleNoText(dbname)

count = len(rows)
index = 0
for article in rows:
(topic_name, category_name, article_name) = article

prompt = f"I am going to write a blog post. The post is consist of 12 to 15 paragraph. " \
f"The first is introduction paragraph. The last is conclusion paragraph. " \
f"The middle is body paragraph. Each paragraph is consist of 10 to 15 sentences. " \
f"The topic of the blog post is \"{article_name}\". " \
f"Write the blog post in markdown format in detail as possible."

 

ÀÌ °á°ú¸¦ DB¿¡ ½×°í WordPress API¸¦ ÀÌ¿ëÇؼ­ ÀÚµ¿ Æ÷½ºÆÃÇÑ °á°úÀÔ´Ï´Ù.

 

My Lovely Dogs

0
ÃßõÇϱ⠴ٸ¥ÀÇ°ß 0
ºÏ¸¶Å©¹öÆ° °øÀ¯¹öÆ°
  • ¾Ë¸² ¿å¼³, »óó ÁÙ ¼ö ÀÖ´Â ¾ÇÇÃÀº »ï°¡ÁÖ¼¼¿ä.
©¹æ »çÁø  
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û