add
This commit is contained in:
parent
14b29edc75
commit
f175124139
|
@ -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([
|
||||
|
@ -313,18 +313,20 @@ const sendMessage = () => {
|
|||
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);
|
||||
messages.push({ id: Date.now() + 1, text: msg, isMe: false, type: 'txt' });
|
||||
messages.splice(messages.length - 2, 1);
|
||||
// console.log("messages.value",messages.value,dd);
|
||||
scollToButtom()
|
||||
}).catch(error => {
|
||||
messages.splice(messages.length - 2, 1);
|
||||
messages.push({ id: Date.now() + 1, text: error, isMe: false, type: 'txt' });
|
||||
console.log(error)
|
||||
})
|
||||
// if (inputText.value.indexOf('导航') != -1 || inputText.value.indexOf('怎么走') != -1) {
|
||||
|
@ -358,7 +360,7 @@ const goke = () => {
|
|||
messagesCopy[11].id = Date.now();
|
||||
messagesCopy[11].text = insertWord
|
||||
|
||||
messages.value.push(messagesCopy[11]);
|
||||
messages.push(messagesCopy[11]);
|
||||
scollToButtom();
|
||||
};
|
||||
// 预约医生
|
||||
|
@ -381,7 +383,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);
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue