Commit ee1c0330 authored by nick zheng's avatar nick zheng

fix: 应用AI自动新配置后重置应用预览

parent 208d2056
<script setup lang="ts">
import { ref } from 'vue'
import { inject, onMounted, onUnmounted, ref } from 'vue'
import Preamble from './preamble.vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { Emitter } from 'mitt'
import MessageList from './message-list.vue'
import FooterInput from './footer-input.vue'
import { fetchCreateContinueQuestions } from '@/apis/agent-application'
......@@ -16,6 +17,8 @@ const router = useRouter()
const personalAppConfigStore = usePersonalAppConfigStore()
const emitter = inject<Emitter<MittEvents>>('emitter')
const messageListRef = ref<InstanceType<typeof MessageList> | null>(null)
const footerInputRef = ref<InstanceType<typeof FooterInput> | null>(null)
......@@ -27,6 +30,17 @@ const continuousQuestionList = ref<string[]>([])
const isShowMemoryPreviewModal = ref(false)
const selectedMemoryTabName = ref('memoryVariable')
onMounted(() => {
emitter?.on('resetAgent', () => {
footerInputRef.value?.blockMessageResponse()
messageList.value = []
})
})
onUnmounted(() => {
emitter?.off('resetAgent')
})
function handleAddMessageItem(messageItem: ConversationMessageItem) {
messageList.value.push(messageItem)
}
......
......@@ -103,6 +103,7 @@ onMounted(async () => {
onUnmounted(() => {
handleStopGenerate()
emitter?.off('isGetAgentDetail')
})
const handleSavePersonalAppConfig = useThrottleFn(
......@@ -251,6 +252,7 @@ async function handleSettingAgent(autoConfigInputValue: string) {
handleAIGenerateAgentSystem(),
]).finally(() => {
isFullScreenLoading.value = false
emitter?.emit('resetAgent')
})
})
.catch(() => {
......
declare type MittEvents = {
selectQuestion: string
isGetAgentDetail: void
resetAgent: void
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment