Merge pull request 'Fix dedup threshold postgres type' (#27) from codex/issue-14-dedup-ingest into main

Reviewed-on: Ingwaz/openbrain-mcp#27
This commit is contained in:
2026-03-24 06:11:51 +00:00

View File

@@ -77,7 +77,7 @@ async fn find_dedup_match<C>(
client: &C,
agent_id: &str,
embedding: &Vector,
threshold: f32,
threshold: f64,
) -> Result<Option<DedupMatch>>
where
C: GenericClient + Sync,
@@ -144,6 +144,7 @@ impl Database {
) -> Result<StoreMemoryResult> {
let client = self.pool.get().await?;
let vector = Vector::from(embedding.to_vec());
let dedup_threshold = dedup_threshold as f64;
if let Some(existing) = find_dedup_match(&client, agent_id, &vector, dedup_threshold).await? {
let merged_metadata = merge_metadata(&existing.metadata, &metadata);
@@ -372,6 +373,7 @@ impl Database {
let mut client = self.pool.get().await?;
let transaction = client.transaction().await?;
let mut results = Vec::with_capacity(entries.len());
let dedup_threshold = dedup_threshold as f64;
for (content, metadata, embedding, keywords, expires_at) in entries {
let vector = Vector::from(embedding);