sansan0/TrendRadar · error · ValueError

split_content_func is required

Error message

split_content_func is required

What it means

Error "split_content_func is required" thrown in sansan0/TrendRadar.

Source

Thrown at trendradar/notification/senders.py:1247

        webhook_url: Webhook URL
        payload_template: JSON 模板字符串,支持 {title} 和 {content} 占位符
        report_data: 报告数据
        report_type: 报告类型
        update_info: 更新信息(可选)
        proxy_url: 代理 URL(可选)
        mode: 报告模式 (daily/current)
        account_label: 账号标签(多账号时显示)
        batch_size: 批次大小(字节)
        batch_interval: 批次发送间隔(秒)
        split_content_func: 内容分批函数
        rss_items: RSS 统计条目列表(可选,用于合并推送)
        rss_new_items: RSS 新增条目列表(可选,用于新增区块)

    Returns:
        bool: 发送是否成功
    """
    if split_content_func is None:
        raise ValueError("split_content_func is required")

    headers = {"Content-Type": "application/json"}
    proxies = None
    if proxy_url:
        proxies = {"http": proxy_url, "https": proxy_url}

    # 日志前缀
    log_prefix = f"通用Webhook{account_label}" if account_label else "通用Webhook"

    # 渲染 AI 分析内容并提取统计数据(通用 Webhook 使用 markdown 格式)
    ai_content = _render_ai_analysis(ai_analysis, "wework") if ai_analysis else None
    ai_stats = _extract_ai_stats(ai_analysis)

    # 获取分批内容
    # 使用 'wework' 作为 format_type 以获取 markdown 格式的通用输出
    # 预留一定空间给模板外壳
    template_overhead = 200
    batches = split_content_func(

View on GitHub (pinned to 8ee26026ba)

Solutions

  1. 调用通用 Webhook 发送函数时传入 split_content_func 参数(内容分段函数)
  2. 检查调用点,确保未遗漏必需参数

Example fix

send_to_webhook(..., split_content_func=split_content)

When it happens

Trigger: Thrown at trendradar/notification/senders.py:1247 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sansan0/TrendRadar@8ee26026ba (2026-08-15). Data as JSON: /api/errors/9bfa62e7a3c3cc6a. Report an issue: GitHub.