| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 | 
							- <template>
 
- 	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
 
- 		<cus-header title='角色模板'></cus-header>
 
- 		<div class="title">选择角色模板<span>*</span></div>
 
- 		<div class="list">
 
- 			<div class="pre" v-for="(item,index) in list" :key="index" :class="{'active':midx===index}" @tap="changeModel(item,index)">
 
- 				<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/6fa67877-0c16-4393-aa45-9d4850481d51.png" v-if="midx===index"></image>
 
- 				{{item.agentName}}
 
- 			</div>
 
- 		</div>
 
- 		<div class="adffcacjc">
 
- 			<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/e730d0d5-8dde-4fa3-8ea8-1fea9860a6f5.png"></image>
 
- 			<p>{{agentDto.agentName||''}}</p>
 
- 		</div>
 
- 		<div class="desc">
 
- 			<!-- <u-read-more :toggle="true" showHeight="300rpx">
 
- 				<rich-text :nodes="agentDto.systemPrompt||''"></rich-text>
 
- 			</u-read-more> -->
 
- 			<!-- {{agentDto.systemPrompt||''}} -->
 
- 			<u-textarea v-model="agentDto.systemPrompt" autoHeight :maxlength="-1" border="none" disabled="disabled"></u-textarea>
 
- 		</div>
 
- 		<div class="zt_btn" @tap="confirm">确认选择</div>
 
- 	</view>
 
- </template>
 
- <script>
 
- 	export default {
 
- 		data(){
 
- 			return {
 
- 				midx:0,
 
- 				list:[],
 
- 				agentDto:null,
 
- 				modelMap:new Map()
 
- 			}
 
- 		},
 
- 		onLoad() {
 
- 			this.getAgentModelList()
 
- 		},
 
- 		methods:{
 
- 			getAgentModelList(){
 
- 				this.$api.get('/agent/template').then(res=>{
 
- 					if(res.data.code!==0) return this.$showToast(res.data.msg)
 
- 					this.list = res.data.data;
 
- 					if(this.list.length){
 
- 						this.agentDto = this.list[0];
 
- 						let map = new Map();
 
- 						this.list.forEach(l=>{
 
- 							map.set(l.agentName,l)
 
- 						})
 
- 						this.modelMap = map;
 
- 					}
 
- 				})
 
- 			},
 
- 			changeModel(item,index){
 
- 				this.midx = index;
 
- 				this.agentDto = this.modelMap.get(item.agentName);
 
- 			},
 
- 			confirm(){
 
- 				let dto = JSON.parse(JSON.stringify(this.agentDto));
 
- 				delete dto.agentName;
 
- 				this.getOpenerEventChannel().emit('selectRoleModel',dto)
 
- 				uni.navigateBack();
 
- 			}
 
- 		}
 
- 	}
 
- </script>
 
- <style scoped lang="scss">
 
- 	::v-deep .desc .u-textarea{
 
- 		padding: 0 20rpx !important;
 
- 		font-size: 26rpx !important;
 
- 		color: #7C8592 !important;
 
- 		line-height: 37rpx !important;
 
- 		background: transparent !important;
 
- 	}
 
- 	
 
- 	.page{
 
- 		width: 100%;
 
- 		background: #FFFFFF;
 
- 		padding: 0 30rpx 150rpx;
 
- 		box-sizing: border-box;
 
- 		.title{
 
- 			font-family: PingFang-SC, PingFang-SC;
 
- 			font-weight: bold;
 
- 			font-size: 32rpx;
 
- 			color: #111111;
 
- 			line-height: 32rpx;
 
- 			margin-top: 30rpx;
 
- 			span{
 
- 				color: #F31616;
 
- 			}
 
- 		}
 
- 		
 
- 		.list{
 
- 			width: 100%;
 
- 			margin-top: 12rpx;
 
- 			display: flex;
 
- 			flex-wrap: wrap;
 
- 			margin-left: -10rpx;
 
- 			.pre{
 
- 				margin-top: 20rpx;
 
- 				margin-left: 15rpx;
 
- 				width: calc(100% / 3 - 21rpx);
 
- 				height: 80rpx;
 
- 				background: #FFFFFF;
 
- 				border-radius: 16rpx;
 
- 				border: 1rpx solid #C7C7C7;
 
- 				font-family: PingFangSC, PingFang SC;
 
- 				font-weight: 400;
 
- 				font-size: 28rpx;
 
- 				color: #333333;
 
- 				line-height: 80rpx;
 
- 				text-align: center;
 
- 				position: relative;
 
- 				&.active{
 
- 					background: #D9F159;
 
- 					border: 1rpx solid #D9F159;
 
- 					font-weight: bold;
 
- 					color: #111111;
 
- 				}
 
- 				image{
 
- 					width: 48rpx;
 
- 					height: 48rpx;
 
- 					position: absolute;
 
- 					right: 0;
 
- 					bottom: 0;
 
- 					z-index: 22;
 
- 				}
 
- 			}
 
- 		}
 
- 		
 
- 		.adffcacjc image{
 
- 			width: 240rpx;
 
- 			height: 240rpx;
 
- 			margin-top: 95rpx;
 
- 		}
 
- 		p{
 
- 			font-family: PingFang-SC, PingFang-SC;
 
- 			font-weight: bold;
 
- 			font-size: 48rpx;
 
- 			color: #111111;
 
- 			line-height: 67rpx;
 
- 			text-align: center;
 
- 			margin-top: 24rpx;
 
- 		}
 
- 		.desc{
 
- 			font-family: PingFangSC, PingFang SC;
 
- 			font-weight: 400;
 
- 			font-size: 26rpx;
 
- 			color: #7C8592;
 
- 			line-height: 37rpx;
 
- 			margin-top: 36rpx;
 
- 		}
 
- 		.zt_btn{
 
- 			width: calc(100% - 60rpx);
 
- 			position: fixed;
 
- 			left: 30rpx;
 
- 			bottom: 30rpx;
 
- 			z-index: 999;
 
- 		}
 
- 	}
 
- </style>
 
 
  |