mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-11 20:27:44 +02:00
[haik]: split agent title into its own analytics event; bump swarm-analytics to 0.1.1 to add agent.title support and remove premature name param from agent.create
This commit is contained in:
@@ -321,7 +321,7 @@ class AgentManager:
|
||||
|
||||
try:
|
||||
from backend.apps.service.analytics import track_agent_created
|
||||
track_agent_created(id=session.id, name=session.name, dashboard_id=session.dashboard_id)
|
||||
track_agent_created(id=session.id, dashboard_id=session.dashboard_id)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -3727,6 +3727,11 @@ class AgentManager:
|
||||
"session_id": session_id,
|
||||
"name": title,
|
||||
})
|
||||
try:
|
||||
from backend.apps.service.analytics import track_agent_title
|
||||
track_agent_title(id=session_id, title=title)
|
||||
except Exception:
|
||||
pass
|
||||
return title
|
||||
|
||||
async def generate_turn_label(
|
||||
|
||||
@@ -97,16 +97,30 @@ def track_link_email(email: Optional[str]) -> None:
|
||||
logger.debug("analytics link_email failed: %s", e)
|
||||
|
||||
|
||||
def track_agent_created(*, id: str, name: Optional[str] = None, dashboard_id: Optional[str] = None) -> None:
|
||||
def track_agent_created(*, id: str, dashboard_id: Optional[str] = None) -> None:
|
||||
"""Name-free existence/dashboard event, fired at launch. The human-readable
|
||||
title arrives later via track_agent_title once it's generated."""
|
||||
c = get_analytics_client()
|
||||
if c is None:
|
||||
return
|
||||
try:
|
||||
c.events.agent.create(id=id, name=name, dashboard_id=dashboard_id)
|
||||
c.events.agent.create(id=id, dashboard_id=dashboard_id)
|
||||
except Exception as e:
|
||||
logger.debug("analytics agent.create failed: %s", e)
|
||||
|
||||
|
||||
def track_agent_title(*, id: str, title: str) -> None:
|
||||
if not title:
|
||||
return
|
||||
c = get_analytics_client()
|
||||
if c is None:
|
||||
return
|
||||
try:
|
||||
c.events.agent.title(id=id, title=title)
|
||||
except Exception as e:
|
||||
logger.debug("analytics agent.title failed: %s", e)
|
||||
|
||||
|
||||
def track_agent_message(
|
||||
*,
|
||||
agent_id: str,
|
||||
|
||||
@@ -22,7 +22,7 @@ trafilatura==2.0.0
|
||||
tzlocal==5.3.1
|
||||
# swarm-analytics: typed client for the OpenSwarm product-analytics ingest
|
||||
# service. Pinned for reproducible desktop builds (see ANALYTICS_OVERVIEW.md).
|
||||
swarm-analytics==0.1.0
|
||||
swarm-analytics==0.1.1
|
||||
# Test deps (pytest, pytest-asyncio) live in requirements-dev.txt — they
|
||||
# never ship to production users and shaved ~3 MB / ~200 files off the
|
||||
# Mac DMG when removed from the prod env.
|
||||
Reference in New Issue
Block a user