From 7866aa30bd13dab1fc0662e1baf6675d0dc1b282 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 02 四月 2025 15:42:30 +0800
Subject: [PATCH] 修改意见

---
 src/components/chat/Chat.vue |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/components/chat/Chat.vue b/src/components/chat/Chat.vue
index ef647a0..771c7ab 100644
--- a/src/components/chat/Chat.vue
+++ b/src/components/chat/Chat.vue
@@ -48,7 +48,6 @@
 <script setup lang="ts">
 import type { CancelTokenSource } from 'axios';
 import axios from 'axios';
-import { orderBy } from 'lodash-es';
 import moment from 'moment';
 import { computed, nextTick, onActivated, onMounted, ref } from 'vue';
 import { loadAmisSource } from '../amis/load';
@@ -60,7 +59,7 @@
 import CustomDrawer from '/@/components/drawer/CustomDrawer.vue';
 import { Logger } from '/@/model/logger/Logger';
 import { triggerRef } from 'vue';
-import { ElLoadingService, ElMessage } from 'element-plus';
+import {  ElMessage } from 'element-plus';
 import ChatContainer from './components/ChatContainer.vue';
 import ShareLinkDlg from './components/shareLink/index.vue';
 import router from '/@/router';
@@ -81,8 +80,10 @@
 import { useSyncMsg } from './hooks/useSyncMsg';
 import { getCurrentPosition } from '/@/utils/brower';
 import { deepClone } from '/@/utils/other';
+import { ParentRegister } from '/@/stores/global';
 const containerRef = useCompRef(ChatContainer);
 const chatListDom = computed(() => containerRef.value?.chatListDom);
+
 const scrollToBottom = () => {
 	containerRef.value?.scrollToBottom();
 };
@@ -125,6 +126,8 @@
 	});
 };
 
+const enableCallback = ref(false);
+
 let streamOutputIsStart = false;
 let position: Position = null;
 const questionAi = async (text) => {
@@ -148,6 +151,10 @@
 		params.tables = JSON.stringify(tableList);
 	}
 
+	const metricList = attachList.value.filter((item) => item.type === 'metric').map((item) => item.model);
+	if (metricList?.length > 0) {
+		params.metrics = JSON.stringify(metricList);
+	}
 	// if (!position) {
 	// 	const loadingInstance = ElLoadingService({
 	// 		text: '鑾峰彇浣嶇疆涓�...',
@@ -227,6 +234,19 @@
 					return;
 					// chunkRes.value = '鍑嗗鏁版嵁鍒嗘瀽';
 				}
+				
+				if (chunkRes.mode === 'main_frame') {
+					const jsonObj = JSON.parse(chunkRes.value);
+					if (!enableCallback.value) {
+						return;
+					}
+
+					ParentRegister.notify?.({
+						type: 'main_frame',
+						value: jsonObj,
+					});
+					return;
+				}
 
 				if (chunkRes.mode === 'create_work_order') {
 					const lastMsg = computedMessageList.value.at(-1);

--
Gitblit v1.9.3