chat.vue 18.2 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1
<template>
DCloud_JSON's avatar
DCloud_JSON 已提交
2 3
	<view class="page">
		<view class="container">
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
4
			<view v-if="isWidescreen" class="header">uni-ai-chat</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
5 6
			<text class="noData" v-if="msgList.length === 0">没有对话记录</text>
			<scroll-view :scroll-into-view="scrollIntoView" scroll-y="true" class="msg-list" :enable-flex="true">
DCloud_JSON's avatar
DCloud_JSON 已提交
7 8 9
				<view v-for="(msg,index) in msgList"  class="msg-item" :key="index">
					<view class="create_time-box">
						<uni-dateformat class="create_time" :date="msg.create_time" format="MM/dd hh:mm:ss"></uni-dateformat>
DCloud_JSON's avatar
DCloud_JSON 已提交
10 11 12 13 14
					</view>
					<view :class="{reverse:!msg.isAi}">
						<view class="userInfo">
							<image class="avatar" :src="msg.isAi?'../../static/uni-ai.png':'../../static/avatar.png'" mode="widthFix"></image>
						</view>
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
15
						<view class="content">
DCloud_JSON's avatar
DCloud_JSON 已提交
16
							<!-- <text class="copy" @click="copy">复制</text> -->
17
							<uni-ai-msg :md="msg.content" :show-cursor="index == msgList.length-1 && msg.isAi && sseIndex"></uni-ai-msg>
18
							<view v-if="index == msgList.length-1 && adpid && msg.insufficientScore">
19
								<uni-ad-rewarded-video :adpid="adpid" @onAdClose="onAdClose"></uni-ad-rewarded-video>
DCloud_JSON's avatar
DCloud_JSON 已提交
20 21 22 23 24 25 26
							</view>
						</view>
						<uni-icons v-if="index == msgList.length-1 && !msg.isAi && msg.state != 100 && msgStateIcon(msg)"
							@click="msg.state == -100 ? retriesSendMsg() : ''" :color="msg.state===0?'#999':'#d22'"
							:type="msgStateIcon(msg)" class="msgStateIcon">
						</uni-icons>
					</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
27 28 29 30 31 32
				</view>
				<view class="tip-ai-ing" v-if="msgList.length && msgList.length%2 !== 0">
					<text>uni-ai正在思考中...</text>
					<view v-if="NODE_ENV == 'development' && !stream">
						如需提速,请开通<uni-link class="uni-link" href="https://uniapp.dcloud.net.cn/uniCloud/uni-ai-chat.html" text="[流式响应]"></uni-link>
					</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
33 34 35 36
				</view>
				<view id="last-msg-item"></view>
			</scroll-view>

DCloud_JSON's avatar
DCloud_JSON 已提交
37 38 39 40 41
			<view class="foot-box">
				<view class="menu" v-if="isWidescreen">
					<view class="trash menu-item">
						<image @click="clear" src="@/static/remove.png" mode="heightFix"></image>
					</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
42
				</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
43

DCloud_JSON's avatar
DCloud_JSON 已提交
44 45 46 47 48
				<view class="foot-box-content">
					<view v-if="!isWidescreen" class="trash">
						<uni-icons @click="clear" type="trash" size="24" color="#888"></uni-icons>
					</view>
					<view class="textarea-box">
DCloud_JSON's avatar
DCloud_JSON 已提交
49
						<textarea v-model="content" :cursor-spacing="15"  class="textarea" :auto-height="!isWidescreen" :disabled="inputBoxDisabled"
DCloud_JSON's avatar
DCloud_JSON 已提交
50 51 52 53 54 55
							:placeholder="placeholderText" :maxlength="-1" placeholder-class="input-placeholder"></textarea>
					</view>
					<view class="send-btn-box">
						<text v-if="isWidescreen" class="send-btn-tip">↵ 发送 / shift + ↵ 换行</text>
						<button @click="beforeSendMsg" :disabled="inputBoxDisabled || !content" class="send" type="primary">发送</button>
					</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
56
				</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
57
			</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
58
		</view>
DCloud_JSON's avatar
DCloud_JSON 已提交
59 60 61
	</view>
</template>

62 63
<script>
	import config from '@/config.js';
DCloud_JSON's avatar
DCloud_JSON 已提交
64
	const {adpid} = config
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
65 66 67
	let sseChannel = false;
	// 是否通过回调,当用户点击清空后应当跳过前一次请求的回调
	let skip_callback = false;
DCloud_JSON's avatar
DCloud_JSON 已提交
68 69 70 71 72 73
	export default {
		data() {
			return {
				scrollIntoView: "",
				msgList: [],
				content: "",
DCloud_JSON's avatar
DCloud_JSON 已提交
74
				sseIndex: 0,
DCloud_JSON's avatar
DCloud_JSON 已提交
75
				stream:true,
76
				isWidescreen:false,
DCloud_JSON's avatar
DCloud_JSON 已提交
77 78 79
				adpid
			}
		},
DCloud_JSON's avatar
DCloud_JSON 已提交
80
		computed: {
DCloud_JSON's avatar
DCloud_JSON 已提交
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
			inputBoxDisabled() {
				if (this.sseIndex !== 0) {
					return true
				}
				return !!(this.msgList.length && this.msgList.length%2 !== 0)
			},
			placeholderText() {
				if (this.inputBoxDisabled) {
					return 'uni-ai正在回复中'
				} else {
					// #ifdef H5
					return window.innerWidth > 960 ? '请输入内容,ctrl + enter 发送' : '请输入要发给uni-ai的内容'
					// #endif
					return '请输入要发给uni-ai的内容'
				}
DCloud_JSON's avatar
DCloud_JSON 已提交
96 97 98
			},
			NODE_ENV(){
				return process.env.NODE_ENV
DCloud_JSON's avatar
DCloud_JSON 已提交
99 100
			}
		},
101 102 103
		watch: {
			msgList:{
				handler(msgList) {
DCloud_JSON's avatar
DCloud_JSON 已提交
104
					uni.setStorageSync('uni-ai-msg', msgList)
105 106
				},
				deep:true
DCloud_JSON's avatar
DCloud_JSON 已提交
107 108
			}
		},
DCloud_JSON's avatar
DCloud_JSON 已提交
109
		async mounted() {
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
			if(this.adpid && uniCloud.getCurrentUserInfo().tokenExpired > Date.now()){
				let db = uniCloud.databaseForJQL();
				let res = await db.collection("uni-id-users")
												.where({
													"_id":uniCloud.getCurrentUserInfo().uid
												})
												.field('score')
												.get()
				console.log('当前用户有多少积分:',res.data[0] && res.data[0].score);
			}

			
			// let {score} = res.result.data[0] || {}
			// console.log('score',score);
			
			
DCloud_JSON's avatar
DCloud_JSON 已提交
126 127 128 129 130 131 132 133
			// for (let i = 0; i < 15; i++) {
			// 	this.msgList.push({
			// 		isAi: i % 2 == true,
			// 		content: "1-" + i
			// 	})
			// }

			this.msgList = uni.getStorageSync('uni-ai-msg') || []
134 135 136 137 138 139 140 141 142 143 144
			
			
			// 如果上一次对话中 最后一条消息ai未回复。则一启动就自动重发。
			let length = this.msgList.length
			if(length){
				let lastMsg = this.msgList[length - 1]
				if(!lastMsg.isAi){
					this.retriesSendMsg()
				}
			}
			
DCloud_JSON's avatar
DCloud_JSON 已提交
145 146 147

			// this.msgList.pop()
			// console.log('this.msgList', this.msgList);
DCloud_JSON's avatar
DCloud_JSON 已提交
148 149 150 151 152 153 154 155 156 157 158 159 160 161
			this.showLastMsg()
			
			// #ifdef H5
			//获得消息输入框对象
			let adjunctKeydown = false
			const textareaDom = document.querySelector('.textarea-box textarea');
			if (textareaDom) {
				//键盘按下时
				textareaDom.onkeydown = e => {
					// console.log('onkeydown', e.keyCode)
					if ([16, 17, 18, 93].includes(e.keyCode)) {
						//按下了shift ctrl alt windows键
						adjunctKeydown = true;
					}
DCloud_JSON's avatar
DCloud_JSON 已提交
162
					if (e.keyCode == 13 && !adjunctKeydown) {
163 164 165
						setTimeout(()=> {
							this.beforeSendMsg();
						}, 100);
DCloud_JSON's avatar
DCloud_JSON 已提交
166 167 168 169 170 171 172 173 174
					}
				};
				textareaDom.onkeyup = e => {
					//松开adjunct键
					if ([16, 17, 18, 93].includes(e.keyCode)) {
						adjunctKeydown = false;
					}
				};
			}
DCloud_JSON's avatar
DCloud_JSON 已提交
175 176
			// #endif
			
DCloud_JSON's avatar
DCloud_JSON 已提交
177
			// 添加惰性函数,检查是否开通uni-push;决定是否启用stream
DCloud_JSON's avatar
DCloud_JSON 已提交
178
			
179
			// #ifdef H5
DCloud_JSON's avatar
DCloud_JSON 已提交
180 181 182 183 184
			uni.createMediaQueryObserver(this).observe({
				minWidth: 650,
			}, matches => {
				this.isWidescreen = matches;
			})
185
			// #endif
DCloud_JSON's avatar
DCloud_JSON 已提交
186
		},
187 188 189 190 191 192
		// onUnload() {
		// 	if(sseChannel){
		// 		console.log('onUnload','sseChannel.close()');
		// 		sseChannel.close()
		// 	}
		// },
DCloud_JSON's avatar
DCloud_JSON 已提交
193
		methods: {
DCloud_JSON's avatar
DCloud_JSON 已提交
194 195 196 197 198 199 200 201 202
			//检查是否开通uni-push;决定是否启用stream
			async checkIsOpenPush(){
				try{
					await uni.getPushClientId()
					this.checkIsOpenPush = ()=>{}
				}catch(err){
					this.stream = false
				}
			},
203 204
			updateLastMsg(param){
				let length = this.msgList.length
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
205 206 207
				if(length === 0){
					return
				}
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
				let lastMsg = this.msgList[length - 1]
				
				if(typeof param == 'function'){
					let callback = param;
					callback(lastMsg)
				}else{
					const [data,cover = false] = arguments
					if(cover){
						lastMsg = data
					}else{
						lastMsg = Object.assign(lastMsg,data)
					}
				}
				this.msgList.splice(length - 1, 1, lastMsg)
			},
			onAdClose(e){
				console.log('onAdClose e.detail.isEnded',e.detail.isEnded);
225
				
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
				if(e.detail.isEnded){
					//5次轮训查结果
					let i = 0;
					uni.showLoading({mask: true})
					let myIntive = setInterval(async e => {
						i++;
						const db = uniCloud.database();
						let res = await db.collection("uni-id-users")
														.where('"_id" == $cloudEnv_uid')
														.field('score')
														.get()
						let {score} = res.result.data[0] || {}
						// console.log("1111score----------*--",score);
						if(score>0 || i > 5){
							// console.log("22222score----------*--",score);
							clearInterval(myIntive)
							uni.hideLoading()
							if(score>0){
								// console.log("3333score----------*--",score);
								this.msgList.pop()
								this.$nextTick(()=>{
									this.retriesSendMsg()
									uni.showToast({
										title: '积分余额:'+score,
										icon: 'none'
									});
								})
							}
						}
					}, 2000);
				}
			},
DCloud_JSON's avatar
DCloud_JSON 已提交
258 259 260
			async retriesSendMsg() {
				// 检查是否开通uni-push;决定是否启用stream
				await this.checkIsOpenPush()
261
				this.updateLastMsg({state:0})
DCloud_JSON's avatar
DCloud_JSON 已提交
262 263
				this.send()
			},
DCloud_JSON's avatar
DCloud_JSON 已提交
264
			async beforeSendMsg() {
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
				// 如果开启了广告位需要登录
				if(this.adpid){
					let token = uni.getStorageSync('uni_id_token')
					if(!token){
						return uni.showModal({
							content: '启用激励视频,客户端需登录并启用安全网络',
							showCancel: false,
							confirmText:"查看详情",
							complete() {
								let url = "https://uniapp.dcloud.net.cn/uniCloud/uni-ai-chat.html#ad"
								// #ifndef H5
								uni.setClipboardData({
									data:url,
									showToast:false,
									success() {
										uni.showToast({
											title: '已复制文档链接,请到浏览器粘贴浏览',
											icon: 'none',
											duration:5000
										});
									}
								})
								// #endif
								// #ifdef H5
								window.open(url)
								// #endif
							}
						});
					}
				}
				
				
DCloud_JSON's avatar
DCloud_JSON 已提交
297 298 299
				// 检查是否开通uni-push;决定是否启用stream
				await this.checkIsOpenPush()
				
DCloud_JSON's avatar
DCloud_JSON 已提交
300 301 302 303 304 305
				if(!this.content){
					return uni.showToast({
						title: '内容不能为空',
						icon: 'none'
					});
				}
DCloud_JSON's avatar
DCloud_JSON 已提交
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
				
				this.msgList.push({
					isAi: false,
					content: this.content,
					state: 0,
					create_time: Date.now()
				})
				this.showLastMsg()
				// 清空文本内容
				this.$nextTick(() => {
					this.content = ''
				})
				this.send()
			},
			async send() {
				let messages = []
				// 复制一份,消息列表数据
				let msgs = JSON.parse(JSON.stringify(this.msgList))
				// 带总结的消息 index
				let findIndex = [...msgs].reverse().findIndex(item => item.summarize)
				// console.log('findIndex', findIndex)
				if (findIndex != -1) {
					let aiSummaryIndex = msgs.length - findIndex - 1
					// console.log('aiSummaryIndex', aiSummaryIndex)
					msgs[aiSummaryIndex].content = msgs[aiSummaryIndex].summarize
					// 拿最后一条带直接的消息作为与ai对话的msg body
					msgs = msgs.splice(aiSummaryIndex, msgs.length - 1)
				} else {
					// 如果未总结过就直接从末尾拿10条
					msgs = msgs.splice(-10)
				}
337 338 339
				
				// 过滤涉敏问题
				msgs = msgs.filter(msg=>!msg.illegal)
DCloud_JSON's avatar
DCloud_JSON 已提交
340 341 342 343 344 345 346 347 348 349 350 351

				messages = msgs.map(item => {
					let role = "user"
					if (item.isAi) {
						role = item.summarize ? 'system' : 'assistant'
					}
					return {
						content: item.content,
						role
					}
				})

DCloud_JSON's avatar
DCloud_JSON 已提交
352 353 354
				console.log('send to ai messages:', messages);
				
				
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
355
				
DCloud_JSON's avatar
DCloud_JSON 已提交
356
				if(this.stream){
DCloud_JSON's avatar
DCloud_JSON 已提交
357 358 359
					sseChannel = new uniCloud.SSEChannel() // 创建消息通道
					// console.log('sseChannel',sseChannel);
					sseChannel.on('message', (message) => { // 监听message事件
360
						// console.log('on message', message);
DCloud_JSON's avatar
DCloud_JSON 已提交
361 362 363 364 365 366 367 368
						if (this.sseIndex === 0) {
							this.msgList.push({
								isAi: true,
								content: message,
								create_time: Date.now()
							})
							this.showLastMsg()
						} else {
369
							this.updateLastMsg(lastMsg=>{
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
370
								lastMsg.content += message
371
							})
DCloud_JSON's avatar
DCloud_JSON 已提交
372 373 374 375
							this.showLastMsg()
						}
						this.sseIndex++
					})
DCloud_JSON's avatar
DCloud_JSON 已提交
376
					sseChannel.on('end', (e) => { // 监听end事件,如果云端执行end时传了message,会在客户端end事件内收到传递的消息
377
						// console.log('on end', e);
378
						if(e && (e.summarize || e.insufficientScore)){
379 380 381
							this.updateLastMsg(lastMsg=>{
								if(e.summarize){
									lastMsg.summarize = e.summarize
382 383
								}else if (e.insufficientScore){
									lastMsg.insufficientScore
384 385
								}
							})
DCloud_JSON's avatar
DCloud_JSON 已提交
386 387 388 389
						}
						this.sseIndex = 0
						this.showLastMsg()
					})
DCloud_JSON's avatar
DCloud_JSON 已提交
390 391 392
					await sseChannel.open() // 等待通道开启
				}
				
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
393
				skip_callback = false
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
394 395
				const uniAiChat = uniCloud.importObject("uni-ai-chat",{
					customUI:true
DCloud_JSON's avatar
DCloud_JSON 已提交
396 397 398 399 400 401
				})
				uniAiChat.send({
					messages,
					sseChannel
				})
				.then(res => {
402
					console.log(111,res);
DCloud_JSON's avatar
DCloud_JSON 已提交
403
					this.updateLastMsg({state:100})
404
					if (res.data) {
DCloud_JSON's avatar
DCloud_JSON 已提交
405
						// console.log(res, res.reply);
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
406 407
						// 判断长度,防止请求未返回时,历史对话已被清空。引起对话顺序错误 导致 对话输入框卡住
						if(!skip_callback){
408 409 410 411
							let {"reply":content,summarize,insufficientScore,illegal} = res.data
							if(illegal){
								this.updateLastMsg({illegal:true})
							}
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
412 413
							this.msgList.push({
								create_time: Date.now(),
414 415 416 417 418
								isAi: true,
								content,
								summarize,
								insufficientScore,
								illegal
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
419 420 421 422 423
							})
							this.showLastMsg()
						}else{
							console.log('用户点击了清空按钮,跳过前一次请求的回调',res.data.reply);
						}
DCloud_JSON's avatar
DCloud_JSON 已提交
424 425
					}
				})
DCloud_JSON's avatar
DCloud_JSON 已提交
426
				.catch(e => {
DCloud_JSON's avatar
DCloud_JSON 已提交
427
					console.log(e);
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
428 429 430 431 432 433
					let l = this.msgList.length
					console.log(l,this.msgList[l-1]);
					if(l && sseChannel && this.msgList[l-1].isAi){
						this.sseIndex = 0
					}
					
DCloud_JSON's avatar
DCloud_JSON 已提交
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
					this.updateLastMsg({state:-100})
					uni.showModal({
						content: JSON.stringify(e.message),
						showCancel: false
					});
				})
			},
			showLastMsg() {
				this.$nextTick(() => {
					this.scrollIntoView = "last-msg-item"
					this.$nextTick(() => {
						this.scrollIntoView = ""
					})
				})
			},
			msgStateIcon(msg) {
				switch (msg.state) {
					case 0:
						//	发送中
						return 'spinner-cycle'
						break;
					case -100:
						//	发送失败
						return 'refresh-filled'
						break;
					case -200:
						//	禁止发送(内容不合法)
						return 'info-filled'
						break;
					default:
						return false
						break;
				}
			},
			clear() {
				uni.showModal({
					title: "确认要清空聊天记录?",
					content: '本操作不可撤销',
					complete: (e) => {
						if (e.confirm) {
DCloud_JSON's avatar
1.0.3  
DCloud_JSON 已提交
474 475 476 477 478
							if(sseChannel){
								sseChannel.close()
							}
							skip_callback = true
							this.sseIndex = 0
DCloud_JSON's avatar
DCloud_JSON 已提交
479 480 481 482
							this.msgList = []
						}
					}
				});
DCloud_JSON's avatar
DCloud_JSON 已提交
483
			}
DCloud_JSON's avatar
DCloud_JSON 已提交
484 485 486 487 488
		}
	}
</script>

<style lang="scss">
DCloud_JSON's avatar
DCloud_JSON 已提交
489 490 491 492
	/* #ifdef VUE3 && APP-PLUS */
	@import "@/components/uni-ai-msg/uni-ai-msg.scss";
	/* #endif */

DCloud_JSON's avatar
DCloud_JSON 已提交
493 494 495
	/* #ifndef APP-NVUE */
	view,
	textarea,
DCloud_JSON's avatar
DCloud_JSON 已提交
496
	button,
DCloud_JSON's avatar
DCloud_JSON 已提交
497
	.page
DCloud_JSON's avatar
DCloud_JSON 已提交
498 499
	{
		display: flex;
DCloud_JSON's avatar
DCloud_JSON 已提交
500
		box-sizing: border-box;
DCloud_JSON's avatar
DCloud_JSON 已提交
501
	}
DCloud_JSON's avatar
DCloud_JSON 已提交
502
	/* #endif */
DCloud_JSON's avatar
DCloud_JSON 已提交
503 504 505 506 507 508 509
	

	/* #ifndef APP-NVUE */
	page,
	/* #endif */
	.page,
	.container {
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
510
		background-color: #efefef;
DCloud_JSON's avatar
DCloud_JSON 已提交
511
		
512
		/* #ifdef APP-NVUE */
DCloud_JSON's avatar
DCloud_JSON 已提交
513
		flex: 1;
514 515
		/* #endif */
		
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
516 517 518 519
		/* #ifndef APP-NVUE */
		height: 100vh;
		/* #endif */
		
DCloud_JSON's avatar
DCloud_JSON 已提交
520 521 522
		/* #ifdef H5 */
		height: calc(100vh - 44px);
		/* #endif */
523
		
DCloud_JSON's avatar
DCloud_JSON 已提交
524
		flex-direction: column;
DCloud_JSON's avatar
DCloud_JSON 已提交
525 526 527
		align-items: center;
		justify-content: center;
	}
DCloud_JSON's avatar
DCloud_JSON 已提交
528 529 530

	/* #ifndef APP-NVUE */
	.container {
DCloud_JSON's avatar
DCloud_JSON 已提交
531
		background-color: #FAFAFA;
DCloud_JSON's avatar
DCloud_JSON 已提交
532 533 534 535 536 537
	}
	/* #endif */

	.foot-box {
		width: 750rpx;
		display: flex;
DCloud_JSON's avatar
DCloud_JSON 已提交
538
		flex-direction: column;
DCloud_JSON's avatar
DCloud_JSON 已提交
539 540
		padding: 10px 0px;
		background-color: #FFF;
DCloud_JSON's avatar
DCloud_JSON 已提交
541 542 543
	}
	.foot-box-content{
		justify-content: space-around;
DCloud_JSON's avatar
DCloud_JSON 已提交
544 545
	}

DCloud_JSON's avatar
DCloud_JSON 已提交
546
	.textarea-box {
DCloud_JSON's avatar
DCloud_JSON 已提交
547 548 549 550 551 552 553 554 555 556
		padding: 8px 10px;
		background-color: #f9f9f9;
		border-radius: 5px;
	}

	.textarea-box .textarea {
		max-height: 100px;
		font-size: 14px;
		/* #ifndef APP-NVUE */
		overflow: auto;
DCloud_JSON's avatar
DCloud_JSON 已提交
557 558
		/* #endif */
		width: 450rpx;
DCloud_JSON's avatar
DCloud_JSON 已提交
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
	}

	/* #ifdef H5 */
	/*隐藏滚动条*/
	.textarea-box .textarea::-webkit-scrollbar {
		width: 0;
	}
	/* #endif */

	.input-placeholder {
		color: #bbb;
	}

	.trash,
	.send {
		width: 50px;
		height: 30px;
		justify-content: center;
		align-items: center;
		flex-shrink: 0;
	}

	.trash {
DCloud_JSON's avatar
DCloud_JSON 已提交
582
		width: 30rpx;
DCloud_JSON's avatar
DCloud_JSON 已提交
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
		margin-left: 10rpx;
	}

	.send {
		color: #FFF;
		border-radius: 4px;
		display: flex;
		margin: 0;
		padding: 0;
		font-size: 14px;
		margin-right: 20rpx;
	}

	/* #ifndef APP-NVUE */
	.send::after {
		display: none;
	}
	/* #endif */


	.msg-list {
		flex: 1;
		height: 1px;
		width: 750rpx;
	}

	.userInfo {
		flex-direction: column;
	}

	.msg-item {
		position: relative;
		width: 750rpx;
		flex-direction: column;
		padding: 0 15px;
		padding-bottom: 15px;
	}

	.msgStateIcon {
		position: relative;
		top: 5px;
		right: 5px;
		align-self: center;
	}

	.avatar {
		width: 40px;
		height: 40px;
		border-radius: 2px;
	}

	.create_time {
		font-size: 12px;
		padding: 5px 0;
		padding-top: 0;
		color: #aaa;
DCloud_JSON's avatar
DCloud_JSON 已提交
639
		text-align: center;
DCloud_JSON's avatar
DCloud_JSON 已提交
640 641 642
		width:750rpx;
		/* #ifdef MP */
		display: flex;
643
		/* #endif */
DCloud_JSON's avatar
DCloud_JSON 已提交
644 645 646 647
		justify-content: center;
	}

	.content {
DCloud_JSON's avatar
DCloud_JSON 已提交
648 649
		/* #ifndef APP-NVUE */
		max-width: 550rpx;
DCloud_JSON's avatar
DCloud_JSON 已提交
650 651 652 653 654 655 656 657 658
		/* #endif */
		background-color: #FFF;
		border-radius: 5px;
		padding: 12px 10px;
		margin-left: 10px;
		/* #ifndef APP-NVUE */
		word-break: break-all;
		user-select: text;
		cursor: text;
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
659 660 661
		/* #endif */
	}
	
DCloud_JSON's avatar
DCloud_JSON 已提交
662 663 664
	/* #ifndef APP-NVUE */
	.content {
		display: inline;
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
665 666 667 668 669 670 671 672 673 674 675 676
	}
	
	.content ::v-deep rich-text{
		max-width: 550rpx;
		overflow: auto;
	}
	/* #endif */
	
	/* #ifdef H5 */
	.content * {
		display: inline;
	}
DCloud_JSON's avatar
DCloud_JSON 已提交
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699
	/* #endif */

	.reverse {
		flex-direction: row-reverse;
	}

	.reverse .content {
		margin-left: 0;
		margin-right: 10px;
	}

	.reverse-align {
		align-items: flex-end;
	}

	.noData {
		margin-top: 15px;
		text-align: center;
		width: 750rpx;
		color: #aaa;
		font-size: 12px;
		justify-content: center;
	}
DCloud_JSON's avatar
DCloud_JSON 已提交
700
	
DCloud_JSON's avatar
DCloud_JSON 已提交
701
	.tip-ai-ing {
DCloud_JSON's avatar
DCloud_JSON 已提交
702
		align-items: center;
DCloud_JSON's avatar
DCloud_JSON 已提交
703 704 705 706
		flex-direction: column;
		font-size: 14px;
		color: #919396;
		padding: 15px 0;
DCloud_JSON's avatar
DCloud_JSON 已提交
707
	}
DCloud_JSON's avatar
DCloud_JSON 已提交
708 709 710 711
	
	.uni-link {
		margin-left: 5px;
		line-height: 20px;
DCloud_JSON's avatar
DCloud_JSON 已提交
712 713
	}
	
DCloud_JSON's avatar
DCloud_JSON 已提交
714
	/* #ifdef H5 */
DCloud_JSON's avatar
DCloud_JSON 已提交
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744
	@media screen and (min-width:650px){
		.foot-box{
			border-top: solid 1px #dde0e2;
		}
		.page{
			width: 100vw;
			flex-direction: row;
		}
		.page * {
			max-width: 950px;
		}
		
		.container, {
			box-shadow: 0 0 5px #e0e1e7;
			margin-top: 44px;
			border-radius: 10px;
			overflow: hidden;
		}
		
		.container .header{
			height: 44px;
			line-height: 44px;
			border-bottom: 1px solid #F0F0F0;
			width: 100vw;
			justify-content: center;
			font-weight: 500;
		}
		
		.content {
			background-color: #f9f9f9;
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
745
			position: relative;
DCloud_JSON's avatar
DCloud_JSON 已提交
746
			max-width: 90%;
DCloud_JSON's avatar
DCloud_JSON 已提交
747
		}
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
748 749 750 751 752 753 754 755 756 757 758
		// .copy {
		// 	color: #888888;
		// 	position: absolute;
		// 	right: 8px;
		// 	top: 8px;
		// 	font-size: 12px;
		// 	cursor:pointer;
		// }
		// .copy :hover{
		// 	color: #4b9e5f;
		// }
DCloud_JSON's avatar
DCloud_JSON 已提交
759 760 761 762 763 764 765 766 767 768 769
		
		.foot-box,
		.foot-box-content,
		.msg-list,
		.msg-item,
		// .create_time,
		.noData,
		.textarea-box,
		.textarea,
		textarea-box {
			width: 100% !important;
DCloud_JSON's avatar
DCloud_JSON 已提交
770
		}
DCloud_JSON's avatar
DCloud_JSON 已提交
771 772 773
		
		.create_time-box {
			margin-top: 15px;
DCloud_JSON's avatar
DCloud_JSON 已提交
774 775
			justify-content: center;
		}
DCloud_JSON's avatar
DCloud_JSON 已提交
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818
		
		.textarea-box,
		.textarea,
		textarea,
		textarea-box {
			height: 120px;
		}
		
		.container,
		.foot-box,
		.textarea-box {
			background-color: #FFF;
		}
		
		.foot-box-content{
			flex-direction: column;
			justify-content: center;
			align-items: flex-end;
			padding-bottom: 0;
		}
		
		.menu {
			padding:0 10px;
		}
		.menu-item{
			height:20px;
			justify-content: center;
			align-items: center;
			align-content: center;
			display: flex;
			margin-right: 10px;
			cursor: pointer;
		}
		.trash {
			opacity: 0.8;
		}
		.trash image{
			height: 15px;
		}
		
		
		.textarea-box,.textarea-box *{
			// border: 1px solid #000;
DCloud_JSON's avatar
DCloud_JSON 已提交
819
		}
DCloud_JSON's avatar
DCloud_JSON 已提交
820 821 822 823 824 825
		
		.send-btn-box .send-btn-tip{
			color: #919396;
			margin-right: 8px;
			font-size: 12px;
			line-height: 28px;
DCloud_JSON's avatar
DCloud_JSON 已提交
826 827 828
		}
	}
	/* #endif */
DCloud_JSON's avatar
1.0.0  
DCloud_JSON 已提交
829
	
DCloud_JSON's avatar
DCloud_JSON 已提交
830
</style>