- Move IndexingPipeline.run() into Worker Threads via WorkerPool - Add dedicated embedding worker thread with single model instance - Add stage/stageDetail columns to indexing_jobs schema - Create ProgressBroadcaster for SSE channel management - Add SSE endpoints: GET /api/v1/jobs/:id/stream, GET /api/v1/jobs/stream - Replace UI polling with EventSource on repo detail and admin pages - Add concurrency settings UI and API endpoint - Build worker entries separately via esbuild
144 lines
3.7 KiB
TypeScript
144 lines
3.7 KiB
TypeScript
export interface IndexingJobEntityProps {
|
|
id: string;
|
|
repository_id: string;
|
|
version_id: string | null;
|
|
status: 'queued' | 'running' | 'paused' | 'cancelled' | 'done' | 'failed';
|
|
progress: number;
|
|
total_files: number;
|
|
processed_files: number;
|
|
stage: string;
|
|
stage_detail: string | null;
|
|
error: string | null;
|
|
started_at: number | null;
|
|
completed_at: number | null;
|
|
created_at: number;
|
|
}
|
|
|
|
export class IndexingJobEntity {
|
|
id: string;
|
|
repository_id: string;
|
|
version_id: string | null;
|
|
status: 'queued' | 'running' | 'paused' | 'cancelled' | 'done' | 'failed';
|
|
progress: number;
|
|
total_files: number;
|
|
processed_files: number;
|
|
stage: string;
|
|
stage_detail: string | null;
|
|
error: string | null;
|
|
started_at: number | null;
|
|
completed_at: number | null;
|
|
created_at: number;
|
|
|
|
constructor(props: IndexingJobEntityProps) {
|
|
this.id = props.id;
|
|
this.repository_id = props.repository_id;
|
|
this.version_id = props.version_id;
|
|
this.status = props.status;
|
|
this.progress = props.progress;
|
|
this.total_files = props.total_files;
|
|
this.processed_files = props.processed_files;
|
|
this.stage = props.stage;
|
|
this.stage_detail = props.stage_detail;
|
|
this.error = props.error;
|
|
this.started_at = props.started_at;
|
|
this.completed_at = props.completed_at;
|
|
this.created_at = props.created_at;
|
|
}
|
|
}
|
|
|
|
export interface IndexingJobProps {
|
|
id: string;
|
|
repositoryId: string;
|
|
versionId: string | null;
|
|
status: 'queued' | 'running' | 'paused' | 'cancelled' | 'done' | 'failed';
|
|
progress: number;
|
|
totalFiles: number;
|
|
processedFiles: number;
|
|
stage: string;
|
|
stageDetail: string | null;
|
|
error: string | null;
|
|
startedAt: Date | null;
|
|
completedAt: Date | null;
|
|
createdAt: Date;
|
|
}
|
|
|
|
export class IndexingJob {
|
|
id: string;
|
|
repositoryId: string;
|
|
versionId: string | null;
|
|
status: 'queued' | 'running' | 'paused' | 'cancelled' | 'done' | 'failed';
|
|
progress: number;
|
|
totalFiles: number;
|
|
processedFiles: number;
|
|
stage: string;
|
|
stageDetail: string | null;
|
|
error: string | null;
|
|
startedAt: Date | null;
|
|
completedAt: Date | null;
|
|
createdAt: Date;
|
|
|
|
constructor(props: IndexingJobProps) {
|
|
this.id = props.id;
|
|
this.repositoryId = props.repositoryId;
|
|
this.versionId = props.versionId;
|
|
this.status = props.status;
|
|
this.progress = props.progress;
|
|
this.totalFiles = props.totalFiles;
|
|
this.processedFiles = props.processedFiles;
|
|
this.stage = props.stage;
|
|
this.stageDetail = props.stageDetail;
|
|
this.error = props.error;
|
|
this.startedAt = props.startedAt;
|
|
this.completedAt = props.completedAt;
|
|
this.createdAt = props.createdAt;
|
|
}
|
|
}
|
|
|
|
export interface IndexingJobDtoProps {
|
|
id: string;
|
|
repositoryId: string;
|
|
versionId: string | null;
|
|
status: 'queued' | 'running' | 'paused' | 'cancelled' | 'done' | 'failed';
|
|
progress: number;
|
|
totalFiles: number;
|
|
processedFiles: number;
|
|
stage: string;
|
|
stageDetail: string | null;
|
|
error: string | null;
|
|
startedAt: Date | null;
|
|
completedAt: Date | null;
|
|
createdAt: Date;
|
|
}
|
|
|
|
export class IndexingJobDto {
|
|
id: string;
|
|
repositoryId: string;
|
|
versionId: string | null;
|
|
status: 'queued' | 'running' | 'paused' | 'cancelled' | 'done' | 'failed';
|
|
progress: number;
|
|
totalFiles: number;
|
|
processedFiles: number;
|
|
stage: string;
|
|
stageDetail: string | null;
|
|
error: string | null;
|
|
startedAt: Date | null;
|
|
completedAt: Date | null;
|
|
createdAt: Date;
|
|
|
|
constructor(props: IndexingJobDtoProps) {
|
|
this.id = props.id;
|
|
this.repositoryId = props.repositoryId;
|
|
this.versionId = props.versionId;
|
|
this.status = props.status;
|
|
this.progress = props.progress;
|
|
this.totalFiles = props.totalFiles;
|
|
this.processedFiles = props.processedFiles;
|
|
this.stage = props.stage;
|
|
this.stageDetail = props.stageDetail;
|
|
this.error = props.error;
|
|
this.startedAt = props.startedAt;
|
|
this.completedAt = props.completedAt;
|
|
this.createdAt = props.createdAt;
|
|
}
|
|
}
|