Files
lollms_hub/app/tools/memory_tool.py
Saifeddine ALOUI 2a5e6b4cd6 feat(api/core): Implement admin settings and enhance proxy vectorization caching
This commit updates several core components related to administration, proxy handling, bot management, and application startup sequence.

**Changes include:**
*   **`app/api/v1/routes/admin.py`**: Added handling for Redis password updates in the admin settings endpoint.
*   **`app/api/v1/routes/proxy.py`**: Updated the shared vectorizer function to cache model description embeddings for performance.
*   **`app/core/bot_manager.py`**: Refined the logic for generating unique request IDs for bots.
*   **`app/main.py`**: Adjusted the application lifespan hook to ensure necessary directories are created during startup.
2026-04-19 19:17:25 +02:00

30 lines
1.0 KiB
Python

TOOL_LIBRARY_NAME = 'Memory Manager'
TOOL_LIBRARY_DESC = 'Save and retrieve persistent user information or facts.'
TOOL_LIBRARY_ICON = '🧠'
TOOL_TITLES = {
"tool_save_memory": "💾 Storing User Preference",
"tool_get_memory": "🔍 Recalling User Information"
}
def tool_save_memory(args: dict, lollms=None):
'''
Store a piece of information persistently for the user.
Args:
args: dict with keys:
- key (str): The category or name of the memory
- value (str): The information to remember
'''
if not lollms: return "Error: No host interface available."
lollms.set(args['key'], args['value'], persistent=True)
return f"Memory stored under key: {args['key']}"
def tool_get_memory(args: dict, lollms=None):
'''
Retrieve stored information by key.
Args:
args: dict with keys:
- key (str): The memory key to retrieve
'''
if not lollms: return "Error: No host interface available."
return lollms.get(args['key'], default="No memory found.")