diff --git a/src/components/Apps/ChatAi/components/ChitChat/ChatInput.vue b/src/components/Apps/ChatAi/components/ChitChat/ChatInput.vue index 47098c816..97e58b8dc 100644 --- a/src/components/Apps/ChatAi/components/ChitChat/ChatInput.vue +++ b/src/components/Apps/ChatAi/components/ChitChat/ChatInput.vue @@ -80,7 +80,6 @@ export default { this.inputValue = '' }, onSelectChange(value) { - this.inputValue = value this.$emit('select-prompt', value) } } diff --git a/src/components/Apps/ChatAi/components/ChitChat/index.vue b/src/components/Apps/ChatAi/components/ChitChat/index.vue index bfceb60c5..51f928028 100644 --- a/src/components/Apps/ChatAi/components/ChitChat/index.vue +++ b/src/components/Apps/ChatAi/components/ChitChat/index.vue @@ -37,6 +37,7 @@ import { getInputFocus, useChat } from '../../useChat.js' const { setLoading, + clearChats, addChatMessageById, addMessageToActiveChat, newChatAndAddMessageById, @@ -179,6 +180,12 @@ export default { onSelectPromptHandle(value) { this.prompt = value this.currentConversationId = '' + this.showIntroduction = false + this.onSendHandle(value) + }, + onNewChat() { + clearChats() + this.initChatMessage() }, onStopHandle() { this.$axios.post( diff --git a/src/components/Apps/ChatAi/index.vue b/src/components/Apps/ChatAi/index.vue index a28b43964..d2addf3be 100644 --- a/src/components/Apps/ChatAi/index.vue +++ b/src/components/Apps/ChatAi/index.vue @@ -73,7 +73,7 @@ export default { onNewChat() { this.active = 'chat' this.$nextTick(() => { - this.$refs.component?.init() + this.$refs.component?.onNewChat() getInputFocus() }) } diff --git a/src/components/Apps/ChatAi/useChat.js b/src/components/Apps/ChatAi/useChat.js index a94e86213..269aa09d2 100644 --- a/src/components/Apps/ChatAi/useChat.js +++ b/src/components/Apps/ChatAi/useChat.js @@ -23,6 +23,10 @@ export function useChat() { store.commit('chat/addChatToStore', data) } + const clearChats = () => { + store.commit('chat/clearChats') + } + const addMessageToActiveChat = (chat) => { store.commit('chat/addMessageToActiveChat', chat) } @@ -69,6 +73,7 @@ export function useChat() { chatStore, setLoading, onNewChat, + clearChats, getInputFocus, addMessageToActiveChat, newChatAndAddMessageById, diff --git a/src/store/modules/chat.js b/src/store/modules/chat.js index b679c6825..f90062288 100644 --- a/src/store/modules/chat.js +++ b/src/store/modules/chat.js @@ -1,7 +1,6 @@ const state = { loading: false, - tabNum: 0, activeTab: 0, chatsStore: [], activeChat: {} @@ -24,6 +23,10 @@ const mutations = { state.activeChat.chats?.push(chat) }, + clearChats(state) { + state.activeChat.chats = [] + }, + removeLoadingMessageInChat(state) { const { chats } = state.activeChat const length = chats?.length