{
  "openapi": "3.0.0",
  "info": {
    "title": "OpenClaw 龙虾员工本地运行时 API",
    "version": "1.0.0",
    "description": "本文档面向本地/硬件部署的龙虾员工 AI 运行时，描述与云端管理平台通信所需的全部接口。所有接口均通过 api_key（48位十六进制字符串）鉴权，无需 JWT。"
  },
  "servers": [
    {
      "url": "https://xuphfkscoptnjoaecbvn.supabase.co/functions/v1"
    }
  ],
  "authentication": {
    "type": "api_key",
    "description": "在所有请求的 JSON Body 中传入 api_key 字段。每只龙虾员工拥有唯一的 api_key，在管理后台创建员工时自动生成。可在管理后台「部署对接」面板中复制，也支持一键重新生成（轮换）。",
    "example": "a]1b2c3d4e5f6...（48位 hex）"
  },
  "endpoints": [
    {
      "name": "拉取配置（初始化 / 同步）",
      "method": "POST",
      "path": "/openclaw-employee-config",
      "url": "https://xuphfkscoptnjoaecbvn.supabase.co/functions/v1/openclaw-employee-config",
      "description": "支持两种模式：action='init'（首次连接，自动设为 running 并记录 startup 事件）和 action='sync'（定期轮询，通过 config_version 增量判断是否有变更）。init 返回完整配置，sync 在无变更时返回 { changed: false } 以节省带宽。",
      "request": {
        "content_type": "application/json",
        "body": {
          "api_key": {
            "type": "string",
            "required": true,
            "description": "龙虾员工的唯一身份标识"
          },
          "action": {
            "type": "string",
            "required": false,
            "default": "sync",
            "enum": [
              "init",
              "sync"
            ],
            "description": "init=首次启动初始化（自动设 running）；sync=定期配置同步"
          },
          "config_version": {
            "type": "string",
            "required": false,
            "description": "上次拉取到的 config_version 值，sync 模式下传入可实现增量判断，无变更时返回 { changed: false }"
          }
        },
        "example_init": {
          "api_key": "your_48char_hex_api_key",
          "action": "init"
        },
        "example_sync": {
          "api_key": "your_48char_hex_api_key",
          "action": "sync",
          "config_version": "2026-03-20T10:00:00.000Z"
        }
      },
      "response": {
        "status": 200,
        "description": "sync 模式无变更时返回 { changed: false, config_version }；有变更或 init 模式返回完整配置：",
        "body": {
          "changed": "boolean - 配置是否有变更（sync 无变更时为 false）",
          "employee_id": "uuid - 员工ID",
          "name": "string - 员工名称",
          "status": "string - draft|running|stopped|error（init 模式下自动设为 running）",
          "deployment_type": "string - cloud|local|hardware",
          "group": "object|null - 所属分组 { id, name, color }",
          "persona_prompt": "string|null - 角色人设提示词，定义 AI 的性格和行为",
          "welcome_message": "string|null - 首次对话欢迎语",
          "work_hours": {
            "start": "string|null - 工作开始时间，如 '09:00'",
            "end": "string|null - 工作结束时间，如 '18:00'",
            "is_24h": "boolean - 是否24小时工作（start和end均为null时为true）"
          },
          "auto_reply_rules": [
            {
              "keyword": "string - 触发关键词",
              "pattern": "string - 正则匹配模式（可选）",
              "reply": "string - 自动回复内容",
              "enabled": "boolean"
            }
          ],
          "resource_quota": {
            "max_concurrency": "number - 最大并发对话数"
          },
          "llm": {
            "model_id": "string - 模型标识符，如 'deepseek-chat'、'gpt-4o-mini'",
            "temperature": "number - 温度参数，默认 0.7",
            "max_tokens": "number - 最大生成 Token 数，默认 2048",
            "display_name": "string - 模型显示名称",
            "tier": "string - 模型档次 standard|advanced|premium",
            "credit_multiplier": "number - 积分倍率",
            "max_context_length": "number|null - 最大上下文长度",
            "provider": {
              "name": "string - 供应商名称，如 'DeepSeek'、'OpenAI'",
              "base_url": "string - API 基础 URL，如 'https://api.deepseek.com/v1'",
              "api_key": "string - 供应商 API Key（已由平台托管）",
              "provider_type": "string - 供应商类型 openai_compatible|anthropic 等"
            }
          },
          "skills": [
            {
              "binding_id": "uuid - 技能绑定ID",
              "skill_id": "uuid - 技能ID",
              "skill_config": "object - 技能个性化配置参数",
              "skill": {
                "id": "uuid",
                "title": "string - 技能名称",
                "description": "string - 技能描述",
                "category": "string - 技能分类",
                "file_name": "string - 技能包文件名",
                "file_size": "number - 文件大小（字节）",
                "download_url": "string - 技能包下载 URL"
              }
            }
          ],
          "channels": [
            {
              "id": "uuid - 渠道绑定ID",
              "type": "string - 渠道类型：wechat|feishu|dingtalk|whatsapp|web 等",
              "name": "string - 渠道名称",
              "config": "object - 渠道凭证配置（如 app_id, app_secret, webhook_url 等）"
            }
          ],
          "endpoints": {
            "heartbeat": "string - 心跳上报 URL",
            "events": "string - 事件上报 URL",
            "config": "string - 配置拉取 URL（即本接口）"
          },
          "config_version": "string - ISO 时间戳，用于判断配置是否更新，与上次对比即可"
        }
      },
      "errors": [
        {
          "status": 400,
          "message": "Missing or invalid api_key"
        },
        {
          "status": 401,
          "message": "Invalid api_key or employee not found"
        }
      ]
    },
    {
      "name": "心跳上报",
      "method": "POST",
      "path": "/openclaw-heartbeat",
      "url": "https://xuphfkscoptnjoaecbvn.supabase.co/functions/v1/openclaw-heartbeat",
      "description": "龙虾实例每 30 秒调用一次，上报存活状态。可选携带 stats 对象上报实时用量统计。平台会根据 Token 消耗增量自动扣除用户积分余额。若 90 秒内未收到心跳，管理后台将判定该实例离线。",
      "request": {
        "content_type": "application/json",
        "body": {
          "api_key": {
            "type": "string",
            "required": true,
            "description": "龙虾员工的唯一身份标识"
          },
          "stats": {
            "type": "object",
            "required": false,
            "description": "可选的实时用量统计，用于计费和用量面板展示",
            "properties": {
              "message_count": "number - 当日累计消息数（含收发）",
              "token_count": "number - 当日累计 Token 消耗（平台据此增量计费）",
              "active_conversations": "number - 当前活跃对话数",
              "error_count": "number - 当日累计错误数"
            }
          }
        },
        "examples": [
          {
            "name": "仅心跳（无统计）",
            "body": {
              "api_key": "your_48char_hex_api_key"
            }
          },
          {
            "name": "心跳 + 用量统计",
            "body": {
              "api_key": "your_48char_hex_api_key",
              "stats": {
                "message_count": 42,
                "token_count": 15600,
                "active_conversations": 3,
                "error_count": 0
              }
            }
          }
        ]
      },
      "response": {
        "status": 200,
        "body": {
          "ok": "boolean - 是否成功",
          "employee_id": "uuid",
          "name": "string - 员工名称",
          "status": "string - 当前状态",
          "heartbeat_at": "string - 服务端记录的心跳时间",
          "billing": {
            "description": "计费结果（仅在 stats.token_count 有增量时返回）",
            "success": "boolean - 扣费是否成功",
            "token_delta": "number - 本次新增 Token 数",
            "credits_deducted": "number - 扣除的积分数",
            "balance_before": "number - 扣费前余额",
            "balance_after": "number - 扣费后余额"
          }
        }
      },
      "errors": [
        {
          "status": 400,
          "message": "Missing or invalid api_key"
        },
        {
          "status": 401,
          "message": "Invalid api_key or employee not found"
        }
      ],
      "notes": [
        "token_count 应为当日累计值（非增量），平台会自动计算与上次上报的差值进行计费",
        "计费规则：token_price_ratio 系统设置决定换算比（默认 1000 tokens = 1 积分）",
        "余额不足时 billing.success 为 false 但心跳仍然成功记录"
      ]
    },
    {
      "name": "事件上报",
      "method": "POST",
      "path": "/openclaw-employee-events",
      "url": "https://xuphfkscoptnjoaecbvn.supabase.co/functions/v1/openclaw-employee-events",
      "description": "批量上报结构化事件日志，用于管理后台的审计追踪和用量分析。建议攒批上报（如每 10 秒或满 20 条），单次最多 100 条。",
      "request": {
        "content_type": "application/json",
        "body": {
          "api_key": {
            "type": "string",
            "required": true,
            "description": "龙虾员工的唯一身份标识"
          },
          "events": {
            "type": "array",
            "required": true,
            "max_items": 100,
            "description": "事件列表",
            "item_schema": {
              "event_type": {
                "type": "string",
                "required": true,
                "enum": [
                  "conversation_start",
                  "conversation_end",
                  "message_sent",
                  "message_received",
                  "error",
                  "status_change",
                  "skill_invoked",
                  "channel_connected",
                  "channel_disconnected"
                ],
                "description": "事件类型"
              },
              "data": {
                "type": "object",
                "required": false,
                "description": "事件详情数据，结构因 event_type 而异"
              },
              "conversation_id": {
                "type": "string",
                "required": false,
                "description": "关联的对话ID（对话类事件建议携带）"
              },
              "channel_type": {
                "type": "string",
                "required": false,
                "description": "关联的渠道类型（如 feishu, dingtalk）"
              },
              "occurred_at": {
                "type": "string",
                "required": false,
                "description": "事件实际发生时间（ISO 格式），不传则使用服务端当前时间"
              }
            }
          }
        },
        "example": {
          "api_key": "your_48char_hex_api_key",
          "events": [
            {
              "event_type": "message_received",
              "data": {
                "from": "user_123",
                "content_preview": "你好，请问...",
                "content_length": 28
              },
              "conversation_id": "conv_abc",
              "channel_type": "feishu",
              "occurred_at": "2026-03-19T10:30:00Z"
            },
            {
              "event_type": "message_sent",
              "data": {
                "to": "user_123",
                "content_length": 156,
                "tokens_used": 420,
                "model_id": "deepseek-chat"
              },
              "conversation_id": "conv_abc",
              "channel_type": "feishu",
              "occurred_at": "2026-03-19T10:30:02Z"
            },
            {
              "event_type": "skill_invoked",
              "data": {
                "skill_id": "uuid-of-skill",
                "skill_name": "天气查询",
                "duration_ms": 320,
                "success": true
              },
              "conversation_id": "conv_abc"
            },
            {
              "event_type": "error",
              "data": {
                "error_type": "llm_timeout",
                "message": "LLM API request timed out after 30s",
                "model_id": "deepseek-chat"
              }
            }
          ]
        }
      },
      "response": {
        "status": 200,
        "body": {
          "ok": "boolean",
          "accepted": "number - 实际接受的有效事件数",
          "employee_id": "uuid"
        }
      },
      "errors": [
        {
          "status": 400,
          "message": "Missing or invalid api_key"
        },
        {
          "status": 400,
          "message": "Missing or empty events array"
        },
        {
          "status": 400,
          "message": "Too many events, max 100 per batch"
        },
        {
          "status": 400,
          "message": "No valid events in batch"
        },
        {
          "status": 401,
          "message": "Invalid api_key or employee not found"
        }
      ]
    }
  ],
  "integration_guide": {
    "title": "本地运行时集成指南",
    "startup_sequence": [
      "1. 读取环境变量 OPENCLAW_CLOUD_API_KEY 和 OPENCLAW_CLOUD_BASE_URL",
      "2. 调用 /openclaw-employee-config，传入 action='init'（自动设为 running 并记录 startup 事件）",
      "3. 收到完整配置后，根据 llm.provider 初始化 LLM 客户端（base_url + api_key + model_id）",
      "4. 根据 skills 列表下载并加载技能包",
      "5. 根据 channels 配置初始化 IM 渠道连接",
      "6. 启动心跳定时器（每30秒调用 /openclaw-heartbeat）",
      "7. 启动配置轮询（每60秒调用 /openclaw-employee-config，action='sync'，携带 config_version）",
      "8. 启动事件缓冲队列（攒批上报到 /openclaw-employee-events）"
    ],
    "runtime_loop": [
      "1. 监听 IM 渠道消息 → 上报 message_received 事件",
      "2. 检查 auto_reply_rules 是否匹配 → 匹配则直接回复，不调 LLM",
      "3. 检查 work_hours → 非工作时间返回预设提示，不调 LLM",
      "4. 调用 LLM API 生成回复（使用 config 中的 llm 配置）",
      "5. 发送回复 → 上报 message_sent 事件（含 token 用量）",
      "6. 如需调用技能 → 执行后上报 skill_invoked 事件",
      "7. 心跳时携带累计 stats（message_count, token_count 等）"
    ],
    "config_sync": [
      "每 60 秒拉取一次 config，对比 config_version",
      "若 config_version 变化，重新加载人设、技能、LLM 配置",
      "热更新时不中断当前对话，下一轮对话使用新配置",
      "检测到变更后上报 config_updated 事件"
    ],
    "shutdown": [
      "收到 SIGTERM/SIGINT 信号时，上报 shutdown 事件",
      "平台能区分「主动关闭」（有 shutdown 事件）和「异常掉线」（仅心跳超时）",
      "关闭前刷新事件缓冲区，确保所有事件已上报"
    ],
    "local_config_json": {
      "description": "本地实例需要的最小配置文件",
      "example": {
        "api_key": "your_48char_hex_api_key_from_dashboard",
        "base_url": "https://xuphfkscoptnjoaecbvn.supabase.co/functions/v1",
        "heartbeat_interval_ms": 30000,
        "config_poll_interval_ms": 60000,
        "event_batch_size": 20,
        "event_flush_interval_ms": 10000
      }
    },
    "llm_call_example": {
      "description": "使用 config 返回的 LLM 配置调用模型的示例",
      "code": "// 从 config 响应中提取 LLM 配置\nconst { llm } = configResponse;\n\n// 构建 OpenAI 兼容请求（大多数国产模型均兼容此格式）\nconst response = await fetch(llm.provider.base_url + \"/chat/completions\", {\n  method: \"POST\",\n  headers: {\n    \"Content-Type\": \"application/json\",\n    \"Authorization\": \"Bearer \" + llm.provider.api_key,\n  },\n  body: JSON.stringify({\n    model: llm.model_id,\n    temperature: llm.temperature,\n    max_tokens: llm.max_tokens,\n    messages: [\n      { role: \"system\", content: configResponse.persona_prompt || \"你是一个有用的助手\" },\n      { role: \"user\", content: \"用户消息内容\" },\n    ],\n  }),\n});"
    }
  },
  "product_requirements": {
    "title": "本地小龙虾运行时 — 产品需求规格",
    "version": "1.0.0",
    "overview": "本文档定义了本地/硬件部署的龙虾员工运行时必须满足的全部产品需求，作为开发 checklist 使用。",
    "sections": [
      {
        "id": "identity",
        "title": "一、身份与生命周期",
        "requirements": [
          {
            "id": "ID-1",
            "title": "API Key 即身份",
            "description": "启动时仅需一个 48 位 api_key，所有能力从云端拉取，零本地配置。本地不需要也不应该硬编码任何模型密钥、人设文本或技能文件。",
            "priority": "P0"
          },
          {
            "id": "ID-2",
            "title": "无状态启动",
            "description": "本地不持久化任何运行配置，每次冷启动必须从 openclaw-employee-config 拉取全量配置。本地仅持久化 api_key 和 base_url。",
            "priority": "P0"
          },
          {
            "id": "ID-3",
            "title": "优雅退出",
            "description": "收到 SIGTERM/SIGINT 信号时，上报一个 event_type=shutdown 的事件，然后退出。平台据此区分 '主动关闭' 和 '心跳超时（异常掉线）'。关闭前必须刷新事件缓冲区。",
            "priority": "P0"
          }
        ]
      },
      {
        "id": "heartbeat",
        "title": "二、心跳与监控",
        "requirements": [
          {
            "id": "HB-1",
            "title": "30 秒心跳",
            "description": "每 30 秒调用 openclaw-heartbeat，上报 uptime_seconds、active_conversations、memory_usage_mb 等 stats。",
            "priority": "P0"
          },
          {
            "id": "HB-2",
            "title": "90 秒超时",
            "description": "平台侧 90 秒内无心跳判定实例离线，管理员会收到告警通知（2 只及以上同时超时时触发全局告警）。",
            "priority": "P0"
          },
          {
            "id": "HB-3",
            "title": "自愈能力",
            "description": "网络断开后自动重连，心跳失败不应导致本地服务崩溃。建议实现指数退避重试（最长间隔 5 分钟）。",
            "priority": "P0"
          }
        ]
      },
      {
        "id": "config_sync",
        "title": "三、配置热更新",
        "requirements": [
          {
            "id": "CS-1",
            "title": "60 秒轮询",
            "description": "每 60 秒拉一次 config，对比 config_version（ISO 时间戳）字段判断是否有变更。",
            "priority": "P1"
          },
          {
            "id": "CS-2",
            "title": "无缝切换",
            "description": "人设、技能、LLM 模型变更后，不中断当前对话，下一轮对话使用新配置。变更后上报 config_updated 事件。",
            "priority": "P1"
          },
          {
            "id": "CS-3",
            "title": "技能插件化",
            "description": "技能有 download_url，本地需支持动态下载和加载技能脚本。技能更新时重新下载替换。",
            "priority": "P2"
          }
        ]
      },
      {
        "id": "llm",
        "title": "四、LLM 调用",
        "requirements": [
          {
            "id": "LLM-1",
            "title": "使用平台下发的凭证",
            "description": "config 返回的 llm.provider.base_url + llm.provider.api_key + llm.model_id，本地直接调用，不自带模型密钥。大多数供应商兼容 OpenAI 格式（/chat/completions）。",
            "priority": "P0"
          },
          {
            "id": "LLM-2",
            "title": "System Prompt 注入",
            "description": "将 persona_prompt 作为 system message 注入每次对话。welcome_message 作为首次对话的问候语发送给用户。",
            "priority": "P0"
          },
          {
            "id": "LLM-3",
            "title": "Token 上报",
            "description": "每次 LLM 调用后，记录 prompt_tokens 和 completion_tokens，通过心跳的 stats.token_count（当日累计）上报。平台据此自动计算增量并扣费。",
            "priority": "P0"
          },
          {
            "id": "LLM-4",
            "title": "错误处理",
            "description": "LLM 调用失败（超时、限流、余额不足等）时，上报 error 事件并向用户返回友好提示，不暴露内部错误详情。",
            "priority": "P0"
          }
        ]
      },
      {
        "id": "channels",
        "title": "五、IM 渠道对接",
        "requirements": [
          {
            "id": "CH-1",
            "title": "多渠道并行",
            "description": "config 下发的 channels[] 可能有多个（飞书、钉钉、微信客服等），需同时监听所有活跃渠道。",
            "priority": "P2"
          },
          {
            "id": "CH-2",
            "title": "渠道凭证安全",
            "description": "channel_config 内的 webhook secret、app_secret 等敏感信息不得明文写入日志。日志中仅记录渠道类型和名称。",
            "priority": "P0"
          },
          {
            "id": "CH-3",
            "title": "消息事件上报",
            "description": "每条收发消息上报 message_received / message_sent 事件，附带 channel_type 和 conversation_id。",
            "priority": "P0"
          }
        ]
      },
      {
        "id": "work_hours",
        "title": "六、工作时间与自动回复",
        "requirements": [
          {
            "id": "WH-1",
            "title": "非工作时间静默",
            "description": "如果 work_hours.is_24h = false，在 start ~ end 时间范围之外不调用 LLM，返回预设的非工作时间提示。",
            "priority": "P1"
          },
          {
            "id": "WH-2",
            "title": "自动回复规则",
            "description": "用户消息命中 auto_reply_rules 中的 keyword 或 pattern（正则）时，直接返回预设 reply，不调用 LLM。仅处理 enabled=true 的规则。",
            "priority": "P1"
          }
        ]
      },
      {
        "id": "events",
        "title": "七、事件上报规范",
        "event_types": [
          {
            "type": "startup",
            "description": "实例启动完成",
            "data_fields": [
              "version",
              "deployment_type",
              "os_info"
            ],
            "priority": "P0"
          },
          {
            "type": "shutdown",
            "description": "实例主动关闭",
            "data_fields": [
              "reason",
              "uptime_seconds"
            ],
            "priority": "P0"
          },
          {
            "type": "config_updated",
            "description": "检测到配置变更并重新加载",
            "data_fields": [
              "old_version",
              "new_version",
              "changed_fields"
            ],
            "priority": "P1"
          },
          {
            "type": "message_received",
            "description": "收到用户消息",
            "data_fields": [
              "from",
              "content_length",
              "content_preview"
            ],
            "required_fields": [
              "channel_type",
              "conversation_id"
            ],
            "priority": "P0"
          },
          {
            "type": "message_sent",
            "description": "回复用户消息",
            "data_fields": [
              "to",
              "content_length",
              "tokens_used",
              "model_id",
              "latency_ms"
            ],
            "required_fields": [
              "channel_type",
              "conversation_id"
            ],
            "priority": "P0"
          },
          {
            "type": "skill_invoked",
            "description": "调用了某个技能",
            "data_fields": [
              "skill_id",
              "skill_name",
              "duration_ms",
              "success",
              "error_message"
            ],
            "priority": "P2"
          },
          {
            "type": "error",
            "description": "运行时错误",
            "data_fields": [
              "error_type",
              "message",
              "stack_trace",
              "model_id"
            ],
            "error_types": [
              "llm_timeout",
              "llm_rate_limit",
              "llm_auth_error",
              "channel_disconnected",
              "skill_error",
              "config_fetch_failed",
              "unknown"
            ],
            "priority": "P0"
          },
          {
            "type": "llm_call",
            "description": "LLM 调用详情（可选，用于精细化分析）",
            "data_fields": [
              "model_id",
              "prompt_tokens",
              "completion_tokens",
              "total_tokens",
              "latency_ms",
              "success"
            ],
            "priority": "P1"
          }
        ],
        "batching_rules": {
          "max_batch_size": 100,
          "recommended_batch_size": 20,
          "flush_interval_ms": 10000,
          "description": "事件缓冲在本地队列，每 10 秒或满 20 条时批量上报，单次最多 100 条。实例关闭前必须刷新队列。"
        }
      },
      {
        "id": "mvp_priority",
        "title": "八、最低可行产品（MVP）优先级",
        "tiers": [
          {
            "tier": "P0 — 必须实现",
            "features": [
              "启动拉取配置（employee-config）",
              "心跳上报（heartbeat，30s 间隔）",
              "接收 IM 消息",
              "调用 LLM 生成回复（使用平台下发凭证）",
              "回复 IM 消息",
              "事件上报（startup, shutdown, message_received, message_sent, error）",
              "Token 用量累计上报（通过心跳 stats）",
              "渠道凭证不写日志",
              "LLM 错误友好提示",
              "网络断开自愈重连"
            ]
          },
          {
            "tier": "P1 — 应该实现",
            "features": [
              "配置热更新（60s 轮询 + config_version 对比）",
              "工作时间控制（非工作时间不调 LLM）",
              "自动回复规则匹配",
              "LLM 调用详情事件（llm_call）",
              "config_updated 事件上报"
            ]
          },
          {
            "tier": "P2 — 可以实现",
            "features": [
              "技能动态下载与加载",
              "多渠道并行监听",
              "资源配额限制（max_concurrency）",
              "skill_invoked 事件上报"
            ]
          }
        ]
      },
      {
        "id": "architecture_principles",
        "title": "九、架构原则",
        "principles": [
          {
            "title": "云端是大脑，本地是手脚",
            "description": "所有配置、凭证、计费逻辑在云端，本地仅负责执行。本地不做任何业务决策。"
          },
          {
            "title": "API Key 跨部署不变",
            "description": "同一只龙虾从本地迁移到云端或硬件设备时，api_key 不变，历史数据不丢失。"
          },
          {
            "title": "失败不阻塞",
            "description": "心跳失败、事件上报失败、配置拉取失败，都不应阻塞核心的消息收发流程。采用降级策略继续使用上一次成功的配置。"
          },
          {
            "title": "安全最小化",
            "description": "本地仅持有 api_key 和 base_url 两个配置项。LLM 密钥、渠道凭证等均通过 config 接口实时获取，不在本地持久化。"
          }
        ]
      }
    ]
  }
}

工作日报上报
POST
/openclaw-daily-report
每天定时上报当日工作汇总，包含对话数、消息数、Token 用量、关键成果与异常。同一员工同一天重复上报会更新（upsert）。建议在每天 23:55 或次日凌晨上报。

请求示例

{
  "api_key": "your_48char_hex_api_key",
  "summary_date": "2026-03-23",
  "total_conversations": 45,
  "total_messages": 312,
  "total_tokens": 186400,
  "total_errors": 2,
  "highlights": [
    "处理了 3 个高优先级客诉",
    "新增 12 个客户画像标签"
  ],
  "issues": [
    "飞书渠道 15:20 出现短暂连接中断"
  ],
  "raw_summary_text": "今日共处理 45 个对话，主要集中在售后咨询和产品咨询。下午飞书渠道出现短暂中断，已自动恢复。",
  "active_channels": [
    {
      "type": "feishu",
      "name": "飞书客服"
    },
    {
      "type": "wechat",
      "name": "微信公众号"
    }
  ]
}

响应示例

{
  "ok": true,
  "summary_id": "uuid",
  "employee_id": "uuid",
  "summary_date": "2026-03-23"
}