token-config-injection.txt 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "tokenConfig": {
  2. "type": "bearer",
  3. "configFile": "~/.openclaw/voc-credentials.json",
  4. "tokenField": "vocToken",
  5. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  6. "resolutionOrder": ["configFile", "currentToken"],
  7. "apigId": "Vo3ROWEvDy",
  8. "paymentUrlResolution": {
  9. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  10. "steps": [
  11. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  12. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  13. "3. 拼接充值URL: https://pwa.fmode.cn/apig-pay.html?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  14. "4. 将该URL展示给用户,引导扫码支付"
  15. ],
  16. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  17. "userResolveHeaders": {
  18. "X-Parse-Application-Id": "ncloudmaster",
  19. "X-Parse-Session-Token": "{vocToken}"
  20. },
  21. "paymentBaseUrl": "https://pwa.fmode.cn/apig-pay.html",
  22. "paymentParams": {
  23. "user": "{resolvedUserId}",
  24. "apigid": "Vo3ROWEvDy",
  25. "fun_id": "HOkkX72PMF"
  26. },
  27. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  28. },
  29. "onMissing": {
  30. "action": "resolveUserThenShowPayment",
  31. "title": "扫码开通 VOC-AI 数据服务",
  32. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  33. },
  34. "onBalanceInsufficient": {
  35. "action": "resolveUserThenShowPayment",
  36. "title": "VOC-AI Token 余额不足,请扫码充值",
  37. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  38. }
  39. },
  40. "errorHandling": {
  41. "balanceInsufficient": {
  42. "conditions": [
  43. { "responseField": "code", "operator": "in", "value": [-2, -3, -10, 402, 429] },
  44. { "responseField": "msg", "operator": "contains", "value": ["余额不足", "insufficient", "balance", "quota"] },
  45. { "responseField": "message", "operator": "contains", "value": ["余额不足", "insufficient", "balance"] }
  46. ],
  47. "matchMode": "any",
  48. "trigger": "tokenConfig.onBalanceInsufficient"
  49. },
  50. "unauthorized": {
  51. "conditions": [
  52. { "responseField": "code", "operator": "in", "value": [401, 403] },
  53. { "responseField": "msg", "operator": "contains", "value": ["unauthorized", "token", "invalid", "auth"] }
  54. ],
  55. "matchMode": "any",
  56. "trigger": "tokenConfig.onMissing"
  57. }
  58. }