feat(server): add information on self-hosted dashboard (#5325)
This commit is contained in:
@@ -360,6 +360,8 @@ def add_memory(memory_create: MemoryCreate, _auth=Depends(verify_auth)):
|
|||||||
params = {k: v for k, v in memory_create.model_dump().items() if v is not None and k != "messages"}
|
params = {k: v for k, v in memory_create.model_dump().items() if v is not None and k != "messages"}
|
||||||
try:
|
try:
|
||||||
response = get_memory_instance().add(messages=[m.model_dump() for m in memory_create.messages], **params)
|
response = get_memory_instance().add(messages=[m.model_dump() for m in memory_create.messages], **params)
|
||||||
|
if response.get("results"):
|
||||||
|
telemetry.log_dashboard_nudge_once(DASHBOARD_URL)
|
||||||
return JSONResponse(content=response)
|
return JSONResponse(content=response)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise upstream_error()
|
raise upstream_error()
|
||||||
|
|||||||
@@ -64,11 +64,12 @@ fi
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Ready ==="
|
echo "=== Ready ==="
|
||||||
echo "Dashboard: $DASHBOARD_URL"
|
|
||||||
echo "Email: $EMAIL"
|
echo "Email: $EMAIL"
|
||||||
echo "Password: $PASSWORD"
|
echo "Password: $PASSWORD"
|
||||||
echo "API Key: $API_KEY"
|
echo "API Key: $API_KEY"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Open your dashboard at $DASHBOARD_URL to see and manage your memories in your browser."
|
||||||
|
echo ""
|
||||||
|
|
||||||
if ! grep -qE '^(OPENAI|ANTHROPIC|GOOGLE)_API_KEY=.' .env 2>/dev/null; then
|
if ! grep -qE '^(OPENAI|ANTHROPIC|GOOGLE)_API_KEY=.' .env 2>/dev/null; then
|
||||||
echo "!! No LLM provider API key set in server/.env."
|
echo "!! No LLM provider API key set in server/.env."
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ STATE_PATH = Path(os.environ.get("MEM0_TELEMETRY_STATE_PATH", "/app/history/tele
|
|||||||
|
|
||||||
_lock = Lock()
|
_lock = Lock()
|
||||||
_client: Any = None
|
_client: Any = None
|
||||||
|
_dashboard_nudge_logged = False
|
||||||
|
|
||||||
|
|
||||||
def _load_state() -> dict[str, Any]:
|
def _load_state() -> dict[str, Any]:
|
||||||
@@ -110,3 +111,19 @@ def capture_admin_registered(email: str) -> None:
|
|||||||
|
|
||||||
def capture_onboarding_completed(email: str, use_case: str) -> None:
|
def capture_onboarding_completed(email: str, use_case: str) -> None:
|
||||||
_capture_once(email, "onboarding_completed", "onboarding_sent_at", {"use_case": use_case})
|
_capture_once(email, "onboarding_completed", "onboarding_sent_at", {"use_case": use_case})
|
||||||
|
|
||||||
|
|
||||||
|
def log_dashboard_nudge_once(dashboard_url: str) -> None:
|
||||||
|
"""Log a hint pointing the operator to the web dashboard the first time a memory
|
||||||
|
is stored. Fires at most once per process (so a restart may re-log it on the next
|
||||||
|
add — harmless for a discovery nudge). LOCAL console log only — sends nothing
|
||||||
|
off-box, so it is intentionally NOT gated by MEM0_TELEMETRY.
|
||||||
|
"""
|
||||||
|
global _dashboard_nudge_logged
|
||||||
|
if _dashboard_nudge_logged:
|
||||||
|
return
|
||||||
|
_dashboard_nudge_logged = True
|
||||||
|
logging.info(
|
||||||
|
"First memory stored. Open the dashboard at %s to view and manage your memories.",
|
||||||
|
dashboard_url,
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user