mirror of
https://github.com/slhaf/Partner.git
synced 2026-06-27 17:49:16 +08:00
feat(impression): add vector index skeleton
This commit is contained in:
@@ -22,6 +22,7 @@ public class ImpressionCore implements StateSerializable {
|
|||||||
* Keyed by entity uuid. Subject can be revised or merged later, so it should not be used as the stable key.
|
* Keyed by entity uuid. Subject can be revised or merged later, so it should not be used as the stable key.
|
||||||
*/
|
*/
|
||||||
private final ConcurrentHashMap<String, Entity> knownEntitiesByUuid = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Entity> knownEntitiesByUuid = new ConcurrentHashMap<>();
|
||||||
|
private final ImpressionVectorIndex vectorIndex = new ImpressionVectorIndex();
|
||||||
|
|
||||||
@CapabilityMethod
|
@CapabilityMethod
|
||||||
public void updateRelation() {
|
public void updateRelation() {
|
||||||
@@ -66,6 +67,7 @@ public class ImpressionCore implements StateSerializable {
|
|||||||
|
|
||||||
Entity entity = new Entity(uuid, subject);
|
Entity entity = new Entity(uuid, subject);
|
||||||
entity.load();
|
entity.load();
|
||||||
|
vectorIndex.sync(entity);
|
||||||
knownEntitiesByUuid.put(uuid, entity);
|
knownEntitiesByUuid.put(uuid, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package work.slhaf.partner.core.cognition.impression;
|
||||||
|
|
||||||
|
public class ImpressionVectorIndex {
|
||||||
|
|
||||||
|
public void sync(Entity entity){
|
||||||
|
// TODO sync entity impressions/features with vector index.
|
||||||
|
}
|
||||||
|
|
||||||
|
public void upsert(String content, Entity.IndexableData indexableData){
|
||||||
|
// TODO update vector for content when embedding/vector client boundary is finalized.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user