Add structured podcast research cost_est across backend/frontend

This commit is contained in:
ي
2026-04-19 16:13:46 +05:30
parent bcf62017aa
commit 196ea65af9
6 changed files with 167 additions and 15 deletions

View File

@@ -130,10 +130,10 @@ export const ResearchSummary: React.FC<ResearchSummaryProps> = ({
}}
/>
)}
{research.cost !== undefined && (
{research.costEst?.total !== undefined && (
<Chip
icon={<AttachMoneyIcon sx={{ fontSize: "0.875rem !important" }} />}
label={`$${research.cost.toFixed(3)}`}
label={`$${research.costEst.total.toFixed(3)}`}
size="small"
sx={{
background: alpha("#f59e0b", 0.1),
@@ -356,4 +356,3 @@ export const ResearchSummary: React.FC<ResearchSummaryProps> = ({
</GlassyCard>
);
};

View File

@@ -33,6 +33,16 @@ export type ResearchInsight = {
source_indices: number[];
};
export type PodcastCostEst = {
total: number;
breakdown: {
phase: "Analyze" | "Gather" | "Write" | "Produce";
cost: number;
}[];
currency: "USD";
last_updated: string;
};
export type Research = {
summary: string;
keyInsights: ResearchInsight[];
@@ -45,7 +55,7 @@ export type Research = {
searchQueries?: string[];
searchType?: string;
provider?: string;
cost?: number;
costEst?: PodcastCostEst;
sourceCount?: number;
expertQuotes?: { quote: string; source_index: number }[];
listenerCta?: string[];
@@ -222,4 +232,3 @@ export type TaskStatus = {
created_at?: string;
updated_at?: string;
};