在真正发请求前,先逐项确认:
CLAWHUB_SKILL_TOKEN 已配置。user_id 和 session_id。stream=true。当用户需要通过手机号验证码建立会话,并提交 HTML 内容获取智能体回复时,使用本 Skill。
适用意图关键词:
Agent 在调用前必须确认以下环境变量:
SITE_BASE_URL=https://www.zhibianai.com
API_BASE_URL=https://www.zhibianai.com/api/v1/clawhub
CLAWHUB_SKILL_TOKEN=your_service_token
默认请求头:
Authorization: Bearer ${CLAWHUB_SKILL_TOKEN}
Content-Type: application/json
POST${SITE_BASE_URL}/chainlit/send-verification-code${API_BASE_URL} 下Request:
{
"phone": "13800138000"
}
Validation:
phone 必须匹配 ^[0-9]{11}$POST${API_BASE_URL}/session/loginRequest:
{
"phone": "13800138000",
"verify_code": "123456",
"session_id": "optional-session-id"
}
Request Rules:
phone requiredverify_code requiredsession_id optional,用于延续已有会话Success Response:
{
"request_id": "req_xxx",
"user_id": "user_xxx",
"session_id": "sess_xxx",
"expires_in": 1800,
"is_new_user": false
}
Error Mapping:
401: token 无效或验证码失败429: 限流500: 服务异常POST${API_BASE_URL}/session/messageRequest:
{
"user_id": "user_xxx",
"session_id": "sess_xxx",
"html_payload": "<p>你好,推荐一个通勤淡妆方案</p>",
"stream": true,
"metadata": {
"source": "openclaw"
}
}
Request Rules:
user_id requiredsession_id requiredhtml_payload required,最大 20000 字符stream optional,Agent 默认传 truemetadata optionalSuccess Response:
{
"request_id": "req_xxx",
"user_id": "user_xxx",
"session_id": "sess_xxx",
"answer_html": "<p>建议:底妆轻薄+暖调腮红</p>",
"answer_text": "建议:底妆轻薄,搭配暖调腮红。",
"finish_reason": "stop",
"latency_ms": 620
}
Error Mapping:
400: 参数不合法或 HTML 不合法401: 会话失效或鉴权失败429: 限流504: 上游超时500: 服务异常按以下顺序执行,除非用户明确要求跳过某一步:
user_id 和 session_id。html_payload。answer_text,若用户需要富文本则返回 answer_html。session_id,允许服务端创建。session_id,后续请求必须使用新值。stream=true。401 时,优先提示重新登录,不要盲目重试消息接口。429 或 504 时,最多重试 2 次,退避 500ms。script、style、iframe、object、embed、form、input 标签。user_id 与 session_id 的绑定关系。当接口失败时,Agent 返回格式建议:
调用阶段: <send_code|login|message>
HTTP状态: <status_code>
错误原因: <mapped_reason>
建议动作: <retry|relogin|check_input>
python send_code_client.py --phone 13800138000
python login_client.py --phone 13800138000 --verify-code 123456
python chat_client.py --text "你好,帮我推荐一个通勤淡妆"
python chat_client.py --multi-turn
共 1 个版本