roleModel.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='角色模板'></cus-header>
  4. <div class="title">选择角色模板<span>*</span></div>
  5. <div class="list">
  6. <div class="pre" v-for="(item,index) in list" :key="index" :class="{'active':midx===index}" @tap="changeModel(item,index)">
  7. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/8e24c230-a530-48ae-a2ed-d41262b9a051.png" v-if="midx===index"></image>
  8. {{item.agentName}}
  9. </div>
  10. </div>
  11. <div class="adffcacjc">
  12. <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/05/29/24380873-b8d7-413c-8d9d-d997fe13685d.png"></image>
  13. <p>{{agentDto.agentName||''}}</p>
  14. </div>
  15. <div class="desc">
  16. <!-- <u-read-more :toggle="true" showHeight="300rpx">
  17. <rich-text :nodes="agentDto.systemPrompt||''"></rich-text>
  18. </u-read-more> -->
  19. <!-- {{agentDto.systemPrompt||''}} -->
  20. <u-textarea v-model="agentDto.systemPrompt" autoHeight :maxlength="-1" border="none" disabled="disabled"></u-textarea>
  21. </div>
  22. <div class="zt_btn" @tap="confirm">确认选择</div>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data(){
  28. return {
  29. midx:0,
  30. list:[],
  31. agentDto:null,
  32. modelMap:new Map()
  33. }
  34. },
  35. onLoad() {
  36. this.getAgentModelList()
  37. },
  38. methods:{
  39. getAgentModelList(){
  40. this.$api.get('/agent/template').then(res=>{
  41. if(res.data.code!==0) return this.$showToast(res.data.msg)
  42. this.list = res.data.data;
  43. if(this.list.length){
  44. this.agentDto = this.list[0];
  45. let map = new Map();
  46. this.list.forEach(l=>{
  47. map.set(l.agentName,l)
  48. })
  49. this.modelMap = map;
  50. }
  51. })
  52. },
  53. changeModel(item,index){
  54. this.midx = index;
  55. this.agentDto = this.modelMap.get(item.agentName);
  56. },
  57. confirm(){
  58. this.getOpenerEventChannel().emit('selectRoleModel',this.agentDto)
  59. uni.navigateBack();
  60. }
  61. }
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. ::v-deep .desc .u-textarea{
  66. padding: 0 20rpx !important;
  67. font-size: 26rpx !important;
  68. color: #7C8592 !important;
  69. line-height: 37rpx !important;
  70. background: transparent !important;
  71. }
  72. .page{
  73. width: 100%;
  74. background: #FFFFFF;
  75. padding: 0 30rpx 150rpx;
  76. box-sizing: border-box;
  77. .title{
  78. font-family: PingFang-SC, PingFang-SC;
  79. font-weight: bold;
  80. font-size: 32rpx;
  81. color: #111111;
  82. line-height: 32rpx;
  83. margin-top: 30rpx;
  84. span{
  85. color: #F31616;
  86. }
  87. }
  88. .list{
  89. width: 100%;
  90. margin-top: 12rpx;
  91. display: flex;
  92. flex-wrap: wrap;
  93. margin-left: -10rpx;
  94. .pre{
  95. margin-top: 20rpx;
  96. margin-left: 15rpx;
  97. width: calc(100% / 3 - 21rpx);
  98. height: 80rpx;
  99. background: #FFFFFF;
  100. border-radius: 16rpx;
  101. border: 1rpx solid #C7C7C7;
  102. font-family: PingFangSC, PingFang SC;
  103. font-weight: 400;
  104. font-size: 28rpx;
  105. color: #333333;
  106. line-height: 80rpx;
  107. text-align: center;
  108. position: relative;
  109. &.active{
  110. background: #D9F159;
  111. border: 1rpx solid #D9F159;
  112. font-weight: bold;
  113. color: #111111;
  114. }
  115. image{
  116. width: 48rpx;
  117. height: 48rpx;
  118. position: absolute;
  119. right: 0;
  120. bottom: 0;
  121. z-index: 22;
  122. }
  123. }
  124. }
  125. .adffcacjc image{
  126. width: 240rpx;
  127. height: 240rpx;
  128. margin-top: 95rpx;
  129. }
  130. p{
  131. font-family: PingFang-SC, PingFang-SC;
  132. font-weight: bold;
  133. font-size: 48rpx;
  134. color: #111111;
  135. line-height: 67rpx;
  136. text-align: center;
  137. margin-top: 24rpx;
  138. }
  139. .desc{
  140. font-family: PingFangSC, PingFang SC;
  141. font-weight: 400;
  142. font-size: 26rpx;
  143. color: #7C8592;
  144. line-height: 37rpx;
  145. margin-top: 36rpx;
  146. }
  147. .zt_btn{
  148. width: calc(100% - 60rpx);
  149. position: fixed;
  150. left: 30rpx;
  151. bottom: 30rpx;
  152. z-index: 999;
  153. }
  154. }
  155. </style>