From c9b6d9a10160ca1d18237a0728bac87ec8ff16da Mon Sep 17 00:00:00 2001
From: gerson <1405270578@qq.com>
Date: 星期二, 21 一月 2025 16:16:43 +0800
Subject: [PATCH] 屏蔽非当前聊天室chat_start

---
 src/components/chat/hooks/useAssistantContentOpt.ts |   39 +++++++++++++--------------------------
 1 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/src/components/chat/hooks/useAssistantContentOpt.ts b/src/components/chat/hooks/useAssistantContentOpt.ts
index ca3b327..ff2ec9f 100644
--- a/src/components/chat/hooks/useAssistantContentOpt.ts
+++ b/src/components/chat/hooks/useAssistantContentOpt.ts
@@ -1,23 +1,20 @@
 import { ElMessage } from 'element-plus';
-import type { ComputedRef, Ref } from 'vue';
+import type { ComputedRef } from 'vue';
 import { computed, nextTick, ref } from 'vue';
-import useClipboard from 'vue-clipboard3';
+// import useClipboard from 'vue-clipboard3';
+import { onClickOutside, useClipboard } from '@vueuse/core';
 import type { ChatMessage } from '../model/types';
 import { AnswerState, AnswerType, RoleEnum } from '../model/types';
 import { SetHistoryAnswerState } from '/@/api/ai/chat';
-import { useClickOther } from '/@/hooks/useClickOther';
-import { onClickOutside } from '@vueuse/core';
-import { chatDisplayMode } from '/@/stores/chatRoom';
+import { isSharePage } from '/@/stores/chatRoom';
 
 export type AssistantContentOptOption = {
 	sendChatMessage: any;
-	displayMessageList: ComputedRef<ChatMessage[]>;
 };
 
 export const useAssistantContentOpt = (option: AssistantContentOptOption) => {
-	const { sendChatMessage, displayMessageList } = option;
-	const { toClipboard } = useClipboard();
-	const preQuestion = ref(null);
+	const { sendChatMessage } = option;
+	const { copy } = useClipboard();
 
 	const copyClick = (item) => {
 		const type = item.content.type;
@@ -28,7 +25,7 @@
 			text = item.content.values;
 		}
 		ElMessage.success('澶嶅埗鎴愬姛');
-		toClipboard(text);
+		copy(text);
 	};
 
 	const likeClick = async (item) => {
@@ -38,7 +35,6 @@
 			answer_state: toSetState,
 		});
 		item.state = toSetState;
-		
 	};
 
 	const unLikeClick = async (item) => {
@@ -48,8 +44,6 @@
 			answer_state: toSetState,
 		});
 		item.state = toSetState;
-
-	
 	};
 	const feedbackPosition = ref({
 		x: 0,
@@ -90,15 +84,10 @@
 	// 		feedbackContent.value = '';
 	// 	}
 	// );
-	const showAskMore = computed(() => {
-		if (!displayMessageList.value || displayMessageList.value.length === 0) return false;
-		const last = displayMessageList.value.at(-1);
-		const isShow = last?.role === RoleEnum.assistant && last?.content?.values && last.content?.askMoreList?.length > 0;
-		return isShow && chatDisplayMode.value ==='default' ;
-	});
+
 
 	const showFixQuestion = (item) => {
-		const isShow = item?.role === RoleEnum.assistant && item?.content?.values && item.content?.origin?.err_json?.fix_question;
+		const isShow = item?.role === RoleEnum.assistant  && item.content?.origin?.sample_question?.length > 0 && !isSharePage.value;
 		return isShow;
 	};
 	const askMoreClick = (item) => {
@@ -107,15 +96,15 @@
 	};
 
 	const fixQuestionClick = (item, originData) => {
-		if (!item.question) return;
-		preQuestion.value = originData?.question;
+		if (!item) return;
+		// preQuestion.value = originData?.question;
 		try {
 			sendChatMessage({
 				type: AnswerType.Text,
-				values: item.question,
+				values: item,
 			});
 		} finally {
-			preQuestion.value = null;
+			// preQuestion.value = null;
 		}
 	};
 
@@ -132,8 +121,6 @@
 		feedbackClick,
 		askMoreClick,
 		fixQuestionClick,
-		preQuestion,
-		showAskMore,
 		showFixQuestion,
 	};
 };

--
Gitblit v1.9.3