chore: snapshot before performance optimization
This commit is contained in:
@@ -175,26 +175,17 @@ export class EmbeddingService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize embedding to JSON-safe format (for storage)
|
||||
* Pass-through — embeddings are stored as native JSONB in PostgreSQL
|
||||
*/
|
||||
serialize(embedding: number[]): string {
|
||||
return JSON.stringify(embedding)
|
||||
serialize(embedding: number[]): number[] {
|
||||
return embedding
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize embedding from JSON string
|
||||
* Pass-through — embeddings come back already parsed from PostgreSQL
|
||||
*/
|
||||
deserialize(jsonString: string): number[] {
|
||||
try {
|
||||
const parsed = JSON.parse(jsonString)
|
||||
if (!Array.isArray(parsed)) {
|
||||
throw new Error('Invalid embedding format')
|
||||
}
|
||||
return parsed
|
||||
} catch (error) {
|
||||
console.error('Error deserializing embedding:', error)
|
||||
throw new Error('Failed to deserialize embedding')
|
||||
}
|
||||
deserialize(embedding: number[]): number[] {
|
||||
return embedding
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user