Fix user_id functionality (#2548)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
import os
|
||||
import warnings
|
||||
import hashlib
|
||||
from functools import wraps
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
@@ -83,6 +84,9 @@ class MemoryClient:
|
||||
if not self.api_key:
|
||||
raise ValueError("Mem0 API Key not provided. Please provide an API Key.")
|
||||
|
||||
# Create MD5 hash of API key for user_id
|
||||
self.user_id = hashlib.md5(self.api_key.encode()).hexdigest()
|
||||
|
||||
self.client = httpx.Client(
|
||||
base_url=self.host,
|
||||
headers={"Authorization": f"Token {self.api_key}", "Mem0-User-ID": self.user_id},
|
||||
|
||||
Reference in New Issue
Block a user