File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,30 @@ const VectorDB = {
73
73
} ) ;
74
74
} ) ;
75
75
} ,
76
+ /**
77
+ * Queries a vector item from the vector database based on the provided key.
78
+ *
79
+ * @param {string } key - The key of the vector to query the item from.
80
+ * @returns {Promise<QueryVectorItemResponse> } A promise that resolves with the queried vector item.
81
+ */
82
+ queryVectorItems : async ( items : [ ] , dbPath :string ) : Promise < QueryVectorItemResponse > => {
83
+ return new Promise ( ( resolve , reject ) => {
84
+ cbws . getWebsocket . send ( JSON . stringify ( {
85
+ "type" :"vectordbEvent" ,
86
+ "action" : "queryVectorItem" ,
87
+ "message" : {
88
+ items,
89
+ dbPath
90
+ } ,
91
+ } ) ) ;
92
+ cbws . getWebsocket . on ( 'message' , ( data : string ) => {
93
+ const response = JSON . parse ( data ) ;
94
+ if ( response . type === "qeryVectorItemsResponse" ) {
95
+ resolve ( response ) ;
96
+ }
97
+ } ) ;
98
+ } ) ;
99
+ } ,
76
100
} ;
77
101
78
102
export default VectorDB ;
You can’t perform that action at this time.
0 commit comments