Tafu BaZi
Use this skill when the user asks for:
- - 八字 / BaZi 排盘
- 主题解读,例如性格底色、事业财富、感情、健康、年度运势
- 双人合盘 / compatibility / synastry
- 灵魂歌曲
Tafu is the source of truth for all chart math and paid analysis. Do not improvise the actual BaZi chart or paid reading if the API is available.
Preconditions
- - The host should inject
TAFU_API_KEY from skills.entries.tafu_bazi.apiKey. - Optional override:
skills.entries.tafu_bazi.env.TAFU_API_BASE_URL. - If the key is missing, stop and tell the user to create a key at
https://tafu.me/developers, then configure skills.entries.tafu_bazi.apiKey.
Use {baseDir}/scripts/tafu_api.sh for every API call. It reads:
- - INLINECODE6
- INLINECODE7 if present
- otherwise defaults to INLINECODE8
If you need concrete payload examples, read {baseDir}/references/examples.md.
Input Rules
- - Collect the user's language and reply in that language.
- Ask for missing required birth fields before calling paid endpoints.
- For best accuracy, collect:
- date
- time
- gender
- birthplace or current city-level location
- calendar type when the user gives a lunar date
- - If the birth minute is unknown, ask once. If the user still does not know, call out the assumption before using
00. - If the user gives a lunar date and the month could be leap, use
GET /bazi/leap-month/:year before confirming isLeapMonth. - If the user gives a free-form location and it looks ambiguous, use
GET /bazi/coordinates?location=... first.
API Workflow
1. Deterministic charting
For raw chart calculation, call:
Use the normalized JSON payload expected by the API. Prefer these keys:
- - INLINECODE15
- INLINECODE16
- INLINECODE17
- INLINECODE18
- INLINECODE19
- INLINECODE20
- INLINECODE21
- INLINECODE22
- INLINECODE23
2. Paid thematic reading
For a single-person reading, call:
Payload:
- - INLINECODE25
- INLINECODE26
Valid theme values:
- - INLINECODE28
- INLINECODE29
- INLINECODE30
- INLINECODE31
- INLINECODE32
- INLINECODE33
3. Soul song
For soul-song generation, call:
Payload:
4. Synastry
For two-person compatibility, call:
Payload:
- - INLINECODE37
- INLINECODE38
5. Polling async tasks
INLINECODE39 , /soul-song, and /synastry may return an already completed result or an async task.
If the response includes a result, use it immediately.
If the response includes taskId and status:
- 1. Poll INLINECODE45
- Wait about 5 seconds between polls
- Poll up to 12 times, or stop earlier if status becomes
completed or INLINECODE47 - If it is still pending after the polling window, tell the user the task is still running and include the INLINECODE48
Output Rules
- - Preserve the API result as the factual source.
- You may add a short top summary, but do not discard or rewrite away important structured output.
- Surface
creditsUsed and creditsRemaining when returned. - If the API returns
viewUrl, include it. - On
402 or INSUFFICIENT_CREDITS, tell the user to recharge Credits at https://tafu.me/developers/billing. - On
401 or INVALID_API_KEY, tell the user to rotate or reconfigure the API key. - On input validation errors, ask for the missing or invalid field instead of guessing.
- If the API fails, do not fall back to a hallucinated BaZi reading.
Execution Notes
- - Keep secrets out of the chat transcript.
- Use temporary JSON files for complex payloads instead of long inline shell escaping.
- Only call paid endpoints after the user has clearly asked for that capability.
Tafu 八字
当用户请求以下内容时使用此技能:
- - 八字 / BaZi 排盘
- 主题解读,例如性格底色、事业财富、感情、健康、年度运势
- 双人合盘 / compatibility / synastry
- 灵魂歌曲
Tafu 是所有排盘计算和付费分析的权威来源。如果 API 可用,请勿自行编造实际八字盘或付费解读。
前置条件
- - 宿主应从 skills.entries.tafubazi.apiKey 注入 TAFUAPIKEY。
- 可选覆盖项:skills.entries.tafubazi.env.TAFUAPIBASEURL。
- 如果密钥缺失,请停止并告知用户在 https://tafu.me/developers 创建密钥,然后配置 skills.entries.tafubazi.apiKey。
每次 API 调用均使用 {baseDir}/scripts/tafu_api.sh。该脚本读取:
- - TAFUAPIKEY
- TAFUAPIBASE_URL(若存在)
- 否则默认为 https://api.tafu.me/api/v1
如需具体请求体示例,请阅读 {baseDir}/references/examples.md。
输入规则
- - 收集用户的语言,并以该语言回复。
- 在调用付费接口前,询问缺失的必要出生信息。
- 为获得最佳准确性,请收集:
- 日期
- 时间
- 性别
- 出生地或当前城市级位置
- 用户提供农历日期时的历法类型
- - 如果出生分钟未知,询问一次。若用户仍不知道,在使用 00 前说明该假设。
- 如果用户提供农历日期且月份可能为闰月,在确认 isLeapMonth 前使用 GET /bazi/leap-month/:year。
- 如果用户提供自由格式的位置且看起来有歧义,先使用 GET /bazi/coordinates?location=...。
API 工作流程
1. 确定性排盘
对于原始排盘计算,调用:
使用 API 期望的标准化 JSON 请求体。优先使用以下键:
- - gender
- calendarType
- birthYear
- birthMonth
- birthDay
- birthHour
- birthMinute
- isLeapMonth
- location
2. 付费主题解读
对于单人解读,调用:
请求体:
有效的 theme 值:
- - lifecolor
- relationship
- careerwealth
- health
- lifelesson
- yearlyfortune
3. 灵魂歌曲
对于灵魂歌曲生成,调用:
请求体:
4. 合盘
对于双人合盘,调用:
请求体:
5. 轮询异步任务
/reading、/soul-song 和 /synastry 可能返回已完成的结果或异步任务。
如果响应包含 result,立即使用。
如果响应包含 taskId 和 status:
- 1. 轮询 GET /tasks/
- 每次轮询间隔约 5 秒
- 最多轮询 12 次,或在状态变为 completed 或 failed 时提前停止
- 如果轮询窗口结束后任务仍处于待处理状态,告知用户任务仍在运行,并包含 taskId
输出规则
- - 保留 API 结果作为事实来源。
- 可以添加简短顶部摘要,但不要丢弃或重写重要的结构化输出。
- 当返回 creditsUsed 和 creditsRemaining 时,予以展示。
- 如果 API 返回 viewUrl,请包含它。
- 对于 402 或 INSUFFICIENTCREDITS,告知用户在 https://tafu.me/developers/billing 充值积分。
- 对于 401 或 INVALIDAPI_KEY,告知用户轮换或重新配置 API 密钥。
- 对于输入验证错误,询问缺失或无效的字段,而不是猜测。
- 如果 API 失败,不要退回到虚构的八字解读。
执行说明
- - 将密钥信息排除在聊天记录之外。
- 对于复杂的请求体,使用临时 JSON 文件,而不是长内联 shell 转义。
- 仅在用户明确请求该功能后,才调用付费接口。