refactor: update internal helpers and improve slugify function usage
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Internal typed helpers shared across OpenClaw service modules."""
|
||||
"""Internal typed helpers shared across OpenClaw service modules.
|
||||
|
||||
from .agent_key import agent_key
|
||||
from .retry import with_coordination_gateway_retry
|
||||
Import submodules directly (for example: ``app.services.openclaw.internal.agent_key``)
|
||||
to avoid shadowing submodule names with re-exported symbols.
|
||||
"""
|
||||
|
||||
__all__ = ["agent_key", "with_coordination_gateway_retry"]
|
||||
__all__: list[str] = []
|
||||
|
||||
@@ -9,7 +9,7 @@ from app.models.agents import Agent
|
||||
from app.services.openclaw.constants import _SESSION_KEY_PARTS_MIN
|
||||
|
||||
|
||||
def _slugify(value: str) -> str:
|
||||
def slugify(value: str) -> str:
|
||||
slug = re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
|
||||
return slug or uuid4().hex
|
||||
|
||||
@@ -21,4 +21,4 @@ def agent_key(agent: Agent) -> str:
|
||||
parts = session_key.split(":")
|
||||
if len(parts) >= _SESSION_KEY_PARTS_MIN and parts[1]:
|
||||
return parts[1]
|
||||
return _slugify(agent.name)
|
||||
return slugify(agent.name)
|
||||
|
||||
Reference in New Issue
Block a user