Fully automated wordpress blog writing using ChatGPT #4

4. 카테고리별 주제 자동 생성
4. Automatically generate topics by category

앞서 카테고리를 성공적으로 가져왔다면 가져온 카테고리 정보를 이용해 각각의 주제를 자동으로 생성해 보도록 하겠다
If we have successfully obtained the categories, we will use the obtained category information to automatically generate each topic

+ 버튼을 눌러 OpenAI를 추가하고 Action Event로는 Generate Content를 선택한다.
Press the ‘+’ button to add OpenAI, and select ‘Generate Content’ as the Action Event.

그리고 Connect 버튼을 눌러서 연결 해주면 되는데, 처음 연결하는 경우 OpenAI의 토큰을 필요로 한다. OpenAI의 토큰을 볼 수 있는 위치는 openai.com 에 접속 후 로그인을 하고 우측 상단 이름을 클릭하면 “View API Keys” 메뉴를 볼 수 있다. 그리고 “Create New Secret Key”를 눌러 생성된 API 키를 입력하면 된다. 한번 창을 닫으면 다시 볼 수 없으므로 따로 잘 저장해두도록 한다.
After that, you can simply connect by clicking the Connect button, but if it’s the first time connecting, you’ll need OpenAI’s token. To view OpenAI’s token, log in to openai.com, click your name in the upper right corner, and select the ‘View API Keys’ menu. Then, click ‘Create New Secret Key’ and enter the generated API key. Make sure to save the API key in a safe place, as it won’t be visible again once you close the window.

연결을 성공했다면 다음과 같이 입력한다.
If the connection is successful, enter the following

모델은 text-davinci-003 모델을 선택한다. 다른 모델들도 선택할 수 있으나, 가장 최근 사용되고 있는 알고리즘이며, 결과물의 퀄리티가 가장 좋다.
Select the text-davinci-003 model. Although other models can be selected, it is the most recently used algorithm and produces the highest quality results

프롬프트로는 카테고리별로 1개의 블로그 타이틀을 추천할 수 있도록 질의하였다.
The prompt asked for a recommendation of one blog title for each category

질의 과정에서 위의 airtable에서 받아온 카테고리를 loop 할 수 있도록 “2. Records 0 Fields Category Name: 카테고리” 로 변수를 입력하였으며, loop 가 실행되는 동안 자동으로 번호가 붙는 것을 방지하기 위해 “without numbering” 명령을 추가 하였다.
To enable looping of the categories obtained from the airtable in the query process, the variable was input as ‘2. Records 0 Fields Category Name: category’. The ‘without numbering’ command was added to prevent automatic numbering during the loop execution.

제목은 지나치게 길 필요가 없으므로, max tokens 은 1,000을 입력하였으며, 나머지 값들은 기본값으로 둔다.
the title does not need to be overly long, max tokens were set to 1,000, and the remaining values were left at their default settings

이후, “Save and send test request” 버튼을 눌러 정상적으로 제목을 가져오는지 확인한다.
Next, press the ‘Save and send test request’ button to verify that the title is retrieved correctly

제목을 가져오는데 실패할 시 불필요한 credit 사용을 방지하기 위해 filter 를 통해 제목칸이 비어 있지 않은지 검사한 후 다음 단계로 이동할 수 있도록 추가한다.
To prevent unnecessary credit usage in case of a failure to retrieve the title, add a filter to verify that the title field is not empty. This will allow you to proceed to the next step

이후, 이미 생성된 제목은 아닌지 검사하기 위해 기존의 Airtable을 추가하고, Airtable에 등록된 제목인지를 확인한 후 새로운 제목일 경우에만 다음 단계로 진행토록 검색한다.
Afterward, add the existing Airtable to check if the title has already been generated, and search for the next step only if it is a new title by verifying if it is registered in the Airtable

검색 후 결과값(Response)이 null(공백)일 경우에만 신규 제목으로 간주하고 다음단계를 진행할 수 있도록 Filter를 추가해준다.
After the search, add a filter to allow the next step only if the response value is null (blank), considering it as a new title

다음 시간에는 각 주제별로 콘텐츠를 생성해 주는 것을 진행하도록 하겠다.
In the next session, we will proceed with generating content for each topic.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

*