Skip to content
Merged
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 @@ -43,3 +43,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

# ── Import options ──────────────────────────────────────────────────
# Automatically trigger AI categorization after a successful import.
# AUTO_CATEGORIZE_AFTER_IMPORT=true
11 changes: 11 additions & 0 deletions app/api/import/twitter/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,16 @@ 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') {
const origin = request.nextUrl.origin
void fetch(`${origin}/api/categorize`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ force: false }),
}).catch(() => { /* best-effort */ })
}

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