Merge branch 'main' of git.zdool.com:xs/yxdt/h5

This commit is contained in:
汪汇 2024-03-06 17:28:16 +08:00
commit 36a084c069
1 changed files with 32 additions and 20 deletions

View File

@ -245,11 +245,11 @@
<div v-if="message.type == 'txt'" class="txt txt_r"> {{ message.text }}</div>
</div>
</div>
<div class="Left" v-if="message.type=='loading'">
<div class="txt_l middle " >
<div class="Left" v-if="message.type == 'loading'">
<div class="txt_l middle ">
<!-- <van-loading type="spinner" color="#1989fa">{{ message.text }} </van-loading> -->
<van-loading type="spinner" color="#000">{{ message.text }} </van-loading>
</div>
</div>
</div>
@ -279,12 +279,12 @@ import http from '@/api/http.js'
// import http from '@/utils/request.js'
let recomanTags = ref(['公积金查询', '2024放假安排', '附近推荐的锻炼场所'])
let inputText = ref('')
// let messages = reactive([
// ]);
let messages = ref([
let messages = reactive([
]);
// let messages = ref([
// ]);
let kearr = reactive([{ name: '神经内科', path: '' }, { name: '儿科', path: '' }, { name: '外科', path: '' }])
let messagesCopy = reactive([
@ -312,20 +312,26 @@ const sendMessage = () => {
console.log("信息发送成功", inputText.value);
let messageValue = inputText.value.trim()
if (inputText.value.trim()) {
messages.value.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt', });
messages.value.push({ id: Date.now(), text: '思考中。。。', isMe: true, type: 'loading', });
messages.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt', });
messages.push({ id: Date.now(), text: '思考中。。。', isMe: true, type: 'loading', });
http.post('/generate', { "text": messageValue }).then((res) => {
console.log("res", res);
// var msg = JSON.parse(res.name)
var msg = res.response
messages.value.push({ id: Date.now() + 1, text: msg, isMe: false, type: 'txt' });
messages.value.splice(messages.value.length - 2, 1);
// console.log("messages.value",messages.value,dd);
messages.push({ id: Date.now() + 1, text: msg, isMe: false, type: 'txt' });
messages.map((vv, ii) => {
if (vv.type == 'loading') {
messages.splice(ii, 1)
}
})
// console.log("messages ==", messages);
scollToButtom()
}).catch(error => {
console.log(error)
messages.map((vv, ii) => {
if (vv.type == 'loading') {
messages.splice(ii, 1)
}
})
console.log('error',error)
})
// if (inputText.value.indexOf('') != -1 || inputText.value.indexOf('') != -1) {
// messagesCopy[10].id = Date.now();
@ -358,7 +364,7 @@ const goke = () => {
messagesCopy[11].id = Date.now();
messagesCopy[11].text = insertWord
messages.value.push(messagesCopy[11]);
messages.push(messagesCopy[11]);
scollToButtom();
};
//
@ -381,7 +387,7 @@ onMounted(() => {
scollToButtom()
// messages
setTimeout(() => {
messages.value.push({ id: Date.now(), type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false });
messages.push({ id: Date.now(), type: 'fstxt', text: '您可以点击下方快捷方式选择问题,或直接编辑问题发送给我哟', isMe: false });
}, 500);
})
@ -393,9 +399,15 @@ onMounted(() => {
color: #999999;
font-size: 14px;
}
.middle{
display: flex;justify-content: center;align-items: center; height: 64px;width: 300px;
.middle {
display: flex;
justify-content: center;
align-items: center;
height: 64px;
width: 300px;
}
.sendinput {
height: 36px;
width: calc(100vw - 154px);