diff --git a/my-vue-app/src/utils/https.js b/my-vue-app/src/utils/https.js
index a845c4b..07a1086 100644
--- a/my-vue-app/src/utils/https.js
+++ b/my-vue-app/src/utils/https.js
@@ -5,8 +5,8 @@ import { useUserStore } from '@/stores/user'
// 创建axios实例
const service = axios.create({
- // baseURL: 'https://mldash.nycjy.cn/' || '', // API基础路径,支持完整URL
- baseURL: 'http://192.168.15.121:8890' || '', // API基础路径,支持完整URL
+ baseURL: 'https://mldash.nycjy.cn/' || '', // API基础路径,支持完整URL
+ // baseURL: 'http://192.168.15.121:8890' || '', // API基础路径,支持完整URL
timeout: 100000, // 请求超时时间
headers: {
'Content-Type': 'application/json;charset=UTF-8'
diff --git a/my-vue-app/src/views/person/components/PersonalDashboard.vue b/my-vue-app/src/views/person/components/PersonalDashboard.vue
index ebd6cb4..0ab5ff4 100644
--- a/my-vue-app/src/views/person/components/PersonalDashboard.vue
+++ b/my-vue-app/src/views/person/components/PersonalDashboard.vue
@@ -122,15 +122,21 @@
当日分析报告
-
这里是当日分析报告的占位文本。
+
数据为空
+
+
正在生成分析报告...
当期分析报告
-
这里是当期分析报告的占位文本。
+
数据为空
+
+
正在生成分析报告...
当月分析报告
-
这里是当月分析报告的占位文本。
+
数据为空
+
+
正在生成分析报告...
@@ -149,12 +155,16 @@ import Chart from 'chart.js/auto';
import {getSecondOrderAnalysisReport} from "@/api/api.js"
import { useUserStore } from "@/stores/user";
import { useRouter } from "vue-router";
+import { SimpleChatService } from '@/utils/ChatService.js';
// 用户store
const userStore = useUserStore();
// 路由实例
const router = useRouter();
+const Dify_API_Key_02 = 'app-MGaBOx5QFblsMZ7dSkxKJDKm'
+const chatService_02= new SimpleChatService(Dify_API_Key_02)
+
// 获取通用请求参数的函数
const getRequestParams = () => {
const params = {}
@@ -214,7 +224,41 @@ async function CenterGetSecondOrderAnalysisReport(time) {
const params = getRequestParams()
const hasParams = {...params,time:time}
const res = await getSecondOrderAnalysisReport(hasParams)
- console.log(res)
+ if (res.code === 200) {
+
+ const records = res.data.records.join('\n')
+
+ // 检查数据是否为空
+ if (!records) {
+ console.error('数据为空')
+ // 将错误信息存储到对应的响应式变量中
+ analysisReport.value[time] = '数据为空'
+ return
+ }
+
+ const prompt = `请分析以下数据:\n${records}\n请提供一个阶段分析报告。`
+ console.log(prompt)
+ // 使用sendMessage方法替代chat方法
+ try {
+ await chatService_02.sendMessage(
+ prompt,
+ (update) => {
+ // 实时更新回调
+ if (!update.isStreaming) {
+ console.log('阶段分析报告:', update.content)
+ // 将结果存储到对应的响应式变量中
+ analysisReport.value[time] = update.content
+ }
+ },
+ () => {
+ // 流结束回调
+ console.log('阶段分析报告生成完成')
+ }
+ )
+ } catch (error) {
+ console.error('获取阶段分析报告失败:', error)
+ }
+ }
}
// Chart.js 实例
const chartInstances = {};
@@ -373,7 +417,12 @@ const hideTooltip = () => {
// 阶段分析报告模态框状态
const showAnalysisModal = ref(false);
-const analysisPeriod = ref('day'); // 'day', 'current', 'month'
+const analysisPeriod = ref('day'); // 'day', 'camp', 'month'
+const analysisReport = ref({
+ day: '',
+ camp: '',
+ month: ''
+});
// 显示阶段分析报告模态框
const showSecondOrderAnalysisReport = () => {
@@ -849,7 +898,7 @@ $white: #ffffff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
width: 90%;
max-width: 600px;
- max-height: 80vh;
+ max-height: 60vh;
overflow: hidden;
display: flex;
flex-direction: column;
@@ -950,4 +999,14 @@ $white: #ffffff;
color: #606266;
line-height: 1.6;
}
+
+.error-message {
+ color: #f56c6c;
+ font-weight: bold;
+ text-align: center;
+ padding: 20px;
+ border: 1px solid #f56c6c;
+ border-radius: 4px;
+ background-color: #fef0f0;
+}
\ No newline at end of file