diff --git a/functions/src/embeddings.ts b/functions/src/embeddings.ts index d677df2c..db4b6060 100644 --- a/functions/src/embeddings.ts +++ b/functions/src/embeddings.ts @@ -328,8 +328,22 @@ class EmbeddingStore { } if (existingPoint && existingPoint.payload && existingPoint.payload.content === text) { - //The embedding exists and is up to date, no need to do anything else. - console.log(`The embedding content had not changed for ${card.id} so stopping early`); + //The embedding exists and is up to date, no need to recompute the + //embedding. We do still want to update the timestamp in the vector + //store though, so in the future last_updated will note that it's + //current as of this moment, not when the embedding changed... + //because a card itself doesn't know the timestamp when the + //embeddable content last changed. + await this._qdrant.setPayload(QDRANT_COLLECTION_NAME, { + points: [ + existingPoint.id + ], + payload: { + last_updated: Date.now() + } + }); + + console.log(`Updated the metadata for ${card.id} because its embedding had not changed`); return; } diff --git a/src/actions/similarity.ts b/src/actions/similarity.ts index 31e49101..373cb15c 100644 --- a/src/actions/similarity.ts +++ b/src/actions/similarity.ts @@ -82,9 +82,6 @@ const similarCards = async (cardID : CardID, lastUpdated : MillisecondsSinceEpoc }; } - //TODO: there's a massive problem with this flow currently... if a card is updated but - //doesn't have an embedding updated. - const request : SimilarCardsRequestData = { card_id: cardID, last_updated: lastUpdated