|
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" |
|
132 | 132 | <el-scrollbar v-if="computedMessages.length > 0" ref="chatListRef" class="no-horizontal"> |
133 | 133 | <div |
134 | 134 | class="chat-scroll" |
135 | | - :class="{ 'no-sidebar': !isAssistant && !chatListSideBarShow, pad16: isAssistant }" |
| 135 | + :class="{ |
| 136 | + 'no-sidebar': isCompletePage && !chatListSideBarShow, |
| 137 | + pad16: !isCompletePage, |
| 138 | + }" |
136 | 139 | > |
137 | 140 | <template v-for="(message, _index) in computedMessages" :key="_index"> |
138 | 141 | <ChatRow :current-chat="currentChat" :msg="message" :hide-avatar="message.first_chat"> |
|
287 | 290 | </div> |
288 | 291 | </el-scrollbar> |
289 | 292 | </el-main> |
290 | | - <el-footer v-if="computedMessages.length > 0 || isAssistant" class="chat-footer"> |
| 293 | + <el-footer v-if="computedMessages.length > 0 || !isCompletePage" class="chat-footer"> |
291 | 294 | <div class="input-wrapper" @click="clickInput"> |
292 | | - <div v-if="!isAssistant" class="datasource"> |
| 295 | + <div v-if="isCompletePage" class="datasource"> |
293 | 296 | <template v-if="currentChat.datasource && currentChat.datasource_name"> |
294 | 297 | {{ t('qa.selected_datasource') }}: |
295 | 298 | <img |
|
311 | 314 | :disabled="isTyping" |
312 | 315 | clearable |
313 | 316 | class="input-area" |
314 | | - :class="isAssistant && 'is-assistant'" |
| 317 | + :class="!isCompletePage && 'is-assistant'" |
315 | 318 | type="textarea" |
316 | 319 | :autosize="{ minRows: 1, maxRows: 8.583 }" |
317 | 320 | :placeholder="t('qa.question_placeholder')" |
|
334 | 337 | </el-footer> |
335 | 338 | </el-container> |
336 | 339 |
|
337 | | - <ChatCreator v-if="!isAssistant" ref="chatCreatorRef" @on-chat-created="onChatCreatedQuick" /> |
| 340 | + <ChatCreator v-if="isCompletePage" ref="chatCreatorRef" @on-chat-created="onChatCreatedQuick" /> |
338 | 341 | <ChatCreator ref="hiddenChatCreatorRef" hidden @on-chat-created="onChatCreatedQuick" /> |
339 | 342 | </el-container> |
340 | 343 | </template> |
@@ -384,7 +387,7 @@ const defaultFloatPopoverStyle = ref({ |
384 | 387 | borderRadius: '6px', |
385 | 388 | }) |
386 | 389 |
|
387 | | -const isAssistant = computed(() => assistantStore.getAssistant) |
| 390 | +const isCompletePage = computed(() => !assistantStore.getAssistant || assistantStore.getEmbedded) |
388 | 391 |
|
389 | 392 | const { t } = useI18n() |
390 | 393 |
|
@@ -479,7 +482,7 @@ const createNewChat = async () => { |
479 | 482 | return |
480 | 483 | } |
481 | 484 | goEmpty() |
482 | | - if (isAssistant.value) { |
| 485 | + if (!isCompletePage.value) { |
483 | 486 | currentChat.value = new ChatInfo() |
484 | 487 | currentChatId.value = undefined |
485 | 488 | return |
@@ -526,7 +529,7 @@ function onChatRenamed(chat: Chat) { |
526 | 529 |
|
527 | 530 | const chatListSideBarShow = ref<boolean>(true) |
528 | 531 | function hideSideBar() { |
529 | | - if (isAssistant.value) { |
| 532 | + if (!isCompletePage.value) { |
530 | 533 | floatPopoverVisible.value = false |
531 | 534 | return |
532 | 535 | } |
@@ -598,7 +601,7 @@ function onChatStop() { |
598 | 601 | } |
599 | 602 | const assistantPrepareSend = async () => { |
600 | 603 | if ( |
601 | | - isAssistant.value && |
| 604 | + !isCompletePage.value && |
602 | 605 | (currentChatId.value == null || typeof currentChatId.value == 'undefined') |
603 | 606 | ) { |
604 | 607 | const assistantChat = await assistantStore.setChat() |
@@ -821,12 +824,12 @@ function stop(func?: (...p: any[]) => void, ...param: any[]) { |
821 | 824 | } |
822 | 825 | } |
823 | 826 | const showFloatPopover = () => { |
824 | | - if (isAssistant.value && !floatPopoverVisible.value) { |
| 827 | + if (!isCompletePage.value && !floatPopoverVisible.value) { |
825 | 828 | floatPopoverVisible.value = true |
826 | 829 | } |
827 | 830 | } |
828 | 831 | const assistantPrepareInit = () => { |
829 | | - if (!isAssistant.value) { |
| 832 | + if (isCompletePage.value) { |
830 | 833 | return |
831 | 834 | } |
832 | 835 | Object.assign(defaultFloatPopoverStyle.value, { |
|
0 commit comments