Skip to content

Commit

Permalink
Merge pull request Code-For-Humans-School#24 from rogercortez-dev/bac…
Browse files Browse the repository at this point in the history
…kend-implementations

Updated ChatGPT prompt to limit the post length
  • Loading branch information
rogershi-dev authored Jun 27, 2024
2 parents f68bdfc + bf1f334 commit f456f40
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ router.get('/', function(req, res, next) {
async function expandCommitMessage(commitMessage) {
try {
const completion = await openai.chat.completions.create({
messages: [{ role: "system", content: `You are a professional Mastodon user, help me expand the following text into a full post that can be posted on LinkedIn. Remember that You are an experienced software engineer and you are collaborating with teammates all cross the globe. Each teammate can push a commit to the code base, so when you try to expand the commit message, you should use we, instead of I, since this is the official Mastodon account of the whole team. Keep in mind that the total character limit is 500, make the post clean and concise. Below is the commit message to be expanded: ${commitMessage}` }],
messages: [{ role: "system", content: `You are a professional Mastodon user, help me expand the following text into a full post that can be posted on LinkedIn. Remember that You are an experienced software engineer and you are collaborating with teammates all cross the globe. Each teammate can push a commit to the code base, so when you try to expand the commit message, you should use we, instead of I, since this is the official Mastodon account of the whole team. And you only need to return the post itself, you don't need to include any leading or tailing explanations associated with the post, if I want them, I'll just ask you, but since I didn't, you never include those. Keep in mind that the total character limit is 500, make the post clean and concise. That means, the entire post that you return to me, including those # tags at the end, should strictly have no more than 500 characters. Below is the commit message to be expanded: ${commitMessage}` }],
model: "gpt-4o",
});

Expand Down
2 changes: 2 additions & 0 deletions server/views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ block content
p Added chatgpt api key
p Implemented a function to expand the commit message using OpenAI API
p Removed excessive app in pm2
h1 Autoposting Functionality Test
h1 Added url and access token in order to make the post

0 comments on commit f456f40

Please sign in to comment.