roleDetail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='角色详情' bgColor="transparent"></cus-header>
  4. <div class="box">
  5. <div class="title adfac">角色形象</div>
  6. <div class="upload">
  7. <div class="sc">
  8. <div class="imgs">
  9. <image class="img1" src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/44f91a62-29c1-4d1f-8064-0d7579da2fb0.png"></image>
  10. </div>
  11. </div>
  12. </div>
  13. </div>
  14. <div class="box adfacjb">
  15. <div class="title">角色昵称</div>
  16. <input type="text" v-model="agentDto.agentName" placeholder="请输入角色昵称" placeholder-class="ph" disabled>
  17. </div>
  18. <div class="box">
  19. <div class="top adfacjb">
  20. <div class="title">设定描述</div>
  21. </div>
  22. <div class="desc"><u-textarea v-model="agentDto.systemPrompt" :focus="focus" autoHeight :maxlength="-1" border="none" disabled></u-textarea>
  23. </div>
  24. </div>
  25. <div class="box adfacjb">
  26. <div class="title">声音</div>
  27. <div class="right adfac" @tap="show=true">
  28. <div class="mtext active">{{voiceText}}</div>
  29. </div>
  30. </div>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data(){
  36. return {
  37. agentId:'',
  38. deviceId:'',
  39. voiceText:'',
  40. agentDto:{
  41. "agentName": "",
  42. "asrModelId": "",
  43. "vadModelId": "",
  44. "llmModelId": "",
  45. "ttsModelId": "",
  46. "ttsVoiceId": "",
  47. "memModelId": "",
  48. "intentModelId": "",
  49. "systemPrompt": "",
  50. "langCode": "",
  51. "language": "",
  52. "deviceId": "",
  53. "chatHistoryConf": ""
  54. }
  55. }
  56. },
  57. onLoad(option) {
  58. if(option.agentId){
  59. this.agentId = option.agentId;
  60. this.getDetail();
  61. }
  62. },
  63. methods:{
  64. getDetail(){
  65. this.$api.get(`/agent/${this.agentId}`).then(res=>{
  66. if(res.data.code!==0) return this.$showToast(res.data.msg)
  67. this.agentDto = {...this.agentDto,...res.data.data};
  68. this.getModelVoiceList();
  69. })
  70. },
  71. getModelVoiceList(){
  72. this.$api.get(`/models/${this.agentDto.ttsModelId}/voices`).then(res=>{
  73. if(res.data.code!==0) return this.$showToast(res.data.msg)
  74. this.voiceText = res.data.data.find(v=>v.id===this.agentDto.ttsVoiceId)?.name||'未选择音色';
  75. })
  76. }
  77. }
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. ::v-deep .desc .u-textarea{
  82. padding: 0 !important;
  83. background-color: transparent !important;
  84. }
  85. .ph{
  86. font-family: PingFangSC, PingFang SC;
  87. font-weight: 400;
  88. font-size: 28rpx;
  89. color: #A6A6A6;
  90. line-height: 40rpx;
  91. text-align: right;
  92. }
  93. .page{
  94. background: #F7F6F9;
  95. padding: 0 30rpx 30rpx;
  96. box-sizing: border-box;
  97. .box{
  98. background: #FFFFFF;
  99. border-radius: 24rpx;
  100. margin-top: 20rpx;
  101. width: 100%;
  102. padding: 40rpx 30rpx;
  103. box-sizing: border-box;
  104. .title{
  105. font-family: PingFang-SC, PingFang-SC;
  106. font-weight: bold;
  107. font-size: 30rpx;
  108. color: #111111;
  109. line-height: 32rpx;
  110. span{
  111. font-size: 32rpx;
  112. color: #F31616;
  113. }
  114. }
  115. .upload{
  116. margin-top: 12rpx;
  117. display: flex;
  118. flex-direction: column;
  119. align-items: center;
  120. .sc{
  121. width: 188rpx;
  122. height: 188rpx;
  123. }
  124. .text{
  125. font-family: PingFangSC, PingFang SC;
  126. font-weight: 400;
  127. font-size: 26rpx;
  128. color: #A6A6A6;
  129. line-height: 37rpx;
  130. text-align: center;
  131. margin-top: 8rpx;
  132. }
  133. }
  134. .right{
  135. .mtext{
  136. font-family: PingFangSC, PingFang SC;
  137. font-weight: 400;
  138. font-size: 28rpx;
  139. color: #A6A6A6;
  140. line-height: 40rpx;
  141. text-align: right;
  142. &.active{
  143. color: #111111;
  144. }
  145. }
  146. image{
  147. width: 36rpx;
  148. height: 36rpx;
  149. margin-left: 10rpx;
  150. }
  151. }
  152. .desc{
  153. margin-top: 20rpx;
  154. min-height: 200rpx;
  155. overflow-y: auto;
  156. }
  157. .tip{
  158. font-family: PingFangSC, PingFang SC;
  159. font-weight: 400;
  160. font-size: 28rpx;
  161. color: #1B50FF;
  162. line-height: 40rpx;
  163. text-align: right;
  164. }
  165. .imgs{
  166. width: 188rpx;
  167. height: 188rpx;
  168. border-radius: 50%;
  169. position: relative;
  170. .img1{
  171. width: 188rpx;
  172. height: 188rpx;
  173. border-radius: 50%;
  174. position: absolute;
  175. z-index: 2;
  176. }
  177. .img2{
  178. width: 42rpx;
  179. height: 42rpx;
  180. position: absolute;
  181. right: 0;
  182. bottom: 0;
  183. z-index: 3;
  184. }
  185. }
  186. }
  187. .zt_btn{
  188. margin-top: 54rpx;
  189. }
  190. input{
  191. border: none;
  192. text-align: right;
  193. font-size: 28rpx;
  194. }
  195. }
  196. </style>