mirror of
https://github.com/mtayfur/openwebui-memory-system.git
synced 2026-01-22 06:51:01 +01:00
Refactor cache configuration constants for improved clarity and consistency; adjust cache entry limits and hash prefix length
This commit is contained in:
@@ -41,9 +41,9 @@ class Constants:
|
|||||||
LLM_CONSOLIDATION_TIMEOUT_SEC = 60.0 # Timeout for LLM consolidation operations
|
LLM_CONSOLIDATION_TIMEOUT_SEC = 60.0 # Timeout for LLM consolidation operations
|
||||||
|
|
||||||
# Cache System
|
# Cache System
|
||||||
MAX_CACHE_ENTRIES_PER_TYPE = 5000 # Maximum cache entries per cache type
|
MAX_CACHE_ENTRIES_PER_TYPE = 2500 # Maximum cache entries per cache type
|
||||||
MAX_CONCURRENT_USER_CACHES = 500 # Maximum concurrent user cache instances
|
MAX_CONCURRENT_USER_CACHES = 250 # Maximum concurrent user cache instances
|
||||||
CACHE_KEY_HASH_PREFIX_LENGTH = 16 # Hash prefix length for cache keys
|
CACHE_KEY_HASH_PREFIX_LENGTH = 10 # Hash prefix length for cache keys
|
||||||
|
|
||||||
# Retrieval & Similarity
|
# Retrieval & Similarity
|
||||||
SEMANTIC_RETRIEVAL_THRESHOLD = 0.5 # Semantic similarity threshold for retrieval
|
SEMANTIC_RETRIEVAL_THRESHOLD = 0.5 # Semantic similarity threshold for retrieval
|
||||||
@@ -1170,6 +1170,7 @@ class Filter:
|
|||||||
|
|
||||||
def _normalize_embedding(self, embedding: np.ndarray) -> np.ndarray:
|
def _normalize_embedding(self, embedding: np.ndarray) -> np.ndarray:
|
||||||
"""Normalize embedding vector."""
|
"""Normalize embedding vector."""
|
||||||
|
embedding = embedding.astype(np.float16)
|
||||||
norm = np.linalg.norm(embedding)
|
norm = np.linalg.norm(embedding)
|
||||||
return embedding / norm if norm > 0 else embedding
|
return embedding / norm if norm > 0 else embedding
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user