From 44bb2c11e8cdecbbcc6f7af4f8826c0ab4a756b1 Mon Sep 17 00:00:00 2001 From: cc500 <2014434568@qq.com> Date: Mon, 17 Feb 2025 20:33:06 +0800 Subject: [PATCH] test --- src/components/dialoguePanel/DialoguePanel.vue | 5 ++++- src/store/conversation.ts | 4 ++++ src/views/dialogue/components/DialogueSession.vue | 13 ++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/dialoguePanel/DialoguePanel.vue b/src/components/dialoguePanel/DialoguePanel.vue index 8882ae3..9678d15 100644 --- a/src/components/dialoguePanel/DialoguePanel.vue +++ b/src/components/dialoguePanel/DialoguePanel.vue @@ -126,10 +126,10 @@ const handlePauseAndReGenerate = (cid?: number) => { if (!cid) { return; } - emits("clearSuggestion", props.key); if (props.isFinish) { // 重新生成 + thoughtContent.value = ""; reGenerateAnswer(cid, user_selected_plugins.value); } else { // 停止生成 @@ -265,6 +265,7 @@ const contentAfterMark = computed(() => { const prePageHandle = (cid: number) => { + thoughtContent.value = ""; prePage(cid); if (index.value === 0) { index.value = 0; @@ -275,6 +276,7 @@ const prePageHandle = (cid: number) => { }; const nextPageHandle = (cid: number) => { + thoughtContent.value = ""; nextPage(cid); if (index.value === (props.isLikeList as number[]).length - 1) { index.value = (props.isLikeList as number[]).length - 1; @@ -306,6 +308,7 @@ const handleIsLike = () => { }; onMounted(() => { + thoughtContent.value = ""; isLike.value = props.isLikeList; setTimeout(() => { handleIsLike(); diff --git a/src/store/conversation.ts b/src/store/conversation.ts index 53677fb..23478ad 100644 --- a/src/store/conversation.ts +++ b/src/store/conversation.ts @@ -537,6 +537,10 @@ export const useSessionStore = defineStore('conversation', () => { const answerIndex = conversationList.value.findIndex((val) => val.cid === cid) !== -1 ? conversationList.value.findIndex((val) => val.cid === cid) : conversationList.value.length - 1; isPaused.value = true; (conversationList.value[answerIndex] as RobotConversationItem).isFinish = true; + const conversationItem = conversationList.value[answerIndex] as RobotConversationItem; + if(!conversationItem.message[conversationItem.currentInd]){ + conversationItem.message[conversationItem.currentInd] += "暂停成功" + } cancel(); await api.stopGeneration(); }; diff --git a/src/views/dialogue/components/DialogueSession.vue b/src/views/dialogue/components/DialogueSession.vue index e725d19..8316660 100644 --- a/src/views/dialogue/components/DialogueSession.vue +++ b/src/views/dialogue/components/DialogueSession.vue @@ -28,7 +28,7 @@ enum SupportMap { against = 0, } // const dialogueRef = ref(); -const { pausedStream, reGenerateAnswer, prePage, nextPage } = useSessionStore(); +const { pausedStream } = useSessionStore(); const themeStore = useChangeThemeStore(); const modeOptions = ref(props.modeOptions); const questions = [ @@ -585,6 +585,17 @@ watch( } ); +/** + * 暂停和重新生成问答 + */ + const handlePauseAndReGenerate = (cid?: number) => { + if (!cid) { + return; + } + pausedStream(cid); +}; + + watch(selectMode, (newValue, oldValue) => { user_selected_plugins.value = []; if (selectMode.value !== 'auto') { -- Gitee