From 93f6aac1651417159462ac7255e097e63abbfc8a Mon Sep 17 00:00:00 2001 From: Germey Date: Mon, 10 Feb 2025 02:12:09 +0800 Subject: [PATCH] Fix chat experience (#171) Co-authored-by: AceDataCloud --- ...-e15fa939-e681-45a3-9fce-a60f4777e730.json | 7 +++ src/components/chat/SidePanel.vue | 12 ++-- src/pages/chat/Conversation.vue | 61 +++++++++---------- 3 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 change/@acedatacloud-nexior-e15fa939-e681-45a3-9fce-a60f4777e730.json diff --git a/change/@acedatacloud-nexior-e15fa939-e681-45a3-9fce-a60f4777e730.json b/change/@acedatacloud-nexior-e15fa939-e681-45a3-9fce-a60f4777e730.json new file mode 100644 index 00000000..19525592 --- /dev/null +++ b/change/@acedatacloud-nexior-e15fa939-e681-45a3-9fce-a60f4777e730.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix chat experience", + "packageName": "@acedatacloud/nexior", + "email": "office@acedata.cloud", + "dependentChangeType": "patch" +} diff --git a/src/components/chat/SidePanel.vue b/src/components/chat/SidePanel.vue index 8f1e5429..70a4428d 100644 --- a/src/components/chat/SidePanel.vue +++ b/src/components/chat/SidePanel.vue @@ -27,9 +27,13 @@ - {{ - conversation?.title || conversation?.messages[conversation?.messages.length - 1]?.content - }} + + {{ + conversation?.title || + conversation?.messages?.[conversation?.messages.length - 1]?.content || + conversation?.messages?.[0]?.content + }} +
-
-
- - -
- -
-
-
+
+
+ +
@@ -71,6 +56,7 @@ import { CHAT_MODEL_GROUP_CHATGPT, CHAT_MODEL_GROUP_DEEPSEEK, CHAT_MODEL_O1, + CHAT_MODEL_O1_MINI, CHAT_MODELS, ROLE_ASSISTANT, ROLE_USER @@ -175,6 +161,13 @@ export default defineComponent({ await this.$store.dispatch('chat/setModel', model); } }, + // async references(val) { + // console.log('references changed', val); + // const model = await this.getModelByAction(); + // if (model) { + // await this.$store.dispatch('chat/setModel', model); + // } + // }, async reason() { console.log('reason changed', this.reason); const model = await this.getModelByAction(); @@ -196,7 +189,7 @@ export default defineComponent({ this.$store.dispatch('chat/setModel', val); } }, - conversationId(val: string) { + async conversationId(val: string) { if (!val) { this.messages = []; } else { @@ -204,6 +197,16 @@ export default defineComponent({ this.conversations?.find((conversation: IChatConversation) => conversation.id === val)?.messages || []; this.onScrollDown(); } + console.log('reason changed', this.reason); + const model = await this.getModelByConversation(); + if (model) { + await this.$store.dispatch('chat/setModel', model); + } + const modelGroup = await this.getModelGroup(); + if (modelGroup) { + console.log('set model group', modelGroup); + await this.$store.dispatch('chat/setModelGroup', modelGroup); + } } }, async mounted() { @@ -238,7 +241,7 @@ export default defineComponent({ async getModelByAction() { if (this.modelGroup.name === CHAT_MODEL_GROUP_CHATGPT.name) { if (this.reason) { - return CHAT_MODEL_O1; + return CHAT_MODEL_O1_MINI; } else if (this.search) { return CHAT_MODEL_GPT_4_BROWSING; } else if (this.references.length > 0) { @@ -473,11 +476,6 @@ export default defineComponent({ name: ROUTE_CHAT_CONVERSATION_NEW }); }, - // async onModelChanged() { - // await this.onCreateNewConversation(); - // await this.$store.dispatch('chat/getApplications'); - // }, - // Send a message async onSubmit() { if (this.references.length > 0) { let content = []; @@ -589,7 +587,7 @@ export default defineComponent({ messages: this.messages }); this.answering = false; - if (!this.conversationId) { + if (conversationId) { await this.$router.push({ name: ROUTE_CHAT_CONVERSATION, params: { @@ -662,10 +660,8 @@ export default defineComponent({ position: relative; padding: 0 calc(50% - 400px); .disclaimer { - position: absolute; - bottom: 0; - left: 50%; - transform: translateX(-50%); + width: 100%; + text-align: center; font-size: 12px; } &.empty { @@ -681,6 +677,7 @@ export default defineComponent({ .messages { padding-top: 10px; flex: 1; + // overflow-y: scroll; .message { margin-bottom: 15px; }