The diff adds the mandatory `retoor <retoor@molodetz.nl>` header comment to every `.py` file under `devplacepy/` (including `__init__.py` and `routers/__init__.py`), and updates the `StyleAgent` in `agents/style.py` to instruct agents to only add the header on created or already-edited files rather than sweeping the entire repo. The `agents/base.py` operating protocol is also revised to reorder and clarify tool discipline rules.
28 lines
903 B
Python
28 lines
903 B
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def avatar_url(style: str, seed: str, size: int = 128) -> str:
|
|
return f"/avatar/{style}/{seed}?size={size}"
|
|
|
|
|
|
def generate_avatar_svg(seed: str) -> str:
|
|
try:
|
|
from multiavatar.multiavatar import multiavatar
|
|
|
|
svg = multiavatar(seed, None, None)
|
|
if svg and svg.strip().startswith("<svg"):
|
|
return svg
|
|
except Exception as e:
|
|
logger.exception(e)
|
|
logger.warning(f"Avatar generation failed for {seed}: {e}")
|
|
initial = seed[:1].upper() if seed else "?"
|
|
return (
|
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">'
|
|
f'<rect width="100" height="100" rx="50" fill="#ff6b35"/>'
|
|
f'<text x="50" y="65" text-anchor="middle" fill="white" font-size="40" font-weight="700" font-family="sans-serif">{initial}</text></svg>'
|
|
)
|