From b5e920831f3e2ea94c809b0dd99f08c16d9feceb Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期五, 08 十一月 2024 14:20:00 +0800
Subject: [PATCH] 修改删除常用语时面板被关闭的问题

---
 src/components/chat/components/playBar/PlayBar.vue |   41 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/src/components/chat/components/playBar/PlayBar.vue b/src/components/chat/components/playBar/PlayBar.vue
index e9ba850..c5fffa0 100644
--- a/src/components/chat/components/playBar/PlayBar.vue
+++ b/src/components/chat/components/playBar/PlayBar.vue
@@ -116,6 +116,7 @@
 			:isHome="isHome"
 			ref="commonPhrasesRef"
 			@updateCommonChatInput="updateCommonChatInput"
+	
 		/>
 	</div>
 </template>
@@ -126,14 +127,23 @@
 import { ElMessage } from 'element-plus';
 import _ from 'lodash';
 import getCaretCoordinates from 'textarea-caret';
-import { computed, nextTick, ref } from 'vue';
+import { computed, nextTick, ref, toRefs, watch } from 'vue';
 import InfoDetail from './InfoDetail.vue';
 import CommonPhrases from './phrase/CommonPhrases.vue';
 import VoicePage from './voicePage/VoicePage.vue';
 import { getMetricsNames, querySimilarityHistory } from '/@/api/ai/chat';
 import { activeGroupType, groupTypeList, groupTypeMapIcon } from '/@/stores/chatRoom';
 const emits = defineEmits(['sendClick', 'showUpChatClick', 'showDownChatClick']);
-const props = defineProps(['isTalking', 'isHome']);
+const props = defineProps({
+	isTalking: Boolean,
+	isHome: Boolean,
+	setCommonQuestionInfo: {
+		type: Object,
+		default: {},
+	},
+});
+
+const { setCommonQuestionInfo } = toRefs(props);
 const voicePageIsShow = defineModel('voicePageIsShow', {
 	type: Boolean,
 	default: false,
@@ -198,6 +208,7 @@
 onClickOutside(tipEleRef, () => {
 	triggerShow.value = false;
 });
+
 const inputText = (text) => {
 	nextTick(() => {
 		setTimeout(() => {
@@ -429,11 +440,10 @@
 
 //#region ====================== 褰撳墠搴旂敤鍦烘櫙 ======================
 const currentGroupTypeIsShow = computed(() => !!activeGroupType.value);
-
 const groupTypeClick = (item) => {
 	activeGroupType.value = item;
-
 	inputRef.value.focus();
+	commonPhrasesRef.value.getCommonPhrases();
 };
 
 // 鍏抽棴褰撳墠 groupType 闈㈡澘
@@ -444,13 +454,36 @@
 
 //#region ====================== 甯哥敤璇姛鑳� ======================
 const commonPhrasesRef = ref(null);
+const isMessageBoxVisible = ref(false);
+// 甯哥敤璇姛鑳界偣鍑�
 const commonPhrasesClick = () => {
 	isShowPhrase.value = true;
 };
+// 鍖哄煙鍏抽棴甯哥敤璇姛鑳介潰鏉�
+onClickOutside(commonPhrasesRef, () => {
+	const messageBoxElement = document.querySelector('.el-message-box');
+	if (messageBoxElement) {
+		isMessageBoxVisible.value = true;
+		return;
+	}
+	isShowPhrase.value = false;
+});
+// 甯哥敤璇姛鑳借緭鍏ユ鏇存柊
 const updateCommonChatInput = (val) => {
 	inputValue.value = val;
 	isShowPhrase.value = false;
 };
+
+watch(setCommonQuestionInfo, (val) => {
+	if (!props.isHome) {
+		let obj = {
+			id: val?.historyId,
+			question: val?.content.values,
+		};
+		commonPhrasesRef.value.commonChatByUser(obj);
+		isShowPhrase.value = true;
+	}
+});
 //#endregion
 </script>
 <style scoped lang="scss">

--
Gitblit v1.9.3