INNER CODE UNIT · TypeScript
getContentGenerationModel
miantiao-me/hacker-podcast · workflow/index.ts:28
function getContentGenerationModel(ctx: WorkflowContext, attempt: number): string {
if (ctx.env.OPENAI_THINKING_MODEL && attempt <= 2) {
return ctx.env.OPENAI_THINKING_MODEL
}
return ctx.env.OPENAI_MODEL
}
async function getTopStories(today: string, isDev: boolean, step: WorkflowStep, env: Env): Promise<Story[]> {
return await step.do(stepNames.topStories(today), retryConfig, async () => {
const topStories = await getHackerNewsTopStories(today, env)
if (!topStories.length) {
throw new Error('no stories found')
}
topStories.length = Math.min(topStories.length, isDev ? 1 : 10)