mirror of
https://gitea.ingwaz.work/Ingwaz/openbrain-mcp.git
synced 2026-03-31 14:49:06 +00:00
Fix dedup threshold postgres type
This commit is contained in:
@@ -77,7 +77,7 @@ async fn find_dedup_match<C>(
|
|||||||
client: &C,
|
client: &C,
|
||||||
agent_id: &str,
|
agent_id: &str,
|
||||||
embedding: &Vector,
|
embedding: &Vector,
|
||||||
threshold: f32,
|
threshold: f64,
|
||||||
) -> Result<Option<DedupMatch>>
|
) -> Result<Option<DedupMatch>>
|
||||||
where
|
where
|
||||||
C: GenericClient + Sync,
|
C: GenericClient + Sync,
|
||||||
@@ -144,6 +144,7 @@ impl Database {
|
|||||||
) -> Result<StoreMemoryResult> {
|
) -> Result<StoreMemoryResult> {
|
||||||
let client = self.pool.get().await?;
|
let client = self.pool.get().await?;
|
||||||
let vector = Vector::from(embedding.to_vec());
|
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? {
|
if let Some(existing) = find_dedup_match(&client, agent_id, &vector, dedup_threshold).await? {
|
||||||
let merged_metadata = merge_metadata(&existing.metadata, &metadata);
|
let merged_metadata = merge_metadata(&existing.metadata, &metadata);
|
||||||
@@ -372,6 +373,7 @@ impl Database {
|
|||||||
let mut client = self.pool.get().await?;
|
let mut client = self.pool.get().await?;
|
||||||
let transaction = client.transaction().await?;
|
let transaction = client.transaction().await?;
|
||||||
let mut results = Vec::with_capacity(entries.len());
|
let mut results = Vec::with_capacity(entries.len());
|
||||||
|
let dedup_threshold = dedup_threshold as f64;
|
||||||
|
|
||||||
for (content, metadata, embedding, keywords, expires_at) in entries {
|
for (content, metadata, embedding, keywords, expires_at) in entries {
|
||||||
let vector = Vector::from(embedding);
|
let vector = Vector::from(embedding);
|
||||||
|
|||||||
Reference in New Issue
Block a user