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