apps/web/src/lib/mediaSearch.ts
1/** Format-specific requests filter the existing Pinecone catalogue instead of substituting articles. */
2export function mediaTypeFilter(
3 message: string,
4): { type: { $in: string[] } } | undefined {
5 const types: string[] = []
6 if (/\b(?:reports?|research|whitepapers?)\b/i.test(message))
7 types.push('report', 'research')
8 if (/\bwebinars?\b/i.test(message)) types.push('webinar')
9 if (/\bpodcasts?\b/i.test(message)) types.push('podcast')
10 if (/\bvideos?\b/i.test(message)) types.push('video')
11 return types.length ? { type: { $in: types } } : undefined
12}
13