@codebolt/codeboltjs 1.1.53 → 1.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -198,6 +198,7 @@ declare class Codebolt {
198
198
  getVector: (key: string) => Promise<import("@codebolt/types").GetVectorResponse>;
199
199
  addVectorItem: (item: any) => Promise<import("@codebolt/types").AddVectorItemResponse>;
200
200
  queryVectorItem: (key: string) => Promise<import("@codebolt/types").QueryVectorItemResponse>;
201
+ queryVectorItems: (items: [], dbPath: string) => Promise<import("@codebolt/types").QueryVectorItemResponse>;
201
202
  };
202
203
  debug: {
203
204
  debug: (log: string, type: import("./modules/debug").logType) => Promise<import("@codebolt/types").DebugAddLogResponse>;
@@ -22,5 +22,12 @@ declare const VectorDB: {
22
22
  * @returns {Promise<QueryVectorItemResponse>} A promise that resolves with the queried vector item.
23
23
  */
24
24
  queryVectorItem: (key: string) => Promise<QueryVectorItemResponse>;
25
+ /**
26
+ * Queries a vector item from the vector database based on the provided key.
27
+ *
28
+ * @param {string} key - The key of the vector to query the item from.
29
+ * @returns {Promise<QueryVectorItemResponse>} A promise that resolves with the queried vector item.
30
+ */
31
+ queryVectorItems: (items: [], dbPath: string) => Promise<QueryVectorItemResponse>;
25
32
  };
26
33
  export default VectorDB;
@@ -75,5 +75,29 @@ const VectorDB = {
75
75
  });
76
76
  });
77
77
  },
78
+ /**
79
+ * Queries a vector item from the vector database based on the provided key.
80
+ *
81
+ * @param {string} key - The key of the vector to query the item from.
82
+ * @returns {Promise<QueryVectorItemResponse>} A promise that resolves with the queried vector item.
83
+ */
84
+ queryVectorItems: async (items, dbPath) => {
85
+ return new Promise((resolve, reject) => {
86
+ websocket_1.default.getWebsocket.send(JSON.stringify({
87
+ "type": "vectordbEvent",
88
+ "action": "queryVectorItems",
89
+ "message": {
90
+ items,
91
+ dbPath
92
+ },
93
+ }));
94
+ websocket_1.default.getWebsocket.on('message', (data) => {
95
+ const response = JSON.parse(data);
96
+ if (response.type === "qeryVectorItemsResponse") {
97
+ resolve(response);
98
+ }
99
+ });
100
+ });
101
+ },
78
102
  };
79
103
  exports.default = VectorDB;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.53",
3
+ "version": "1.1.55",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -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": "queryVectorItems",
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;