diff --git a/src/views/IndexChat.vue b/src/views/IndexChat.vue index c987c88..89ce27f 100644 --- a/src/views/IndexChat.vue +++ b/src/views/IndexChat.vue @@ -254,7 +254,7 @@
- +
@@ -300,33 +300,35 @@ const sendMessage = () => { let messageValue = inputText.value.trim() if (inputText.value.trim()) { messages.push({ id: Date.now(), text: inputText.value, isMe: true, type: 'txt' }); - http.post('/test/main_serve/', { "text": messageValue }).then((res) => { + http.post('/test', { "text": messageValue }).then((res) => { console.log("res", res); - var msg = JSON.parse(res.name) + // var msg = JSON.parse(res.name) + var msg = res.response messages.push({ id: Date.now() + 1, text: msg, isMe: false, type: 'txt' }); + scollToButtom() }).catch(error => { console.log(error) }) - if (inputText.value.indexOf('导航') != -1 || inputText.value.indexOf('怎么走') != -1) { - messagesCopy[10].id = Date.now(); - messages.push(messagesCopy[10]); - } else if (inputText.value.indexOf('医生') != -1) { - messagesCopy[4].id = Date.now(); - messagesCopy[5].id = Date.now() + 1; - messages.push(messagesCopy[4], messagesCopy[5]); - } else if (inputText.value.indexOf('总是头疼') != -1) { - messagesCopy[7].id = Date.now(); - messages.push(messagesCopy[7]); - } else if (inputText.value.indexOf('普通') != -1 || inputText.value.indexOf('专家') != -1) { - messagesCopy[8].id = Date.now(); - messages.push(messagesCopy[8]); - } else if (inputText.value.indexOf('医院') != -1) { - messagesCopy[2].id = Date.now(); - messagesCopy[3].id = Date.now() + 1; - messages.push(messagesCopy[2], messagesCopy[3]); - } else { - // messages.push({ id: Date.now(), text: '抱歉没听懂 您可以尝试输入 最近总是头疼挂什么科室', isMe: false, type: 'txt' }); - } + // if (inputText.value.indexOf('导航') != -1 || inputText.value.indexOf('怎么走') != -1) { + // messagesCopy[10].id = Date.now(); + // messages.push(messagesCopy[10]); + // } else if (inputText.value.indexOf('医生') != -1) { + // messagesCopy[4].id = Date.now(); + // messagesCopy[5].id = Date.now() + 1; + // messages.push(messagesCopy[4], messagesCopy[5]); + // } else if (inputText.value.indexOf('总是头疼') != -1) { + // messagesCopy[7].id = Date.now(); + // messages.push(messagesCopy[7]); + // } else if (inputText.value.indexOf('普通') != -1 || inputText.value.indexOf('专家') != -1) { + // messagesCopy[8].id = Date.now(); + // messages.push(messagesCopy[8]); + // } else if (inputText.value.indexOf('医院') != -1) { + // messagesCopy[2].id = Date.now(); + // messagesCopy[3].id = Date.now() + 1; + // messages.push(messagesCopy[2], messagesCopy[3]); + // } else { + // messages.push({ id: Date.now(), text: '抱歉没听懂 您可以尝试输入 最近总是头疼挂什么科室', isMe: false, type: 'txt' }); + // } // console.log("messages", messages) scollToButtom(); inputText.value = ''; @@ -771,7 +773,7 @@ onMounted(() => { align-items: center; justify-content: center; flex-direction: column; - + cursor: default; .heng { width: 21px; height: 1px; diff --git a/vite.config.js b/vite.config.js index c468db1..dded420 100644 --- a/vite.config.js +++ b/vite.config.js @@ -11,8 +11,10 @@ export default defineConfig({ hmr: true, // 自动热更新 proxy: { "/test": { - target: "http://192.168.2.86:8003", + // target: "http://192.168.2.86:8003", + target: "http://aiai.cityme.com.cn/generate", changeOrigin: true, + rewrite: (path) => path.replace(/\/test/, ""), //重写真实路径,替换/api }, '/srv': { target: 'http://36.140.118.172:88',//沈涛