Files
devplacepy/devplacepy/services/bot/runtime.py
T
retoor ce3cae1433 feat: add startup jitter, randomized browser fingerprints, and comment style variants to bot fleet
Introduce `startup_jitter_seconds` config field so each bot delays its first session by a random amount up to the configured maximum, spreading fleet activity on service start. Persist a randomly chosen user-agent and viewport per bot in `BotState` and pass them to `BotBrowser` constructor, replacing the hardcoded defaults with a varied pool defined in `config.py`. Add `HANDLE_SUFFIX_WORDS` list and remove numeric suffixes from handle generation to avoid bot-farm appearance. Implement `pick_comment_style` and `is_short_comment_style` static methods in `LLMClient`, extend `generate_comment` with a `style` parameter that produces one-liner or question variants using `MIN_SHORT_COMMENT_LEN`, and wire session comment caps (`SESSION_COMMENT_CAP_MIN/MAX`) with cooldown intervals (`COMMENT_COOLDOWN_MIN/MAX_SECONDS`) into the bot loop. Update `BotRuntimeConfig`, `BotsService` config field registration, and architecture docs to reflect the new identity and pacing logic.
2026-06-13 11:19:32 +00:00

30 lines
1.1 KiB
Python

# retoor <retoor@molodetz.nl>
from dataclasses import dataclass
from pathlib import Path
from devplacepy.services.bot import config
@dataclass
class BotRuntimeConfig:
state_path: Path
base_url: str = config.BASE_URL_DEFAULT
api_url: str = config.API_URL_DEFAULT
news_api: str = config.NEWS_API_DEFAULT
model: str = config.MODEL_DEFAULT
api_key: str = ""
input_cost_per_1m: float = config.INPUT_COST_PER_1M_DEFAULT
output_cost_per_1m: float = config.OUTPUT_COST_PER_1M_DEFAULT
headless: bool = True
registry_path: Path = config.ARTICLE_REGISTRY_PATH
max_per_article: int = config.MAX_BOTS_PER_ARTICLE
article_ttl_days: int = config.ARTICLE_TTL_DAYS
gist_min_lines: int = config.GIST_MIN_LINES
action_pause_min: int = config.ACTION_PAUSE_MIN_SECONDS
action_pause_max: int = config.ACTION_PAUSE_MAX_SECONDS
break_scale: float = config.BREAK_SCALE_DEFAULT
startup_jitter_seconds: int = config.STARTUP_JITTER_SECONDS_DEFAULT
ai_decisions: bool = config.AI_DECISIONS_DEFAULT
decision_temperature: float = config.DECISION_TEMPERATURE_DEFAULT