Skip to content

Commit

Permalink
fix: update the outline level=1
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyLv committed Mar 13, 2023
1 parent 3435c65 commit aa59f0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions components/PromptOptions.tsx
Expand Up @@ -62,7 +62,7 @@ export function PromptOptions({
className="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
>
要点个数
<span className="text-gray-500">({getValues("sentenceNumber")})</span>
<span className="text-gray-500">({getValues("sentenceNumber")})</span>
</label>
<input
id="sentenceNumber"
Expand All @@ -81,7 +81,7 @@ export function PromptOptions({
className="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
>
大纲层级
<span className="text-gray-500">({getValues("outlineLevel")})</span>
<span className="text-gray-500">({getValues("outlineLevel")})</span>
</label>
<input
id="outlineLevel"
Expand All @@ -100,7 +100,7 @@ export function PromptOptions({
className="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
>
详细程度
<span className="text-gray-500">({getValues("detailLevel")})</span>
<span className="text-gray-500">({getValues("detailLevel")})</span>
</label>
<input
id="detailLevel"
Expand Down
9 changes: 6 additions & 3 deletions lib/openai/prompt.ts
Expand Up @@ -48,9 +48,12 @@ export function getUserSubtitlePrompt(
.trim();
const language = videoConfig.outputLanguage;
const sentenceCount = videoConfig.sentenceNumber;
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 - Child points if need\n\nYour task is to summarise the text I have given you in up to ${sentenceCount} concise bullet points, starting with a short highlight. Use the outline list, which can have a hierarchical structure of up to ${videoConfig.outlineLevel} levels. ${emojiDescriptionText}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 shouldShowAsOutline = Number(videoConfig.outlineLevel) > 1;
const outlineTemplateText = shouldShowAsOutline ? `\n - Child points`: '';
const outlineDescriptionText = shouldShowAsOutline ? `Use the outline list, which can have a hierarchical structure of up to ${videoConfig.outlineLevel} levels. ` : '';
const prompt = `Your output should use the following template:\n### Summary\n### Highlights\n- ${emojiTemplateText}Bulletpoint${outlineTemplateText}\n\nYour task is to summarise the text I have given you in up to ${sentenceCount} concise bullet points, starting with a short highlight. ${outlineDescriptionText}${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 aa59f0a

@vercel
Copy link

@vercel vercel bot commented on aa59f0a 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.