diff --git a/surfsense_web/components/tool-ui/generate-podcast.tsx b/surfsense_web/components/tool-ui/generate-podcast.tsx
index e11273e41..459307cb6 100644
--- a/surfsense_web/components/tool-ui/generate-podcast.tsx
+++ b/surfsense_web/components/tool-ui/generate-podcast.tsx
@@ -10,6 +10,7 @@ import {
clearActivePodcastTaskId,
setActivePodcastTaskId,
} from "@/lib/chat/podcast-state";
+import type { PodcastTranscriptEntry } from "@/contracts/types/podcast.types";
/**
* Type definitions for the generate_podcast tool
@@ -51,7 +52,7 @@ function PodcastGeneratingState({ title }: { title: string }) {
{/* Animated rings */}
-
+
{title}
@@ -112,14 +113,6 @@ function AudioLoadingState({ title }: { title: string }) {
);
}
-/**
- * Transcript entry type from the database
- */
-interface TranscriptEntry {
- speaker_id: number;
- dialog: string;
-}
-
/**
* Podcast Player Component - Fetches audio and transcript with authentication
*/
@@ -135,7 +128,7 @@ function PodcastPlayer({
durationMs?: number;
}) {
const [audioSrc, setAudioSrc] = useState
(null);
- const [transcript, setTranscript] = useState(null);
+ const [transcript, setTranscript] = useState(null);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState(null);
const objectUrlRef = useRef(null);
@@ -181,7 +174,7 @@ function PodcastPlayer({
// Set transcript from podcast details
if (podcastDetails?.podcast_transcript) {
- setTranscript(podcastDetails.podcast_transcript as TranscriptEntry[]);
+ setTranscript(podcastDetails.podcast_transcript);
}
} finally {
clearTimeout(timeoutId);
diff --git a/surfsense_web/contracts/types/podcast.types.ts b/surfsense_web/contracts/types/podcast.types.ts
index 7bc5faece..dc7c35ba4 100644
--- a/surfsense_web/contracts/types/podcast.types.ts
+++ b/surfsense_web/contracts/types/podcast.types.ts
@@ -1,12 +1,17 @@
import { z } from "zod";
import { paginationQueryParams } from ".";
+export const podcastTranscriptEntry = z.object({
+ speaker_id: z.number(),
+ dialog: z.string(),
+});
+
export const podcast = z.object({
id: z.number(),
title: z.string(),
created_at: z.string(),
file_location: z.string(),
- podcast_transcript: z.array(z.any()),
+ podcast_transcript: z.array(podcastTranscriptEntry),
search_space_id: z.number(),
chat_state_version: z.number().nullable(),
});
@@ -41,6 +46,7 @@ export const getPodcastsRequest = z.object({
queryParams: paginationQueryParams.nullish(),
});
+export type PodcastTranscriptEntry = z.infer;
export type GeneratePodcastRequest = z.infer;
export type GetPodcastByChatIdRequest = z.infer;
export type GetPodcastByChatIdResponse = z.infer;