From 77a5fd105763df9e3fd1540e6b7776fc6b9d38c1 Mon Sep 17 00:00:00 2001
From: zrh050423 <14331304+zrh050423@user.noreply.gitee.com>
Date: Tue, 10 Dec 2024 12:58:16 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8C=BB=E6=85=A7=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD1.1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 44 ++++++++++---------
medical-frontend/package-lock.json | 9 ++--
medical-frontend/package.json | 18 ++++----
.../src/views/consultation/Inquiry.vue | 22 +++++-----
4 files changed, 49 insertions(+), 44 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9dc17a0..7d28f12 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,10 @@
-
+
+
+
+
@@ -35,26 +38,26 @@
- {
+ "keyToString": {
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "com.codeium.enabled": "true",
+ "git-widget-placeholder": "Vue",
+ "ignore.virus.scanning.warn.message": "true",
+ "kotlin-language-version-configured": "true",
+ "last_opened_file_path": "D:/mycode/Spingboot/HealthSystem/medical-frontend",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "project.structure.last.edited": "项目",
+ "project.structure.proportion": "0.0",
+ "project.structure.side.proportion": "0.2",
+ "settings.editor.selected.configurable": "vcs.Git",
+ "vue.rearranger.settings.migration": "true"
}
-}]]>
+}
@@ -80,6 +83,7 @@
+
diff --git a/medical-frontend/package-lock.json b/medical-frontend/package-lock.json
index 135ba4f..e050e9a 100644
--- a/medical-frontend/package-lock.json
+++ b/medical-frontend/package-lock.json
@@ -8,7 +8,7 @@
"name": "medical-frontend",
"version": "0.0.0",
"dependencies": {
- "axios": "^1.4.0",
+ "axios": "^1.7.9",
"echarts": "^5.4.3",
"element-plus": "^2.3.9",
"pinia": "^2.1.6",
@@ -987,9 +987,10 @@
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/axios": {
- "version": "1.7.8",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.8.tgz",
- "integrity": "sha512-Uu0wb7KNqK2t5K+YQyVCLM76prD5sRFjKHbJYCP1J7JFGEQ6nN7HWn9+04LAeiJ3ji54lgS/gZCH1oxyrf1SPw==",
+ "version": "1.7.9",
+ "resolved": "https://registry.npmmirror.com/axios/-/axios-1.7.9.tgz",
+ "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
+ "license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
diff --git a/medical-frontend/package.json b/medical-frontend/package.json
index 067cf5a..618dcfe 100644
--- a/medical-frontend/package.json
+++ b/medical-frontend/package.json
@@ -9,18 +9,18 @@
"preview": "vite preview"
},
"dependencies": {
- "vue": "^3.3.4",
- "vue-router": "^4.2.4",
- "element-plus": "^2.3.9",
- "axios": "^1.4.0",
- "pinia": "^2.1.6",
+ "axios": "^1.7.9",
"echarts": "^5.4.3",
- "tesseract.js": "^4.1.1"
+ "element-plus": "^2.3.9",
+ "pinia": "^2.1.6",
+ "tesseract.js": "^4.1.1",
+ "vue": "^3.3.4",
+ "vue-router": "^4.2.4"
},
"devDependencies": {
- "@vitejs/plugin-vue": "^4.2.3",
- "vite": "^4.4.9",
"@element-plus/icons-vue": "^2.1.0",
- "sass": "^1.65.1"
+ "@vitejs/plugin-vue": "^4.2.3",
+ "sass": "^1.65.1",
+ "vite": "^4.4.9"
}
}
diff --git a/medical-frontend/src/views/consultation/Inquiry.vue b/medical-frontend/src/views/consultation/Inquiry.vue
index 1eee5d1..fa99480 100644
--- a/medical-frontend/src/views/consultation/Inquiry.vue
+++ b/medical-frontend/src/views/consultation/Inquiry.vue
@@ -34,8 +34,14 @@ const messages = ref([]);
const callBackend = async (message) => {
try {
- const response = await axios.post('http://10.138.4.249:8080/ai/main', {
- message: message
+ const response = await axios.post('http://10.10.10.44:11434/api/generate', {
+ "model":"llama3.3:latest",
+ "prompt": message,
+ "stream": false
+ }, {
+ headers: {
+ 'Content-Type': 'application/json; charset=utf-8'
+ }
});
return response.data;
} catch (error) {
@@ -59,19 +65,13 @@ const sendMessage = async () => {
return;
}
messages.value.push({ sender: 'user', content: inputMessage.value });
+ let putmessage=inputMessage.value;
inputMessage.value = '';
try {
- const response = await callBackend(inputMessage.value);
- console.log('响应内容:', response); // 打印响应内容
+ const response = await callBackend(putmessage);
- // 确保后端返回了正确的数据结构
- if (response.status === 'success' && response.data) {
- messages.value.push({ sender: 'ai', content: response.data.generation });
- } else {
- // 如果后端返回的不是成功状态或者缺少数据,可以添加错误处理
- messages.value.push({ sender: 'ai', content: '发生错误,请重试' });
- }
+ messages.value.push({ sender: 'ai', content: response.response });
} catch (error) {
// 捕获网络错误或其他异常
console.error('请求失败:', error); // 打印错误信息