Skip to content

Commit

Permalink
feat: support showEmoji option
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 13, 2023
1 parent 2cbbb74 commit 0f0d98c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/openai/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@ export function getSystemPrompt(promptConfig: PromptConfig) {

return shouldShowTimestamp ? promptWithTimestamp : betterPrompt;
}
export function getUserSubtitlePrompt(title: string, transcript: any, videoConfig: VideoConfig) {
export function getUserSubtitlePrompt(
title: string,
transcript: any,
videoConfig: VideoConfig
) {
const videoTitle = title?.replace(/\n+/g, " ").trim();
const videoTranscript = limitTranscriptByteLength(transcript)
.replace(/\n+/g, " ")
.trim();
const language = videoConfig.outputLanguage;
const sentenceCount = videoConfig.sentenceNumber;
const prompt = `Your output should use the following template:\n### Summary\n### Highlights\n- [Emoji] Bulletpoint\n\nYour task is to summarise the text I have given you in up to ${sentenceCount} concise bullet points, starting with a short highlight. Choose an appropriate emoji for each bullet point. Use the text above: {{Title}} {{Transcript}}.\n\nReply in ${language} Language.`;
const emojiTemplateText = `${videoConfig.showEmoji ? "[Emoji] " : ""}`;
const emojiDescriptionText = `${videoConfig.showEmoji ? "Choose an appropriate emoji for each bullet point. " : ""}`;
const prompt = `Your output should use the following template:\n### Summary\n### Highlights\n- ${emojiTemplateText}Bulletpoint\n\nYour task is to summarise the text I have given you in up to ${sentenceCount} concise bullet points, starting with a short highlight. ${emojiDescriptionText}Use the text above: {{Title}} {{Transcript}}.\n\nReply in ${language} Language.`;

return `Title: "${videoTitle}"\nTranscript: "${videoTranscript}"\n\nInstructions: ${prompt}`;
}
Expand Down

1 comment on commit 0f0d98c

@vercel
Copy link

@vercel vercel bot commented on 0f0d98c Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.