From 715b63195c97176875cae261f8bc61621618e119 Mon Sep 17 00:00:00 2001 From: Satsuki Akiba Date: Mon, 9 Jun 2025 09:29:40 +0900 Subject: [PATCH] Update llm.ts --- services/llm.ts | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/services/llm.ts b/services/llm.ts index 6e0fcb4..313ecb4 100644 --- a/services/llm.ts +++ b/services/llm.ts @@ -106,29 +106,29 @@ export async function openAI_GeneratePodcastContent( const prompt = ` あなたはプロのポッドキャスタです。以下に示すフィードタイトルに基づき、そのトピックに関する詳細なポッドキャスト原稿を作成してください。 -フィードタイトル: ${title} - -関連するニュース記事: -${articleDetails} - 以下の要件を満たしてください: -1. もし英単語が含まれている場合は、すべてカタカナに変換してください (例: "Google" → "グーグル") -2. もし英語の文が含まれている場合は、すべて日本語に翻訳してください -3. 各ニュース記事の具体的な内容を基に詳細な要約と解説を行ってください -4. 記事の内容から重要なポイントを抽出し、視聴者にとっての価値や興味ポイントを解説してください -5. 約1000文字〜5000文字程度の長さにしてください -6. 自然な日本語の口語表現を使ってください -7. トピック全体のまとめで締めくくってください -8. 各ニュース記事のタイトルを全て日本語に翻訳して、冒頭で紹介してください +- もし英単語が含まれている場合は、**必ずすべてカタカナに変換**してください (例: "Google" → "グーグル") +- もし英語の文が含まれている場合は、すべて日本語に翻訳してください +- 各ニュース記事の具体的な内容を基に詳細な要約と解説を行ってください +- 約1000文字〜5000文字程度の長さにしてください +- 自然な日本語の口語表現を使ってください +- トピック全体のまとめで締めくくってください +- 各ニュース記事のタイトルを全て日本語に翻訳して、冒頭で紹介してください -記事の実際の内容を活用して、具体的で価値のあるポッドキャスト原稿を作成してください。 +記事の実際の内容を活用して、価値のあるポッドキャスト原稿を作成してください。 +`; + + const sendContent = ` + フィードタイトル: ${title} + 関連するニュース記事: +${articleDetails} `; try { const response = await openai.chat.completions.create({ model: config.openai.modelName, - messages: [{ role: "user", content: prompt.trim() }], - temperature: 0.7, + messages: [{ role: "system", content: prompt.trim() }, {role:"user", content: sendContent.trim()}], + temperature: 0.6, }); const scriptText = response.choices[0]?.message?.content?.trim(); @@ -171,9 +171,7 @@ export async function openAI_ClassifyEpisode( } const prompt = ` -以下のポッドキャストエピソードの情報を見て、適切なトピックカテゴリに分類してください。 - -${textForClassification} +ポッドキャストエピソードの情報を見て、適切なトピックカテゴリに分類してください。 以下のカテゴリから1つを選択してください: - テクノロジー @@ -193,7 +191,7 @@ ${textForClassification} try { const response = await openai.chat.completions.create({ model: config.openai.modelName, - messages: [{ role: "user", content: prompt.trim() }], + messages: [{ role: "system", content: prompt.trim() }, {role: "user", content: textForClassification.trim()}], temperature: 0.3, });