This commit is contained in:
parent
515c6beba9
commit
34d84fa02f
|
@ -74,6 +74,7 @@ import { House, Document, ChatLineRound, Files, DataLine, User } from '@element-
|
|||
|
||||
const isCollapse = ref(false)
|
||||
const activeIndex = ref('/home')
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -27,14 +27,15 @@
|
|||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import axiosInstance from '@/utils/axiosInstance';
|
||||
|
||||
const inputMessage = ref('');
|
||||
const messages = ref([]);
|
||||
|
||||
const Base_URL = '/talk/main';
|
||||
const callBackend = async (message) => {
|
||||
try {
|
||||
const response = await axios.post('http://127.0.0.1:8080/talk/main', {
|
||||
const response = await axiosInstance.post(Base_URL,
|
||||
{
|
||||
"model":"glm4:latest",
|
||||
"prompt": message,
|
||||
"stream": false
|
||||
|
@ -43,7 +44,9 @@ const callBackend = async (message) => {
|
|||
'Content-Type': 'application/json; charset=utf-8'
|
||||
}
|
||||
});
|
||||
return response.data.data;
|
||||
console.log('请求成功:', response.data.response)
|
||||
return response;
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error calling backend:', error);
|
||||
if (error.response) {
|
||||
|
@ -71,7 +74,7 @@ const sendMessage = async () => {
|
|||
try {
|
||||
const response = await callBackend(putmessage);
|
||||
|
||||
messages.value.push({ sender: '医小慧', content: response.response });
|
||||
messages.value.push({ sender: '医小慧', content: response.data.response });
|
||||
} catch (error) {
|
||||
// 捕获网络错误或其他异常
|
||||
console.error('请求失败:', error); // 打印错误信息
|
||||
|
|
Loading…
Reference in New Issue