Skip to content

Commit 608e9ca

Browse files
authored
Merge pull request #85 from therexone/main
fix(sdk-js): transform camelCase to snake_case in remote add payload
2 parents 97a74dd + 87a68a1 commit 608e9ca

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

sdk-js/src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,22 @@ export class OpenMemory {
241241
}
242242

243243
private async _remoteAdd(content: string, options: any): Promise<any> {
244+
const { userId, decayLambda, ...rest } = options ?? {};
245+
246+
const payload = {
247+
content,
248+
...rest,
249+
user_id: userId,
250+
decay_lambda: decayLambda,
251+
};
252+
244253
const res = await fetch(`${this.url}/memory/add`, {
245254
method: 'POST',
246255
headers: {
247256
'Content-Type': 'application/json',
248257
...(this.apiKey && { 'Authorization': `Bearer ${this.apiKey}` })
249258
},
250-
body: JSON.stringify({ content, ...options })
259+
body: JSON.stringify(payload)
251260
});
252261

253262
if (!res.ok) throw new Error(`Remote add failed: ${res.status}`);

0 commit comments

Comments
 (0)