From b4c44e7622357e510d589870d67404ac99bef94f Mon Sep 17 00:00:00 2001 From: Omer Sabic Date: Thu, 13 Jun 2024 14:44:55 +0200 Subject: [PATCH] fix createBlogFromCaptions function default values --- src/utils/ai.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/utils/ai.js b/src/utils/ai.js index 78ec1ae..8b0d0b8 100644 --- a/src/utils/ai.js +++ b/src/utils/ai.js @@ -71,13 +71,14 @@ async function promptGPT(prompt, { model, is_json } = { model: "gpt-3.5-turbo", export async function createBlogFromCaptions(captions, { title, description -}, { - length, - language, - format, - tone, - faq -} = { length: 700, language: "English", format: "summary", tone: "informal", faq: false }) { +}, options = {}) { + const { + length, + language, + format, + tone, + faq + } = Object.assign({ length: 700, language: "English", format: "summary", tone: "informal", faq: false }, options); // const prompt = `Convert the following video transcript into a blog post. The approximate length should be around ${length || 500} characters, written in ${language || "English"}. The desired format of the blog post is a ${format || "summary"}. Please ensure the blog post has a ${tone || "informal"} tone throughout. Use markdown to format the article. You must always respond in the following json fromat: {"title": string, "content": string, "seo_friendly_slug": string}. \nHere is the transcript: ` // const prompt = `Convert the following video transcript into an engaging blog post. You must always respond in the following json fromat: {"title": string, "body": string, "seo_friendly_slug": string}. Do not, under any circumstance, include the title inside the body, it should only be reserved for the body of the article. Use markdown to format the article. Use "\\n" to add line-breaks. \nHere is the transcript: `;