avatar.api 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import "../base.api"
  2. type (
  3. AvatarInfo {
  4. RequestId *string `json:"requestId"`
  5. SessionId *string `json:"SessionId"`
  6. Token *string `json:"token"`
  7. Channel Channel `json:"channel"`
  8. }
  9. Channel {
  10. ChannelId *string `json:"channelId"`
  11. Token *string `json:"token"`
  12. Type *string `json:"type"`
  13. ExpiredTime *string `json:"expiredTime"`
  14. Nonce *string `json:"nonce"`
  15. UserId *string `json:"userId"`
  16. AppId *string `json:"appId"`
  17. UserInfoInChannel *string `json:"userInfoInChannel"`
  18. Gslb []*string `json:"gslb"`
  19. }
  20. // start avatar request | 启动数字人
  21. AvatarConfigReq {
  22. // 名片 ID
  23. CardId *uint64 `json:"card_id,optional"`
  24. }
  25. // start avatar response | 启动数字人
  26. AvatarConfigResp {
  27. BaseDataInfo
  28. // Agent information | Agent数据
  29. Data AvatarInfo `json:"data"`
  30. Extra Extra `json:"extra"`
  31. }
  32. Extra {
  33. Live int64 `json:"live"`
  34. Total int64 `json:"total"`
  35. }
  36. AvatarStsResp {
  37. BaseDataInfo
  38. // Sts information | Sts 数据
  39. Data StsInfo `json:"data"`
  40. }
  41. StsInfo {
  42. Expiration *string `json:"expiration"`
  43. AccessKeyId *string `json:"accessKeyId"`
  44. AccessKeySecret *string `json:"accessKeySecret"`
  45. SecurityToken *string `json:"securityToken"`
  46. RequestId *string `json:"requestId"`
  47. }
  48. AvatarSignatureResp {
  49. BaseDataInfo
  50. // Sts information | Sts 数据
  51. Data SignatureInfo `json:"data"`
  52. }
  53. SignatureInfo {
  54. Key *string `json:"key"`
  55. OSSAccessKeyId *string `json:"OSSAccessKeyId"`
  56. Policy *string `json:"policy"`
  57. Signature *string `json:"signature"`
  58. }
  59. // send text | 数字人-发送消息
  60. SendTextReq {
  61. CardId *uint64 `json:"cardId"`
  62. SessionId *string `json:"sessionId"`
  63. Text *string `json:"text"`
  64. IsStream *bool `json:"isStream,optional"`
  65. Index *int32 `json:"index,optional"`
  66. Position *string `json:"position,optional"`
  67. }
  68. SendTextResp {
  69. BaseDataInfo
  70. Data SendText `json:"data"`
  71. }
  72. SendText {
  73. SessionId *string `json:"sessionId"`
  74. UniqueCode *string `json:"uniqueCode"`
  75. }
  76. // stop instance | 数字人-停止实例
  77. StopInstanceReq {
  78. CardId *uint64 `json:"cardId"`
  79. SessionId *string `json:"sessionId"`
  80. }
  81. StopInstanceResp {
  82. BaseDataInfo
  83. Data StopInstance `json:"data"`
  84. }
  85. StopInstance {
  86. SessionId *string `json:"sessionId"`
  87. RequestId *string `json:"requestId"`
  88. }
  89. )
  90. @server(
  91. jwt: Auth
  92. group: avatar
  93. middleware: Miniprogram
  94. )
  95. service Wechat {
  96. // get avatar configuration | 获取数字人配置信息
  97. @handler getApiAvatarConfig
  98. post /api/avatar/config (AvatarConfigReq) returns (AvatarConfigResp)
  99. // send text | 发送消息
  100. @handler sendApiAvatarText
  101. post /api/avatar/sendText (SendTextReq) returns (SendTextResp)
  102. // stop avatar instance | 停止数字人实例
  103. @handler stopApiAvatar
  104. post /api/avatar/stop (StopInstanceReq) returns (StopInstanceResp)
  105. // get avatar configuration | 阿里云sts
  106. @handler getAcsResponse
  107. post /api/avatar/sts () returns (AvatarStsResp)
  108. // get avatar configuration | 阿里云oss服务签名
  109. @handler getSignatureResponse
  110. post /api/avatar/signature () returns (AvatarSignatureResp)
  111. }