feat(EMBEDDINGS-0001): enable local embedder by default and overhaul settings page
- Wire local embedding provider as the default on startup when no profile is configured - Refactor embedding settings into dedicated service, DTOs, mappers and models - Rebuild settings page with profile management UI and live test feedback - Expose index summary (indexed versions + embedding count) on repo endpoints - Harden indexing pipeline and context search with additional test coverage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
38
src/lib/server/mappers/embedding-profile.mapper.ts
Normal file
38
src/lib/server/mappers/embedding-profile.mapper.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import {
|
||||
EmbeddingProfile,
|
||||
EmbeddingProfileEntity
|
||||
} from '$lib/server/models/embedding-profile.js';
|
||||
|
||||
function parseConfig(config: Record<string, unknown> | string | null): Record<string, unknown> {
|
||||
if (!config) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
try {
|
||||
const parsed = JSON.parse(config);
|
||||
return parsed && typeof parsed === 'object' ? (parsed as Record<string, unknown>) : {};
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export class EmbeddingProfileMapper {
|
||||
static fromEntity(entity: EmbeddingProfileEntity): EmbeddingProfile {
|
||||
return new EmbeddingProfile({
|
||||
id: entity.id,
|
||||
providerKind: entity.provider_kind,
|
||||
title: entity.title,
|
||||
enabled: Boolean(entity.enabled),
|
||||
isDefault: Boolean(entity.is_default),
|
||||
model: entity.model,
|
||||
dimensions: entity.dimensions,
|
||||
config: parseConfig(entity.config),
|
||||
createdAt: entity.created_at,
|
||||
updatedAt: entity.updated_at
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user