feat: fix typescript errors
This commit is contained in:
@ -14,7 +14,6 @@ export default function EpisodePlayer() {
|
|||||||
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [isPlaying, setIsPlaying] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchEpisodes();
|
fetchEpisodes();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Parser from "rss-parser";
|
import Parser from "rss-parser";
|
||||||
import {
|
import {
|
||||||
openAI_ClassifyFeed,
|
openAI_ClassifyFeed,
|
||||||
openAI_GeneratePodcastContent
|
openAI_GeneratePodcastContent,
|
||||||
} from "../services/llm";
|
} from "../services/llm";
|
||||||
import { generateTTS } from "../services/tts";
|
import { generateTTS } from "../services/tts";
|
||||||
import { saveEpisode, markAsProcessed } from "../services/database";
|
import { saveEpisode, markAsProcessed } from "../services/database";
|
||||||
@ -52,7 +52,7 @@ async function main() {
|
|||||||
const yesterday = new Date();
|
const yesterday = new Date();
|
||||||
yesterday.setDate(yesterday.getDate() - 1);
|
yesterday.setDate(yesterday.getDate() - 1);
|
||||||
|
|
||||||
const yesterdayItems = feed.items.filter(item => {
|
const yesterdayItems = feed.items.filter((item) => {
|
||||||
const pub = new Date(item.pubDate || "");
|
const pub = new Date(item.pubDate || "");
|
||||||
return (
|
return (
|
||||||
pub.getFullYear() === yesterday.getFullYear() &&
|
pub.getFullYear() === yesterday.getFullYear() &&
|
||||||
@ -68,18 +68,31 @@ async function main() {
|
|||||||
|
|
||||||
// ポッドキャスト原稿生成
|
// ポッドキャスト原稿生成
|
||||||
console.log(`ポッドキャスト原稿生成開始: ${feedTitle}`);
|
console.log(`ポッドキャスト原稿生成開始: ${feedTitle}`);
|
||||||
const podcastContent = await openAI_GeneratePodcastContent(feedTitle, yesterdayItems);
|
const validItems = yesterdayItems.filter((item): item is FeedItem => {
|
||||||
|
return !!item.title && !!item.link;
|
||||||
|
});
|
||||||
|
const podcastContent = await openAI_GeneratePodcastContent(
|
||||||
|
feedTitle,
|
||||||
|
validItems,
|
||||||
|
);
|
||||||
|
|
||||||
// トピックごとの統合音声生成
|
// トピックごとの統合音声生成
|
||||||
const feedUrlHash = crypto.createHash("md5").update(url).digest("hex");
|
const feedUrlHash = crypto.createHash("md5").update(url).digest("hex");
|
||||||
const categoryHash = crypto.createHash("md5").update(category).digest("hex");
|
const categoryHash = crypto
|
||||||
const uniqueFilename = `${feedUrlHash}-${categoryHash}.mp3`;
|
.createHash("md5")
|
||||||
|
.update(category)
|
||||||
|
.digest("hex");
|
||||||
|
const uniqueFilename = `${feedUrlHash}-${categoryHash}.wav`;
|
||||||
|
|
||||||
const audioFilePath = await generateTTS(uniqueFilename, podcastContent);
|
const audioFilePath = await generateTTS(uniqueFilename, podcastContent);
|
||||||
console.log(`音声ファイル生成完了: ${audioFilePath}`);
|
console.log(`音声ファイル生成完了: ${audioFilePath}`);
|
||||||
|
|
||||||
// エピソードとして保存(各フィードにつき1つの統合エピソード)
|
// エピソードとして保存(各フィードにつき1つの統合エピソード)
|
||||||
const firstItem = yesterdayItems[0];
|
const firstItem = yesterdayItems[0];
|
||||||
|
if (!firstItem) {
|
||||||
|
console.warn("アイテムが空です");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const pub = new Date(firstItem.pubDate || "");
|
const pub = new Date(firstItem.pubDate || "");
|
||||||
|
|
||||||
await saveEpisode({
|
await saveEpisode({
|
||||||
|
Reference in New Issue
Block a user