- 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
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import type { PageServerLoad } from './$types';
|
|
import { getClient } from '$lib/server/db/client.js';
|
|
import { LocalEmbeddingProvider } from '$lib/server/embeddings/local.provider.js';
|
|
import { EmbeddingSettingsDtoMapper } from '$lib/server/mappers/embedding-settings.dto.mapper.js';
|
|
import { EmbeddingSettingsService } from '$lib/server/services/embedding-settings.service.js';
|
|
|
|
export const load: PageServerLoad = async () => {
|
|
const db = getClient();
|
|
|
|
const service = new EmbeddingSettingsService(db);
|
|
const settings = EmbeddingSettingsDtoMapper.toDto(service.getSettings());
|
|
|
|
let localProviderAvailable = false;
|
|
try {
|
|
localProviderAvailable = await new LocalEmbeddingProvider().isAvailable();
|
|
} catch {
|
|
localProviderAvailable = false;
|
|
}
|
|
|
|
// Read indexing concurrency setting
|
|
let indexingConcurrency = 2;
|
|
const concurrencyRow = db
|
|
.prepare<[], { value: string }>(
|
|
"SELECT value FROM settings WHERE key = 'indexing.concurrency'"
|
|
)
|
|
.get();
|
|
|
|
if (concurrencyRow && concurrencyRow.value) {
|
|
try {
|
|
const parsed = JSON.parse(concurrencyRow.value);
|
|
if (typeof parsed === 'object' && parsed !== null && typeof parsed.value === 'number') {
|
|
indexingConcurrency = parsed.value;
|
|
} else if (typeof parsed === 'number') {
|
|
indexingConcurrency = parsed;
|
|
}
|
|
} catch {
|
|
indexingConcurrency = 2;
|
|
}
|
|
}
|
|
|
|
return {
|
|
settings,
|
|
localProviderAvailable,
|
|
indexingConcurrency
|
|
};
|
|
}; |