fixes!
This commit is contained in:
@@ -37,6 +37,7 @@ Rules:
|
|||||||
- Each "reason" should briefly explain why the ${mediaLabel} matches the preferences
|
- Each "reason" should briefly explain why the ${mediaLabel} matches the preferences
|
||||||
- Avoid duplicates
|
- Avoid duplicates
|
||||||
- Include ${mediaLabelPlural} from different decades, countries${mediaType === 'tv_show' ? ', and networks' : ', and directors'}
|
- Include ${mediaLabelPlural} from different decades, countries${mediaType === 'tv_show' ? ', and networks' : ', and directors'}
|
||||||
|
- The "title" field must contain ONLY the exact title name — no years, descriptions, network names, episode counts, or parenthetical notes. ✗ Bad: "Breaking Bad (2008–2013, AMC)" ✓ Good: "Breaking Bad"
|
||||||
- Aim for ${brainstormCount} candidates minimum${previousFullMatches.length > 0 ? '\n- Do NOT suggest titles already in the Previous Full Matches list — generate NEW candidates inspired by what made those successful' : ''}${hardRequirements ? '\n\nIMPORTANT: Strictly follow ALL requirements. Exclude any candidate that does not meet every stated requirement.' : ''}`,
|
- Aim for ${brainstormCount} candidates minimum${previousFullMatches.length > 0 ? '\n- Do NOT suggest titles already in the Previous Full Matches list — generate NEW candidates inspired by what made those successful' : ''}${hardRequirements ? '\n\nIMPORTANT: Strictly follow ALL requirements. Exclude any candidate that does not meet every stated requirement.' : ''}`,
|
||||||
input: `Structured preferences:
|
input: `Structured preferences:
|
||||||
Liked ${mediaLabelPlural}: ${input.liked.join(', ') || '(none)'}
|
Liked ${mediaLabelPlural}: ${input.liked.join(', ') || '(none)'}
|
||||||
|
|||||||
@@ -121,12 +121,13 @@ async function runSubPipeline(ctx: SubPipelineCtx): Promise<CuratorOutput[]> {
|
|||||||
runRanking(interpreterOutput, { candidates: bucket }, mediaType, useHardRequirements)
|
runRanking(interpreterOutput, { candidates: bucket }, mediaType, useHardRequirements)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
const dedupTitles = (titles: string[]) => [...new Map(titles.map((t) => [t.toLowerCase(), t])).values()];
|
||||||
const rankingOutput: RankingOutput = {
|
const rankingOutput: RankingOutput = {
|
||||||
full_match: rankingBuckets.flatMap((r) => r.full_match),
|
full_match: dedupTitles(rankingBuckets.flatMap((r) => r.full_match)),
|
||||||
definitely_like: rankingBuckets.flatMap((r) => r.definitely_like),
|
definitely_like: dedupTitles(rankingBuckets.flatMap((r) => r.definitely_like)),
|
||||||
might_like: rankingBuckets.flatMap((r) => r.might_like),
|
might_like: dedupTitles(rankingBuckets.flatMap((r) => r.might_like)),
|
||||||
questionable: rankingBuckets.flatMap((r) => r.questionable),
|
questionable: dedupTitles(rankingBuckets.flatMap((r) => r.questionable)),
|
||||||
will_not_like: rankingBuckets.flatMap((r) => r.will_not_like),
|
will_not_like: dedupTitles(rankingBuckets.flatMap((r) => r.will_not_like)),
|
||||||
};
|
};
|
||||||
log(recId, `${stagePrefix}Ranking: done (${Date.now() - t2}ms) — ${rankBucketCount} buckets`, {
|
log(recId, `${stagePrefix}Ranking: done (${Date.now() - t2}ms) — ${rankBucketCount} buckets`, {
|
||||||
full_match: rankingOutput.full_match.length,
|
full_match: rankingOutput.full_match.length,
|
||||||
@@ -163,7 +164,7 @@ async function runSubPipeline(ctx: SubPipelineCtx): Promise<CuratorOutput[]> {
|
|||||||
runCurator(ranking, interpreterOutput, mediaType, useWebSearch)
|
runCurator(ranking, interpreterOutput, mediaType, useWebSearch)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const curatorOutput = curatorBucketOutputs.flat();
|
const curatorOutput = curatorBucketOutputs.reduce((acc, bucket) => mergeCuratorOutputs(acc, bucket), [] as CuratorOutput[]);
|
||||||
log(recId, `${stagePrefix}Curator: done (${Date.now() - t3}ms) — ${curatorOutput.length} items curated (${curatorBucketCount} buckets)`);
|
log(recId, `${stagePrefix}Curator: done (${Date.now() - t3}ms) — ${curatorOutput.length} items curated (${curatorBucketCount} buckets)`);
|
||||||
sseWrite({ stage: p('curator'), status: 'done', data: curatorOutput });
|
sseWrite({ stage: p('curator'), status: 'done', data: curatorOutput });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user