|
1 | 1 | <template> |
2 | 2 | <el-container class="chat-container no-padding"> |
3 | | - <el-aside v-if="!isAssistant && chatListSideBarShow" class="chat-container-left"> |
| 3 | + <el-aside v-if="isCompletePage && chatListSideBarShow" class="chat-container-left"> |
4 | 4 | <ChatListContainer |
5 | 5 | v-model:chat-list="chatList" |
6 | 6 | v-model:current-chat-id="currentChatId" |
|
16 | 16 | /> |
17 | 17 | </el-aside> |
18 | 18 | <div |
19 | | - v-if="isAssistant || !chatListSideBarShow" |
| 19 | + v-if="!isCompletePage || !chatListSideBarShow" |
20 | 20 | class="hidden-sidebar-btn" |
21 | | - :class="{ 'assistant-popover-sidebar': isAssistant }" |
| 21 | + :class="{ 'assistant-popover-sidebar': !isCompletePage }" |
22 | 22 | > |
23 | 23 | <el-popover |
24 | 24 | :width="280" |
|
86 | 86 | <el-main |
87 | 87 | class="chat-record-list" |
88 | 88 | :class="{ |
89 | | - 'hide-sidebar': !isAssistant && !chatListSideBarShow, |
90 | | - 'assistant-chat-main': isAssistant, |
| 89 | + 'hide-sidebar': isCompletePage && !chatListSideBarShow, |
| 90 | + 'assistant-chat-main': !isCompletePage, |
91 | 91 | }" |
92 | 92 | > |
93 | 93 | <div v-if="computedMessages.length == 0 && !loading" class="welcome-content-block"> |
94 | 94 | <div class="welcome-content"> |
95 | | - <template v-if="!isAssistant"> |
| 95 | + <template v-if="isCompletePage"> |
96 | 96 | <div class="greeting"> |
97 | 97 | <el-icon size="32"> |
98 | 98 | <logo_fold /> |
|
111 | 111 | </div> |
112 | 112 |
|
113 | 113 | <el-button |
114 | | - v-if="!isAssistant && currentChatId === undefined" |
| 114 | + v-if="isCompletePage && currentChatId === undefined" |
115 | 115 | size="large" |
116 | 116 | type="primary" |
117 | 117 | class="greeting-btn" |
|
138 | 138 | <div |
139 | 139 | ref="innerRef" |
140 | 140 | class="chat-scroll" |
141 | | - :class="{ 'no-sidebar': !isAssistant && !chatListSideBarShow, pad16: isAssistant }" |
| 141 | + :class="{ |
| 142 | + 'no-sidebar': isCompletePage && !chatListSideBarShow, |
| 143 | + pad16: !isCompletePage, |
| 144 | + }" |
142 | 145 | > |
143 | 146 | <template v-for="(message, _index) in computedMessages" :key="_index"> |
144 | 147 | <ChatRow :current-chat="currentChat" :msg="message" :hide-avatar="message.first_chat"> |
|
293 | 296 | </div> |
294 | 297 | </el-scrollbar> |
295 | 298 | </el-main> |
296 | | - <el-footer v-if="computedMessages.length > 0 || isAssistant" class="chat-footer"> |
| 299 | + <el-footer v-if="computedMessages.length > 0 || !isCompletePage" class="chat-footer"> |
297 | 300 | <div class="input-wrapper" @click="clickInput"> |
298 | | - <div v-if="!isAssistant" class="datasource"> |
| 301 | + <div v-if="isCompletePage" class="datasource"> |
299 | 302 | <template v-if="currentChat.datasource && currentChat.datasource_name"> |
300 | 303 | {{ t('qa.selected_datasource') }}: |
301 | 304 | <img |
|
317 | 320 | :disabled="isTyping" |
318 | 321 | clearable |
319 | 322 | class="input-area" |
320 | | - :class="isAssistant && 'is-assistant'" |
| 323 | + :class="!isCompletePage && 'is-assistant'" |
321 | 324 | type="textarea" |
322 | 325 | :autosize="{ minRows: 1, maxRows: 8.583 }" |
323 | 326 | :placeholder="t('qa.question_placeholder')" |
|
340 | 343 | </el-footer> |
341 | 344 | </el-container> |
342 | 345 |
|
343 | | - <ChatCreator v-if="!isAssistant" ref="chatCreatorRef" @on-chat-created="onChatCreatedQuick" /> |
| 346 | + <ChatCreator v-if="isCompletePage" ref="chatCreatorRef" @on-chat-created="onChatCreatedQuick" /> |
344 | 347 | <ChatCreator ref="hiddenChatCreatorRef" hidden @on-chat-created="onChatCreatedQuick" /> |
345 | 348 | </el-container> |
346 | 349 | </template> |
@@ -390,7 +393,7 @@ const defaultFloatPopoverStyle = ref({ |
390 | 393 | borderRadius: '6px', |
391 | 394 | }) |
392 | 395 |
|
393 | | -const isAssistant = computed(() => assistantStore.getAssistant) |
| 396 | +const isCompletePage = computed(() => !assistantStore.getAssistant || assistantStore.getEmbedded) |
394 | 397 |
|
395 | 398 | const { t } = useI18n() |
396 | 399 |
|
@@ -527,7 +530,7 @@ const createNewChat = async () => { |
527 | 530 | return |
528 | 531 | } |
529 | 532 | goEmpty() |
530 | | - if (isAssistant.value) { |
| 533 | + if (!isCompletePage.value) { |
531 | 534 | currentChat.value = new ChatInfo() |
532 | 535 | currentChatId.value = undefined |
533 | 536 | return |
@@ -574,7 +577,7 @@ function onChatRenamed(chat: Chat) { |
574 | 577 |
|
575 | 578 | const chatListSideBarShow = ref<boolean>(true) |
576 | 579 | function hideSideBar() { |
577 | | - if (isAssistant.value) { |
| 580 | + if (!isCompletePage.value) { |
578 | 581 | floatPopoverVisible.value = false |
579 | 582 | return |
580 | 583 | } |
@@ -646,7 +649,7 @@ function onChatStop() { |
646 | 649 | } |
647 | 650 | const assistantPrepareSend = async () => { |
648 | 651 | if ( |
649 | | - isAssistant.value && |
| 652 | + !isCompletePage.value && |
650 | 653 | (currentChatId.value == null || typeof currentChatId.value == 'undefined') |
651 | 654 | ) { |
652 | 655 | const assistantChat = await assistantStore.setChat() |
@@ -873,12 +876,12 @@ function stop(func?: (...p: any[]) => void, ...param: any[]) { |
873 | 876 | } |
874 | 877 | } |
875 | 878 | const showFloatPopover = () => { |
876 | | - if (isAssistant.value && !floatPopoverVisible.value) { |
| 879 | + if (!isCompletePage.value && !floatPopoverVisible.value) { |
877 | 880 | floatPopoverVisible.value = true |
878 | 881 | } |
879 | 882 | } |
880 | 883 | const assistantPrepareInit = () => { |
881 | | - if (!isAssistant.value) { |
| 884 | + if (isCompletePage.value) { |
882 | 885 | return |
883 | 886 | } |
884 | 887 | Object.assign(defaultFloatPopoverStyle.value, { |
|
0 commit comments