Open JiangWeixian opened 1 year ago
hello world
Mon Mar 20 2023 08:57:49 GMT+0000 (Coordinated Universal Time)
The article explains how to use ChatGPT, an AI assistant tool, for grammar correction in article writing. It also describes how to integrate it with GitHub issues and actions. The author highlights the importance of incorporating this tool for non-native English speakers' writing workflows.
My blog website is constructed atop GitHub issues. Whenever I generate or modify an issue on GitHub, next.js
ISR automatically regenerates my website in the background. Moreover, ChatGPT is an exceptional AI assistant tool that can serve various purposes, like a search engine and language translator. As a non-native speaker of English, I intend to incorporate ChatGPT into my article writing procedure this weekend to ensure my grammar matches that of a native English speaker.
If you write articles on GitHub issues like me, you may utilize the https://github.com/JiangWeixian/actions-article-helper action in your blog repository.
DEMO:
Fortunately, ChatGPT provides an open API. Firstly, you should create an API_KEY
on the OpenAI
platform at https://platform.openai.com/account/api-keys.
The package
chatgpt
serves as a request client wrapper for the basicopen-ai
endpoint.
Now, you can submit your article content (from issue body) to ChatGPT
, allowing it to examine and rephrase it.
By default, you cannot send article content such as Hey, chatgpt help me check {{ content }} grammar
. It may not function as anticipated.
To make ChatGPT
operate as a native English speaker, you require prompts. These prompts are akin to languages (like JavaScript or Rust
) that ChatGPT
comprehends better.
Numerous prompts are available for experimentation at https://github.com/f/awesome-chatgpt-prompts.
To ensure ChatGPT
operates as a native English speaker, the article content will be sent with the accompanying prompts, with "istanbulu cok seviyom burada olmak cok guzel"
replaced with the actual article content.
The main and most difficult portion is complete. Now we may proceed further and enable it to interact with GitHub actions.
Firstly, retrieve the issue content.
Then, create a comment beneath the issue.
This works well, but not perfectly. Before publication, the issue body will undergo multiple revisions. I do not want to generate excessive comments; therefore, I need to locate the previous comment and update it.
My blog site is built on top of GitHub issues. When I create or edit my issue on GitHub,
next.js
ISR will recreate my blog site in the background. Additionally, ChatGPT is an excellent AI assistant tool that can be used for many purposes, such as a search engine and language translator. As a non-native English speaker, I plan to add ChatGPT to my article writing workflow this weekend to check my articles' grammar like a native English speaker.TL;DR
If you write articles on GitHub issues like me, you can use the https://github.com/JiangWeixian/actions-article-helper action in your blog repository.
DEMO:
ChatGPT Open API
Lucky, ChatGPT provide open-api. First you should create
API_KEY
onOpenAI
platform https://platform.openai.com/account/api-keys.Now, you can send you article content(from issue body) to
ChatGPT
, letChatGPT
to check grammar and rewrite it.By default, you can't send article content like
Hey, chatgpt help me check {{ content }} grammar
. Maybe it will not work as you expect.To make
ChatGPT
act as native English speaker, you need prompts. prompts like language(likeJavaScript or Rust
) thatChatGPT
will understand better.Theres are lots of prompts you can play with from https://github.com/f/awesome-chatgpt-prompts.
In order to make
ChatGPT
work as English native. Article content will send with the follow prompts, just replace"istanbulu cok seviyom burada olmak cok guzel"
with real article content.The main(hardest) part is complete, now we go futurter, and make it interaction with github actions.
Github Actions
First, get issue content
Then create comment under issue
That works great, but not perfect. Before issue publish, issue body will edit mutiple times. I don't wan't create too much comments, I need to find previous comment, and update it.