mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-26 11:28:29 +00:00
- Implement space assignment queue and worker for BullMQ - Add native Cypher cosine similarity function to replace GDS dependency - Make Trigger.dev environment variables optional (only required when QUEUE_PROVIDER=trigger) - Add EMBEDDING_MODEL_SIZE configuration for vector index management - Update vector search queries to use native Neo4j vector search with score - Add Neo4j utility scripts for index management and troubleshooting - Update documentation with embedding model configuration and vector index recreation steps
138 lines
2.7 KiB
TypeScript
138 lines
2.7 KiB
TypeScript
/**
|
|
* BullMQ Queues
|
|
*
|
|
* All queue definitions for the BullMQ implementation
|
|
*/
|
|
|
|
import { Queue } from "bullmq";
|
|
import { getRedisConnection } from "../connection";
|
|
|
|
/**
|
|
* Episode ingestion queue
|
|
* Handles individual episode ingestion (including document chunks)
|
|
*/
|
|
export const ingestQueue = new Queue("ingest-queue", {
|
|
connection: getRedisConnection(),
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 2000,
|
|
},
|
|
removeOnComplete: {
|
|
age: 3600, // Keep completed jobs for 1 hour
|
|
count: 1000, // Keep last 1000 completed jobs
|
|
},
|
|
removeOnFail: {
|
|
age: 86400, // Keep failed jobs for 24 hours
|
|
},
|
|
},
|
|
});
|
|
|
|
/**
|
|
* Document ingestion queue
|
|
* Handles document-level ingestion with differential processing
|
|
*/
|
|
export const documentIngestQueue = new Queue("document-ingest-queue", {
|
|
connection: getRedisConnection(),
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 2000,
|
|
},
|
|
removeOnComplete: {
|
|
age: 3600,
|
|
count: 1000,
|
|
},
|
|
removeOnFail: {
|
|
age: 86400,
|
|
},
|
|
},
|
|
});
|
|
|
|
/**
|
|
* Conversation title creation queue
|
|
*/
|
|
export const conversationTitleQueue = new Queue("conversation-title-queue", {
|
|
connection: getRedisConnection(),
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 2000,
|
|
},
|
|
removeOnComplete: {
|
|
age: 3600,
|
|
count: 1000,
|
|
},
|
|
removeOnFail: {
|
|
age: 86400,
|
|
},
|
|
},
|
|
});
|
|
|
|
/**
|
|
* Deep search queue
|
|
*/
|
|
export const deepSearchQueue = new Queue("deep-search-queue", {
|
|
connection: getRedisConnection(),
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 2000,
|
|
},
|
|
removeOnComplete: {
|
|
age: 3600,
|
|
count: 1000,
|
|
},
|
|
removeOnFail: {
|
|
age: 86400,
|
|
},
|
|
},
|
|
});
|
|
|
|
/**
|
|
* Session compaction queue
|
|
*/
|
|
export const sessionCompactionQueue = new Queue("session-compaction-queue", {
|
|
connection: getRedisConnection(),
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 2000,
|
|
},
|
|
removeOnComplete: {
|
|
age: 3600,
|
|
count: 1000,
|
|
},
|
|
removeOnFail: {
|
|
age: 86400,
|
|
},
|
|
},
|
|
});
|
|
|
|
/**
|
|
* Space assignment queue
|
|
* Handles assigning episodes to relevant spaces using AI
|
|
*/
|
|
export const spaceAssignmentQueue = new Queue("space-assignment-queue", {
|
|
connection: getRedisConnection(),
|
|
defaultJobOptions: {
|
|
attempts: 2, // Only retry once for space assignments
|
|
backoff: {
|
|
type: "exponential",
|
|
delay: 5000,
|
|
},
|
|
removeOnComplete: {
|
|
age: 3600,
|
|
count: 1000,
|
|
},
|
|
removeOnFail: {
|
|
age: 86400,
|
|
},
|
|
},
|
|
});
|