Optimize all AI functions for efficiency and speed
- AI Tagging: batch 10 projects per API call with 3 concurrent batches (~10x faster) - New `tagProjectsBatch()` with `getAISuggestionsBatch()` for multi-project prompts - Single DB query for all projects, single anonymization pass - Compact JSON in prompts (no pretty-print) saves tokens - AI Shortlist: run STARTUP and BUSINESS_CONCEPT categories in parallel (2x faster) - AI Filtering: increase default parallel batches from 1 to 3 (3x faster) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -344,8 +344,8 @@ export async function generateShortlist(
|
||||
let totalTokens = 0
|
||||
const allErrors: string[] = []
|
||||
|
||||
// Run each category independently
|
||||
for (const cat of categories) {
|
||||
// Run categories in parallel for efficiency
|
||||
const categoryPromises = categories.map(async (cat) => {
|
||||
const catTopN = cat === 'STARTUP'
|
||||
? (startupTopN ?? topN)
|
||||
: (conceptTopN ?? topN)
|
||||
@@ -357,6 +357,12 @@ export async function generateShortlist(
|
||||
prisma,
|
||||
)
|
||||
|
||||
return { cat, result }
|
||||
})
|
||||
|
||||
const categoryResults = await Promise.all(categoryPromises)
|
||||
|
||||
for (const { cat, result } of categoryResults) {
|
||||
if (cat === 'STARTUP') {
|
||||
allRecommendations.STARTUP = result.recommendations
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user