diff --git a/src/components/common/LeftNavigator.vue b/src/components/common/LeftNavigator.vue
index 04ac44ed..e63236eb 100644
--- a/src/components/common/LeftNavigator.vue
+++ b/src/components/common/LeftNavigator.vue
@@ -2,11 +2,13 @@
-
@@ -32,11 +34,14 @@
import { ROUTE_CONVERSATION_DETAIL, ROUTE_CONVERSATION_NEW } from '@/router';
import { defineComponent } from 'vue';
import NavigatorItem from './NavigatorItem.vue';
+import ConversationNavigatorItem from '../conversation/ConversationNavigatorItem.vue';
+import { IConversation } from '@/operators/conversation/models';
export default defineComponent({
name: 'LeftNavigator',
components: {
- NavigatorItem
+ NavigatorItem,
+ ConversationNavigatorItem
},
data() {
return {
@@ -72,6 +77,14 @@ export default defineComponent({
setTimeout(() => {
window.location.reload();
}, 1000);
+ },
+ onUpdateTitle(conversation: IConversation, val: string) {
+ conversation.title = val;
+ this.$store.dispatch('setConversations', this.conversations);
+ },
+ onDeleteConversation(id: string) {
+ const newConversations = this.conversations.filter((i: IConversation) => i.id !== id);
+ this.$store.dispatch('setConversations', newConversations);
}
}
});
diff --git a/src/components/conversation/ConversationNavigatorItem.vue b/src/components/conversation/ConversationNavigatorItem.vue
new file mode 100644
index 00000000..66f8238c
--- /dev/null
+++ b/src/components/conversation/ConversationNavigatorItem.vue
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+ {{ title }}
+
+
+ {{ `${$t('conversation.message.confirmDelete')}"${title}"?` }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/conversation/MessageContent.vue b/src/components/conversation/MessageContent.vue
index 1e1c32ff..3b402bc2 100644
--- a/src/components/conversation/MessageContent.vue
+++ b/src/components/conversation/MessageContent.vue
@@ -1,5 +1,5 @@
-
+
@@ -65,3 +65,9 @@ export default defineComponent({
}
});
+
+
diff --git a/src/i18n/zh/conversation/message.ts b/src/i18n/zh/conversation/message.ts
index 6f9c1880..8b78ef56 100644
--- a/src/i18n/zh/conversation/message.ts
+++ b/src/i18n/zh/conversation/message.ts
@@ -17,5 +17,6 @@ export default {
errorBusy: 'Worker正在忙碌中,请稍后重试',
errorApiError: '回答失败,请稍后重试',
errorBadRequest: '请求内容不规范,请重新提问',
- errorNoConversation: '对话内容不存在或者已经过期,请发起新的会话'
+ errorNoConversation: '对话内容不存在或者已经过期,请发起新的会话',
+ confirmDelete: '确定删除'
};
diff --git a/src/pages/conversation/Main.vue b/src/pages/conversation/Main.vue
index eb7c9352..c4ce47ea 100644
--- a/src/pages/conversation/Main.vue
+++ b/src/pages/conversation/Main.vue
@@ -128,6 +128,10 @@ export default defineComponent({
}
},
methods: {
+ scrollDown() {
+ const container = document.querySelector('.main') as HTMLDivElement;
+ container.scrollTop = container.scrollHeight;
+ },
restoreMessages() {
if (this.conversationId) {
const conversations = this.$store.getters.conversations;
@@ -209,6 +213,7 @@ export default defineComponent({
onDraft(content: string) {
this.input = content;
},
+
onSend() {
if (this.answering) {
return;
@@ -246,6 +251,9 @@ export default defineComponent({
});
this.answering = true;
this.input = '';
+ setTimeout(() => {
+ this.scrollDown();
+ }, 100);
chatgptOperator
.post(
{
@@ -271,6 +279,7 @@ export default defineComponent({
const lines = response.split('\r\n').filter((line: string) => !!line);
const lastLine = lines[lines.length - 1];
if (lastLine) {
+ this.scrollDown();
const jsonData = JSON.parse(lastLine);
const answer = jsonData.answer;
const conversationId = jsonData.conversation_id;
@@ -309,7 +318,9 @@ export default defineComponent({
} else {
// update one of existing conversations
conversations.forEach((conversation: IConversation) => {
- conversation.messages = this.messages;
+ if (conversation.id === this.conversationId) {
+ conversation.messages = this.messages;
+ }
});
this.$store.dispatch('setConversations', conversations);
}
diff --git a/src/plugins/font-awesome.ts b/src/plugins/font-awesome.ts
index 3a6aa7f9..78da1f53 100644
--- a/src/plugins/font-awesome.ts
+++ b/src/plugins/font-awesome.ts
@@ -16,10 +16,14 @@ import {
faArrowsRotate as faSolidArrowsRotate,
faUpRightFromSquare as faSolidUpRightFromSquare,
faArrowRightFromBracket as faSolidArrowRightFromBracket,
- faTriangleExclamation as faSolidTriangleExclamation
+ faTriangleExclamation as faSolidTriangleExclamation,
+ faPenToSquare as faSolidPenToSquare,
+ faXmark as faSolidXmark
} from '@fortawesome/free-solid-svg-icons';
library.add(faRegularCopy);
+library.add(faSolidXmark);
library.add(faSolidRotateRight);
+library.add(faSolidPenToSquare);
library.add(faSolidCheck);
library.add(faRegularUser);
library.add(faRegularSun);