-
+
+
+ {{ $t(`chat.group.${groupKey}`) }}
-
-
- {{ `${$t('chat.message.confirmDelete')}?` }}
-
-
-
-
- {{
- conversation?.title || conversation?.messages[conversation?.messages.length - 1]?.content
- }}
-
-
-
-
-
-
+
+
+
+ {{ `${$t('chat.message.confirmDelete')}?` }}
+
+
+
+
+ {{
+ conversation?.title || conversation?.messages[conversation?.messages.length - 1]?.content
+ }}
+
+
+
+
+
+
+
@@ -86,8 +88,41 @@ export default defineComponent({
conversationId() {
return this.$route.params?.id?.toString();
},
- conversations() {
- return this.$store.state.chat.conversations;
+ conversationGroups() {
+ const conversations = this.$store.state.chat.conversations;
+ // split our 4 groups according to the `updated_at` field, to 'today', 'yesterday', 'this week', 'earlier'.
+ // if (conversations) {
+ const today = new Date();
+ today.setHours(0, 0, 0, 0);
+ const yesterday = new Date(today);
+ yesterday.setDate(yesterday.getDate() - 1);
+ const thisWeek = new Date(today);
+ thisWeek.setDate(thisWeek.getDate() - today.getDay());
+ const earlier = new Date(thisWeek);
+ earlier.setDate(earlier.getDate() - 7);
+ const groups = conversations?.reduce(
+ (acc, conversation: IChatConversation) => {
+ const updatedAt = new Date(conversation.updated_at * 1000);
+ if (updatedAt >= today) {
+ (acc.today as IChatConversation[]).push(conversation);
+ } else if (updatedAt >= yesterday) {
+ (acc.yesterday as IChatConversation[]).push(conversation);
+ } else if (updatedAt >= thisWeek) {
+ (acc.thisWeek as IChatConversation[]).push(conversation);
+ } else {
+ (acc.earlier as IChatConversation[]).push(conversation);
+ }
+ return acc;
+ },
+ { today: [], yesterday: [], thisWeek: [], earlier: [] }
+ ) as Record
;
+ // sort every group by `updated_at` field.
+ return {
+ today: groups?.today?.sort((a, b) => b.updated_at - a.updated_at),
+ yesterday: groups?.yesterday?.sort((a, b) => b.updated_at - a.updated_at),
+ thisWeek: groups?.thisWeek?.sort((a, b) => b.updated_at - a.updated_at),
+ earlier: groups?.earlier?.sort((a, b) => b.updated_at - a.updated_at)
+ };
},
application() {
return this.$store.state.chat.application;
@@ -146,33 +181,47 @@ export default defineComponent({
display: flex;
flex-direction: column;
align-items: flex-end;
- padding: 15px;
- width: 300px;
+ padding: 10px;
+ width: 250px;
height: 100%;
border-right: 1px solid var(--el-border-color);
- overflow-y: scroll;
.conversations {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
+ .group {
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ margin-top: 10px;
+ .key {
+ font-size: 12px;
+ font-weight: 600;
+ width: 100%;
+ line-height: 40px;
+ padding-left: 10px;
+ color: var(--el-text-color-secondary);
+ }
+ }
.conversation {
width: 100%;
- height: 55px;
+ height: 40px;
display: flex;
flex-direction: row;
- padding: 10px;
- margin-bottom: 5px;
- border: 1px dashed var(--el-border-color);
- line-height: 30px;
+ line-height: 40px;
border-radius: 10px;
+ padding: 0 10px;
color: var(--el-text-color-primary);
cursor: pointer;
&.active,
&:hover {
- background-color: var(--el-fill-color-extra-light);
+ background-color: var(--el-bg-color-page);
+ .operations {
+ display: block;
+ }
}
.icons {
@@ -185,13 +234,14 @@ export default defineComponent({
.title {
flex: 1;
font-size: 14px;
- line-height: 32px;
+ line-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
padding-right: 8px;
color: var(--el-text-color-primary);
}
.operations {
+ display: none;
width: 40px;
color: var(--el-text-color-regular);
.icon {
diff --git a/src/i18n/en/chat.json b/src/i18n/en/chat.json
index 85b5b717..c95aa1c6 100644
--- a/src/i18n/en/chat.json
+++ b/src/i18n/en/chat.json
@@ -4,7 +4,7 @@
"description": "Model name of the service, which is GPT 3.5 Basic"
},
"model.35StandardDescription": {
- "message": "Basic model that can answer simple questions and provide general information.",
+ "message": "Great for everyday tasks.",
"description": "Description of the 3.5 Standard model"
},
"model.35Browsing": {
@@ -12,7 +12,7 @@
"description": "Model name of the service, which is GPT 3.5 Browsing"
},
"model.35BrowsingDescription": {
- "message": "Can real-time retrieve information from the web and provide more basic answers.",
+ "message": "Can real-time retrieve information.",
"description": "Description of the 3.5 Browsing model"
},
"model.4Standard": {
@@ -20,7 +20,7 @@
"description": "Model name of the service, which is GPT 4.0 Standard"
},
"model.4StandardDescription": {
- "message": "More powerful model that can answer more complex questions.",
+ "message": "More powerful model for complex tasks.",
"description": "Description of the 4.0 Standard model"
},
"model.4Browsing": {
@@ -28,7 +28,7 @@
"description": "Model name of the service, which is GPT 4.0 Browsing"
},
"model.4BrowsingDescription": {
- "message": "Can real-time retrieve information to provide more answers based on 4.0 Standard model.",
+ "message": "Powerful & real-time retrieve information.",
"description": "Description of the 4.0 Browsing model"
},
"model.4Vision": {
@@ -36,7 +36,7 @@
"description": "Model name of the service, which is GPT 4.0 Vision"
},
"model.4VisionDescription": {
- "message": "Can analyze images and provide information based on the content of the images.",
+ "message": "Can analyze images.",
"description": "Description of the 4.0 Vision model"
},
"message.startNewChat": {
@@ -76,41 +76,21 @@
"description": "Message in a webpage, which tell user to try for free"
},
"message.question1": {
- "message": "Write a piece of JavaScript code that outputs Hello World",
+ "message": "Create a workout plan",
"description": "An example questions for starting a chat, which ask user to write a piece of JavaScript code that outputs Hello World"
},
"message.question2": {
- "message": "Write an email to Mike, telling him that I just moved",
+ "message": "Make a personal webpage",
"description": "An example questions for starting a chat, which ask user to write an email to Mike, telling him that I just moved"
},
"message.question3": {
- "message": "Explain the basic principles of quantum computing in simple terms",
+ "message": "Design a fun coding game",
"description": "An example questions for starting a chat, which ask user to explain the basic principles of quantum computing in simple terms"
},
"message.question4": {
- "message": "What impact has virtual reality had on artistic creation?",
+ "message": "Experience Seoul like a local",
"description": "An example questions for starting a chat, which ask user to explain what impact has virtual reality had on artistic creation"
},
- "message.question5": {
- "message": "How do privacy protection and data security affect legal practice?",
- "description": "An example questions for starting a chat, which ask user to explain how do privacy protection and data security affect legal practice"
- },
- "message.question6": {
- "message": "How to deal with the complex changes in tax laws in todays world?",
- "description": "An example questions for starting a chat, which ask user to explain how to deal with the complex changes in tax laws in todays world"
- },
- "message.question7": {
- "message": "How to create unique cuisine by combining different regional cultural backgrounds?",
- "description": "An example questions for starting a chat, which ask user to explain how to create unique cuisine by combining different regional cultural backgrounds"
- },
- "message.question8": {
- "message": "How to draw literary creation inspiration from travel experiences?",
- "description": "An example questions for starting a chat, which ask user to explain how to draw literary creation inspiration from travel experiences"
- },
- "message.question9": {
- "message": "How to get business ideas from successful cases in different industries?",
- "description": "An example questions for starting a chat, which ask user to explain how to get business ideas from successful cases in different industries"
- },
"message.errorApiError": {
"message": "Answer failed, please try again later",
"description": "Message in a webpage, which tell user that answer failed, please try again later"
@@ -152,8 +132,8 @@
"description": "Message in a webpage, which tell user to confirm deletion"
},
"message.howToUse": {
- "message": "Press Shift+Enter to start a new line",
- "description": "Message in a webpage, which tell user to press Shift+Enter to start a new line"
+ "message": "AI can make mistakes. Check important info.",
+ "description": "Message in a webpage, which tell user that AI can make mistakes. Check important info."
},
"title.chat": {
"message": "AI Chat",
@@ -182,5 +162,21 @@
"title.getTips": {
"message": "Get inspiration and creativity",
"description": "Title in a webpage, which tells this part is about the ability of the service to get inspiration and creativity"
+ },
+ "group.today": {
+ "message": "Today",
+ "description": "Group name in a webpage, which is Today"
+ },
+ "group.yesterday": {
+ "message": "Yesterday",
+ "description": "Group name in a webpage, which is Yesterday"
+ },
+ "group.thisWeek": {
+ "message": "This week",
+ "description": "Group name in a webpage, which is This week"
+ },
+ "group.earlier": {
+ "message": "Earlier",
+ "description": "Group name in a webpage, which is Earlier"
}
-}
\ No newline at end of file
+}
diff --git a/src/layouts/Chat.vue b/src/layouts/Chat.vue
index c25d8462..2808fc87 100644
--- a/src/layouts/Chat.vue
+++ b/src/layouts/Chat.vue
@@ -61,7 +61,7 @@ export default defineComponent({
display: flex;
flex-direction: row;
.side {
- width: 300px;
+ width: 250px;
height: 100%;
overflow-y: scroll;
}
@@ -70,10 +70,11 @@ export default defineComponent({
height: 100%;
padding: 15px;
flex: 1;
- width: calc(100% - 300px);
+ width: calc(100% - 250px);
height: 100%;
display: flex;
flex-direction: column;
+ position: relative;
}
}
diff --git a/src/models/chat.ts b/src/models/chat.ts
index e4d42ab0..9bacd028 100644
--- a/src/models/chat.ts
+++ b/src/models/chat.ts
@@ -52,6 +52,7 @@ export interface IChatConversation {
deleting?: boolean;
editing?: boolean;
new?: boolean;
+ updated_at: number;
}
export interface IChatConversationOptions {
diff --git a/src/pages/chat/Conversation.vue b/src/pages/chat/Conversation.vue
index edd55390..e7d1f021 100644
--- a/src/pages/chat/Conversation.vue
+++ b/src/pages/chat/Conversation.vue
@@ -1,7 +1,7 @@
-
+