fix(ingest): raise ref cap to 50 and clarify invalid bvid error

This commit is contained in:
kairee committed 2026-11-01 15:05:17 +08:00
1 parent b5bf7d9b8f
commit b0c53e8a2f
7 files changed
+107 -9

No files matched your search

+15
View File
@@ -15,6 +15,7 @@ from reaction_board.notify.telegram import ( # noqa: E402
TelegramClient,
TelegramError,
format_duration,
format_manual_reply,
)
from reaction_board.services.library import ( # noqa: E402
ActionResult,
@@ -51,6 +52,19 @@ def test_format_duration():
assert format_duration(3725) == "1:02:05"
def test_manual_reply_truncation_notice():
result = ManualIngestResult(
refs=50, added=1, truncated=2,
results=[IngestResult(True, 1, "added", title="t", message="已入库")],
)
text = format_manual_reply(result)
assert "共识别 50 个引用" in text
assert "还有 2 个引用未处理" in text
assert format_manual_reply(ManualIngestResult()) == (
"未识别到 B 站视频引用,请发送视频链接或 BV 号,例如 BV1x8x166EzY。"
)
def test_send_candidates_and_chunking():
transport = FakeTransport()
bot = TelegramClient("token", 42, transport=transport)
@@ -300,6 +314,7 @@ def test_poller_backoff_and_recovery():
def main():
test_format_duration()
test_manual_reply_truncation_notice()
test_send_candidates_and_chunking()
test_send_candidates_dedupes_by_aid()
test_get_updates_and_answer()