Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ DATABASE_URL="file:./prisma/dev.db"
# Recommended when exposing Siftly via a public URL (e.g. Cloudflare Tunnel).
# SIFTLY_USERNAME=admin
# SIFTLY_PASSWORD=your-passphrase-here

# Optional: automatically trigger AI categorization after a successful import.
# Set to 'true' to enable.
# AUTO_CATEGORIZE_AFTER_IMPORT=true
10 changes: 10 additions & 0 deletions app/api/import/twitter/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,15 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
)
}

// Opt-in: trigger categorization in background after a successful import.
// Enable by setting AUTO_CATEGORIZE_AFTER_IMPORT=true in the environment.
if (imported > 0 && process.env.AUTO_CATEGORIZE_AFTER_IMPORT === 'true') {
void fetch('http://localhost:3000/api/categorize', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ force: false }),
}).catch(() => { /* best-effort */ })
}

return NextResponse.json({ imported, skipped })
}