mem0ai 1.0.8 → 1.0.9
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/package.json +1 -1
- package/src/index.js +11 -4
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -74,7 +74,6 @@ class MemoryClient {
|
|
|
74
74
|
this.deleteAll = apiErrorHandler(this.deleteAll.bind(this));
|
|
75
75
|
this.history = apiErrorHandler(this.history.bind(this));
|
|
76
76
|
this.deleteUsers = apiErrorHandler(this.deleteUsers.bind(this));
|
|
77
|
-
this.deleteUserMemories = apiErrorHandler(this.deleteUserMemories.bind(this));
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
async _validateApiKey() {
|
|
@@ -110,9 +109,17 @@ class MemoryClient {
|
|
|
110
109
|
* @returns {Promise<{results: Memory[]}>}
|
|
111
110
|
*/
|
|
112
111
|
async getAll(options = {}) {
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
112
|
+
const { api_version, ...otherOptions } = options;
|
|
113
|
+
const endpoint = api_version === 'v2' ? '/v2/memories/' : '/v1/memories/';
|
|
114
|
+
|
|
115
|
+
if (api_version === 'v2') {
|
|
116
|
+
const response = await this.client.post(endpoint, otherOptions);
|
|
117
|
+
return response.data;
|
|
118
|
+
} else {
|
|
119
|
+
const params = this._prepareParams(otherOptions);
|
|
120
|
+
const response = await this.client.get(endpoint, { params });
|
|
121
|
+
return response.data;
|
|
122
|
+
}
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
/**
|