From 3e5e158b27817d2669fe47eb25cc3fed88889898 Mon Sep 17 00:00:00 2001 From: AceDataCloud Date: Wed, 1 Nov 2023 18:10:36 +0800 Subject: [PATCH] update dialog --- src/components/chat/Sidebar.vue | 162 ++++++++++++++++++---- src/components/conversation/Sidebar.vue | 0 src/components/midjourney/FinalPrompt.vue | 38 +++++ src/pages/chat/Conversation.vue | 62 ++++++--- src/pages/chat/Index.vue | 50 ++++++- src/pages/midjourney/Index.vue | 8 +- 6 files changed, 269 insertions(+), 51 deletions(-) create mode 100644 src/components/conversation/Sidebar.vue create mode 100644 src/components/midjourney/FinalPrompt.vue diff --git a/src/components/chat/Sidebar.vue b/src/components/chat/Sidebar.vue index 51c99eee..b8f02770 100644 --- a/src/components/chat/Sidebar.vue +++ b/src/components/chat/Sidebar.vue @@ -1,38 +1,120 @@ @@ -42,13 +124,45 @@ export default defineComponent({ display: flex; flex-direction: column; align-items: flex-end; - .top { - display: flex; - flex-direction: column; - } - .bottom { + padding: 15px; + .conversations { + flex: 1; display: flex; flex-direction: column; + align-items: center; + .conversation { + width: 100%; + height: 50px; + display: flex; + flex-direction: row; + padding: 10px; + margin-bottom: 5px; + border: 1px dashed hsl(0, 0%, 93%); + line-height: 30px; + border-radius: 10px; + color: #666; + cursor: pointer; + + .icons { + width: 30px; + padding-left: 10px; + .icon { + font-size: 14px; + } + } + .title { + flex: 1; + font-size: 14px; + } + .operations { + width: 45px; + .icon { + cursor: pointer; + font-size: 14px; + margin-right: 8px; + } + } + } } } diff --git a/src/components/conversation/Sidebar.vue b/src/components/conversation/Sidebar.vue new file mode 100644 index 00000000..e69de29b diff --git a/src/components/midjourney/FinalPrompt.vue b/src/components/midjourney/FinalPrompt.vue new file mode 100644 index 00000000..56941aea --- /dev/null +++ b/src/components/midjourney/FinalPrompt.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/pages/chat/Conversation.vue b/src/pages/chat/Conversation.vue index 960df655..148a1247 100644 --- a/src/pages/chat/Conversation.vue +++ b/src/pages/chat/Conversation.vue @@ -1,17 +1,20 @@ @@ -38,6 +41,7 @@ import { ERROR_CODE_CANCELED, ERROR_CODE_UNKNOWN } from '@/constants/errorCode'; import axios from 'axios'; import ApiStatus from '@/components/common/ApiStatus.vue'; import { ROUTE_CHAT_CONVERSATION, ROUTE_CHAT_CONVERSATION_NEW } from '@/router'; +import Sidebar from '@/components/chat/Sidebar.vue'; export interface IData { messages: IChatMessage[]; @@ -55,7 +59,8 @@ export default defineComponent({ InputBox, ModelSelector, Message, - ApiStatus + ApiStatus, + Sidebar }, data(): IData { return { @@ -110,10 +115,7 @@ export default defineComponent({ this.question = ''; await this.onFetchAnswer(); }, - async onFetchHistory() { - if (!this.conversationId) { - return; - } + async onFetchHistory(id?: string) { const endpoint = this.application?.api?.endpoint; const path = this.application?.api?.path; console.log(endpoint, path); @@ -124,7 +126,7 @@ export default defineComponent({ const { data: data } = await chatOperator.conversations( { action: IChatConversationAction.RETRIEVE, - id: this.conversationId + id: id || this.conversationId }, { endpoint, @@ -208,20 +210,40 @@ export default defineComponent({ diff --git a/src/pages/midjourney/Index.vue b/src/pages/midjourney/Index.vue index b5027a64..1aa7131c 100644 --- a/src/pages/midjourney/Index.vue +++ b/src/pages/midjourney/Index.vue @@ -9,9 +9,7 @@ -

- {{ finalPrompt }} -

+ 生成
@@ -43,6 +41,7 @@ import { } from '@/operators'; import ApiStatus from '@/components/common/ApiStatus.vue'; import TaskBriefList from '@/components/midjourney/TaskBriefList.vue'; +import FinalPrompt from '@/components/midjourney/FinalPrompt.vue'; interface IData { channel: IMidjourneyChannel; @@ -66,7 +65,8 @@ export default defineComponent({ IgnoreSelector, ElButton, ApiStatus, - TaskBriefList + TaskBriefList, + FinalPrompt }, data(): IData { return {