From a1cbf358eff881d6d9468d684d339bcb76b2616a Mon Sep 17 00:00:00 2001 From: "Satsuki Akiba (aider)" Date: Wed, 4 Jun 2025 08:18:38 +0900 Subject: [PATCH] fix: fix template literal errors in llm, podcast, and tts services --- services/llm.ts | 10 +++++----- services/podcast.ts | 26 +++++++++++++------------- services/tts.ts | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/services/llm.ts b/services/llm.ts index 71217bd..02078d8 100644 --- a/services/llm.ts +++ b/services/llm.ts @@ -10,15 +10,15 @@ export async function openAI_GenerateScript(item: { link: string; contentSnippet?: string; }): Promise { - const prompt = \` + const prompt = ` あなたはポッドキャスターです。以下の情報をもとに、リスナー向けにわかりやすい日本語のポッドキャスト原稿を書いてください。 -- 記事タイトル: \${item.title} -- 記事リンク: \${item.link} -- 記事概要: \${item.contentSnippet || "なし"} +- 記事タイトル: ${item.title} +- 記事リンク: ${item.link} +- 記事概要: ${item.contentSnippet || "なし"} 「今日のニュース記事をご紹介します…」といった導入も含め、約300文字程度でまとめてください。 -\`; +`; const response = await openai.createChatCompletion({ model: "gpt-4o-mini", messages: [{ role: "user", content: prompt.trim() }], diff --git a/services/podcast.ts b/services/podcast.ts index c2811d7..d9a4709 100644 --- a/services/podcast.ts +++ b/services/podcast.ts @@ -16,28 +16,28 @@ export async function updatePodcastRSS() { ep.audioPath )}`; const pubDate = new Date(ep.pubDate).toUTCString(); - itemsXml += \` + itemsXml += ` - <![CDATA[\${ep.title}]]> + <![CDATA[${ep.title}]]> - - \${fileUrl} - \${pubDate} + + ${fileUrl} + ${pubDate} - \`; + `; } - const rssXml = \` + const rssXml = ` - <![CDATA[\${channelTitle}]]> - \${channelLink} - - \${lastBuildDate} - \${itemsXml} + <![CDATA[${channelTitle}]]> + ${channelLink} + + ${lastBuildDate} + ${itemsXml} - \`; + `; const outputPath = path.join(__dirname, "../public/podcast.xml"); fs.writeFileSync(outputPath, rssXml.trim()); diff --git a/services/tts.ts b/services/tts.ts index abf9b5a..02f4b21 100644 --- a/services/tts.ts +++ b/services/tts.ts @@ -28,7 +28,7 @@ export async function generateTTS( if (!fs.existsSync(outputDir)) { fs.mkdirSync(outputDir, { recursive: true }); } - const filePath = path.join(outputDir, \`\${itemId}.mp3\`); + const filePath = path.join(outputDir, `${itemId}.mp3`); const chunks: Uint8Array[] = []; for await (const chunk of response.AudioStream as any) {