From c89d1d1fe4e820bc9d1a942467a3f1e017b40dac Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 06 十一月 2024 16:33:36 +0800
Subject: [PATCH] 无关代码删除

---
 src/components/chat/components/playBar/PlayBar.vue |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/src/components/chat/components/playBar/PlayBar.vue b/src/components/chat/components/playBar/PlayBar.vue
index 2206a95..e71d240 100644
--- a/src/components/chat/components/playBar/PlayBar.vue
+++ b/src/components/chat/components/playBar/PlayBar.vue
@@ -126,14 +126,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']);
-const props = defineProps(['isTalking', 'isHome']);
+const emits = defineEmits(['sendClick', 'showUpChatClick', 'showDownChatClick']);
+const props = defineProps({
+	isTalking: Boolean,
+	isHome: Boolean,
+	setCommonQuestionInfo: {
+		type: Object,
+		default: {},
+	},
+});
+
+const { setCommonQuestionInfo } = toRefs(props);
 const voicePageIsShow = defineModel('voicePageIsShow', {
 	type: Boolean,
 	default: false,
@@ -157,7 +166,9 @@
 	if (props.isTalking) return;
 	const isEnterInput = !e.shiftKey && e.key == 'Enter';
 	const isDigitalInput = e.ctrlKey && e.code.startsWith('Digit') && tipIsShow.value;
-	if (isEnterInput || isDigitalInput) {
+	const arrowUp = e.key === 'ArrowUp';
+	const arrowDown = e.key === 'ArrowDown';
+	if (isEnterInput || isDigitalInput || arrowUp || arrowDown) {
 		e.cancelBubble = true; //ie闃绘鍐掓场琛屼负
 		e.stopPropagation(); //Firefox闃绘鍐掓场琛屼负
 		e.preventDefault(); //鍙栨秷浜嬩欢鐨勯粯璁ゅ姩浣�*鎹㈣
@@ -171,6 +182,10 @@
 				inputValue.value = mapValue;
 				triggerShow.value = false;
 			}
+		} else if (arrowUp) {
+			emits('showUpChatClick');
+		} else if (arrowDown) {
+			emits('showDownChatClick');
 		}
 	}
 };
@@ -192,6 +207,7 @@
 onClickOutside(tipEleRef, () => {
 	triggerShow.value = false;
 });
+
 const inputText = (text) => {
 	nextTick(() => {
 		setTimeout(() => {
@@ -423,11 +439,10 @@
 
 //#region ====================== 褰撳墠搴旂敤鍦烘櫙 ======================
 const currentGroupTypeIsShow = computed(() => !!activeGroupType.value);
-
 const groupTypeClick = (item) => {
 	activeGroupType.value = item;
-
 	inputRef.value.focus();
+	commonPhrasesRef.value.getCommonPhrases();
 };
 
 // 鍏抽棴褰撳墠 groupType 闈㈡澘
@@ -441,10 +456,23 @@
 const commonPhrasesClick = () => {
 	isShowPhrase.value = true;
 };
+onClickOutside(commonPhrasesRef, () => {
+	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