deploy: auto commit repo-root changes 2026-06-13 00:17:26

This commit is contained in:
hajimi
2026-06-13 00:17:26 +08:00
parent 16b8d0365a
commit c3385b0e04
6 changed files with 160 additions and 258 deletions
+41 -6
View File
@@ -25,7 +25,40 @@ DEFAULT_REQUEST_TIMEOUT = 180
DEFAULT_RETRY_TIMES = 2
DEFAULT_RETRY_SLEEP_MS = 800
BOT_ACCOUNT_PREFIX = "ai_comment_"
BOT_NICKNAME_PREFIX = "AI评论员"
BOT_HANDLE_PREFIXES = [
"看台",
"深夜",
"边线",
"北区",
"南看台",
"东门",
"西街",
"慢热",
"小酒馆",
"补时",
"角旗",
"传中",
"临场",
"半场",
"球门后",
"旧球鞋",
"赛点",
"风向",
"追球",
"回防",
]
BOT_HANDLE_SUFFIXES = [
"阿泽",
"小顾",
"老韩",
"阿凯",
"小唐",
"阿林",
"阿松",
"阿北",
"阿岳",
"阿诚",
]
DEFAULT_ARTICLE_PROMPT = (
"你是一名专业、克制、真实的体育资讯评论员。请根据给定资讯内容生成1条中文评论,"
@@ -592,7 +625,7 @@ class AiCommentRepository:
for index in range(1, target_count + 1):
persona = self._persona_for_index(index)
account = f"{BOT_ACCOUNT_PREFIX}{index:04d}"
nickname = self._build_bot_nickname(index, persona["label"])
nickname = self._build_bot_nickname(index)
row = indexed.get(index)
if row:
if row["nickname"] != nickname:
@@ -618,7 +651,7 @@ class AiCommentRepository:
for row in rows:
index = self._parse_account_index(row["account"])
persona = self._persona_for_index(index)
users.append(VirtualUser(int(row["id"]), row["account"], self._build_bot_nickname(index, persona["label"]), persona["key"]))
users.append(VirtualUser(int(row["id"]), row["account"], self._build_bot_nickname(index), persona["key"]))
self._virtual_users_cache = list(users)
return users[:target_count]
@@ -991,9 +1024,11 @@ class AiCommentRepository:
return hashlib.md5(str(random.random()).encode("utf-8")).hexdigest()[:12]
@staticmethod
def _build_bot_nickname(index: int, persona_label: str) -> str:
number = f"{index:02d}" if index < 100 else str(index)
return f"{BOT_NICKNAME_PREFIX}{number}·{persona_label}"
def _build_bot_nickname(index: int) -> str:
zero_based = max(0, index - 1)
prefix = BOT_HANDLE_PREFIXES[zero_based % len(BOT_HANDLE_PREFIXES)]
suffix = BOT_HANDLE_SUFFIXES[(zero_based // len(BOT_HANDLE_PREFIXES)) % len(BOT_HANDLE_SUFFIXES)]
return f"{prefix}{suffix}"
@staticmethod
def _persona_for_index(index: int) -> Dict[str, str]: