feat(chat): improve chat layout and suggested questions UX

Refine input field, session sidebar, suggested questions refresh, and
embed channel preview for a cleaner chat creation experience.
This commit is contained in:
wizardchen
2026-06-16 00:49:52 +08:00
committed by lyingbug
parent c6f1b54f73
commit 283dbbd577
7 changed files with 509 additions and 323 deletions
+54 -40
View File
@@ -1,12 +1,6 @@
<template> <template>
<t-drawer <t-drawer :visible="visible" :header="title || $t('embedPublish.preview')" size="720px" :footer="false"
:visible="visible" :z-index="2600" class="embed-preview-drawer" @close="emit('update:visible', false)">
:header="title || $t('embedPublish.preview')"
size="720px"
:footer="false"
class="embed-preview-drawer"
@close="emit('update:visible', false)"
>
<div class="preview-body"> <div class="preview-body">
<template v-if="mode === 'iframe'"> <template v-if="mode === 'iframe'">
<p class="preview-hint">{{ $t('embedPublish.previewIframeHint') }}</p> <p class="preview-hint">{{ $t('embedPublish.previewIframeHint') }}</p>
@@ -19,13 +13,7 @@
</div> </div>
<div class="device-frame__screen"> <div class="device-frame__screen">
<t-loading v-if="!iframeSrc || !iframeReady" size="small" :text="$t('embedPublish.previewLoading')" /> <t-loading v-if="!iframeSrc || !iframeReady" size="small" :text="$t('embedPublish.previewLoading')" />
<iframe <iframe v-else :key="iframeSrc" :src="iframeSrc" class="preview-iframe" allow="clipboard-write" />
v-else
:key="iframeSrc"
:src="iframeSrc"
class="preview-iframe"
allow="clipboard-write"
/>
</div> </div>
</div> </div>
</template> </template>
@@ -38,25 +26,15 @@
<div class="widget-mock-page__line" /> <div class="widget-mock-page__line" />
<div class="widget-mock-page__line widget-mock-page__line--short" /> <div class="widget-mock-page__line widget-mock-page__line--short" />
</div> </div>
<button <button type="button" class="widget-launcher" :style="{ background: primaryColor || 'var(--td-brand-color)' }"
type="button"
class="widget-launcher"
:style="{ background: primaryColor || 'var(--td-brand-color)' }"
:aria-label="widgetOpen ? $t('common.close') : $t('embedPublish.preview')" :aria-label="widgetOpen ? $t('common.close') : $t('embedPublish.preview')"
@click="widgetOpen = !widgetOpen" @click="widgetOpen = !widgetOpen">
>
<t-icon :name="widgetOpen ? 'close' : 'chat'" /> <t-icon :name="widgetOpen ? 'close' : 'chat'" />
</button> </button>
<transition name="widget-panel"> <transition name="widget-panel">
<div v-show="widgetOpen" class="widget-panel"> <div v-show="widgetOpen" class="widget-panel">
<iframe <iframe v-if="iframeSrc && iframeReady" :key="`widget-${iframeSrc}`" :src="iframeSrc"
v-if="iframeSrc && iframeReady" class="preview-iframe" :title="title || $t('embedPublish.preview')" allow="clipboard-write" />
:key="`widget-${iframeSrc}`"
:src="iframeSrc"
class="preview-iframe"
:title="title || $t('embedPublish.preview')"
allow="clipboard-write"
/>
</div> </div>
</transition> </transition>
</div> </div>
@@ -172,9 +150,17 @@ watch(() => props.visible, async (open) => {
border-radius: 50%; border-radius: 50%;
background: var(--td-component-stroke); background: var(--td-component-stroke);
&:nth-child(1) { background: #ff5f57; } &:nth-child(1) {
&:nth-child(2) { background: #febc2e; } background: #ff5f57;
&:nth-child(3) { background: #28c840; } }
&:nth-child(2) {
background: #febc2e;
}
&:nth-child(3) {
background: #28c840;
}
} }
&__url { &__url {
@@ -289,23 +275,51 @@ watch(() => props.visible, async (open) => {
} }
.pos-bottom-right { .pos-bottom-right {
.widget-launcher { right: 20px; bottom: 20px; } .widget-launcher {
.widget-panel { right: 20px; bottom: 80px; } right: 20px;
bottom: 20px;
}
.widget-panel {
right: 20px;
bottom: 80px;
}
} }
.pos-bottom-left { .pos-bottom-left {
.widget-launcher { left: 20px; bottom: 20px; } .widget-launcher {
.widget-panel { left: 20px; bottom: 80px; } left: 20px;
bottom: 20px;
}
.widget-panel {
left: 20px;
bottom: 80px;
}
} }
.pos-top-right { .pos-top-right {
.widget-launcher { right: 20px; top: 20px; } .widget-launcher {
.widget-panel { right: 20px; top: 80px; } right: 20px;
top: 20px;
}
.widget-panel {
right: 20px;
top: 80px;
}
} }
.pos-top-left { .pos-top-left {
.widget-launcher { left: 20px; top: 20px; } .widget-launcher {
.widget-panel { left: 20px; top: 80px; } left: 20px;
top: 20px;
}
.widget-panel {
left: 20px;
top: 80px;
}
} }
</style> </style>
+12 -8
View File
@@ -2170,15 +2170,17 @@ defineExpose({
</div> </div>
<!-- Agent 选择器下拉菜单 --> <!-- Agent 选择器下拉菜单 -->
<AgentSelector :visible="showAgentModeSelector" :anchorEl="agentModeButtonRef" :currentAgentId="selectedAgentId" <AgentSelector :visible="showAgentModeSelector" :anchorEl="agentModeButtonRef"
:agents="enabledAgents" @close="closeAgentModeSelector" @select="handleSelectAgent" /> :currentAgentId="selectedAgentId" :agents="enabledAgents" @close="closeAgentModeSelector"
@select="handleSelectAgent" />
<!-- WebSearch 开关按钮 --> <!-- WebSearch 开关按钮 -->
<t-tooltip placement="top" theme="light" :popupProps="{ overlayClassName: 'input-field-tooltip' }"> <t-tooltip placement="top" theme="light" :popupProps="{ overlayClassName: 'input-field-tooltip' }">
<template #content> <template #content>
<div v-if="isWebSearchDisabledByAgent" class="tooltip-with-link"> <div v-if="isWebSearchDisabledByAgent" class="tooltip-with-link">
<span>{{ $t('input.webSearchDisabledByAgent') }}</span> <span>{{ $t('input.webSearchDisabledByAgent') }}</span>
<a href="#" @click.prevent="handleGoToAgentSettings('websearch')">{{ $t('input.goToAgentSettings') }}</a> <a href="#" @click.prevent="handleGoToAgentSettings('websearch')">{{ $t('input.goToAgentSettings')
}}</a>
</div> </div>
<span v-else-if="isWebSearchConfigured">{{ isWebSearchEnabled ? $t('input.webSearch.toggleOff') : <span v-else-if="isWebSearchConfigured">{{ isWebSearchEnabled ? $t('input.webSearch.toggleOff') :
$t('input.webSearch.toggleOn') }}</span> $t('input.webSearch.toggleOn') }}</span>
@@ -2242,7 +2244,8 @@ defineExpose({
<path <path
d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" /> d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" />
</svg> </svg>
<span v-if="uploadedAttachments.length > 0" class="attachment-count">{{ uploadedAttachments.length }}</span> <span v-if="uploadedAttachments.length > 0" class="attachment-count">{{ uploadedAttachments.length
}}</span>
</div> </div>
</t-tooltip> </t-tooltip>
@@ -2251,7 +2254,8 @@ defineExpose({
<template #content> <template #content>
<div v-if="isKnowledgeBaseDisabledByAgent" class="tooltip-with-link"> <div v-if="isKnowledgeBaseDisabledByAgent" class="tooltip-with-link">
<span>{{ $t('input.kbDisabledByAgent') }}</span> <span>{{ $t('input.kbDisabledByAgent') }}</span>
<a href="#" @click.prevent="handleGoToAgentSettings('knowledge')">{{ $t('input.goToAgentSettings') }}</a> <a href="#" @click.prevent="handleGoToAgentSettings('knowledge')">{{ $t('input.goToAgentSettings')
}}</a>
</div> </div>
<span v-else>{{ allSelectedItems.length > 0 ? $t('input.knowledgeBaseWithCount', { <span v-else>{{ allSelectedItems.length > 0 ? $t('input.knowledgeBaseWithCount', {
count: count:
@@ -2392,8 +2396,8 @@ const getImgSrc = (url: string) => {
max-width: 800px; max-width: 800px;
background: var(--td-bg-color-container, #FFF); background: var(--td-bg-color-container, #FFF);
border-radius: 12px; border-radius: 12px;
border: .5px solid var(--td-component-border, #E7E7E7); border: 1px solid var(--td-component-stroke, #dcdcdc);
box-shadow: 0 6px 6px 0 rgba(0, 0, 0, 0.04), 0 12px 12px -1px rgba(0, 0, 0, 0.08); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 16px -4px rgba(0, 0, 0, 0.06);
&:focus-within { &:focus-within {
border-color: var(--td-brand-color, #07C05F); border-color: var(--td-brand-color, #07C05F);
@@ -2407,7 +2411,7 @@ const getImgSrc = (url: string) => {
align-items: center; align-items: center;
gap: 5px; gap: 5px;
padding: 6px 12px 6px; padding: 6px 12px 6px;
border-bottom: .5px solid var(--td-component-stroke, #e7e7e7); border-bottom: 1px solid var(--td-component-stroke, #dcdcdc);
background: var(--td-bg-color-container, #fff); background: var(--td-bg-color-container, #fff);
border-radius: 11px 11px 0 0; border-radius: 11px 11px 0 0;
/* 与 .rich-input-container 内缘上边圆角一致(12px - 1px 边框) */ /* 与 .rich-input-container 内缘上边圆角一致(12px - 1px 边框) */
+136 -9
View File
@@ -21,27 +21,54 @@
<t-icon v-if="item.is_pinned" name="pin" class="submenu_pin_icon" /> <t-icon v-if="item.is_pinned" name="pin" class="submenu_pin_icon" />
<span class="submenu_title-text">{{ item.title }}</span> <span class="submenu_title-text">{{ item.title }}</span>
</span> </span>
<t-dropdown <div v-if="!batchMode" class="session-row-menu-wrap" @click.stop>
v-if="!batchMode" <button
:options="menuOptions" type="button"
placement="bottom-right" class="menu-more-wrap"
trigger="click" aria-haspopup="menu"
@click="emit('menu-click', $event)" :aria-expanded="menuOpen"
@click="toggleMenu"
> >
<div @click.stop class="menu-more-wrap">
<t-icon name="ellipsis" class="menu-more" /> <t-icon name="ellipsis" class="menu-more" />
</button>
<div v-if="menuOpen" class="session-row-menu" role="menu">
<button
v-for="option in menuOptions"
:key="option.value"
type="button"
class="session-row-menu__item"
:class="{ 'session-row-menu__item--error': option.theme === 'error' }"
role="menuitem"
@click="handleMenuClick(option)"
>
<component
:is="option.prefixIcon"
v-if="option.prefixIcon"
class="session-row-menu__icon"
/>
<span class="session-row-menu__text">{{ option.content }}</span>
</button>
</div>
</div> </div>
</t-dropdown>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeUnmount, ref } from 'vue'
interface SessionMenuOption {
content: string
value: string
theme?: 'default' | 'success' | 'warning' | 'error' | 'primary'
prefixIcon?: any
}
defineProps<{ defineProps<{
item: { id: string; path: string; title: string; is_pinned?: boolean } item: { id: string; path: string; title: string; is_pinned?: boolean }
batchMode: boolean batchMode: boolean
activePath: string activePath: string
selectedIds: string[] selectedIds: string[]
menuOptions: any[] menuOptions: SessionMenuOption[]
/** 渠道文件夹下的会话(样式与聊天区会话共用文案列对齐) */ /** 渠道文件夹下的会话(样式与聊天区会话共用文案列对齐) */
nested?: boolean nested?: boolean
}>() }>()
@@ -53,4 +80,104 @@ const emit = defineEmits<{
(e: 'hover-in'): void (e: 'hover-in'): void
(e: 'hover-out'): void (e: 'hover-out'): void
}>() }>()
const menuOpen = ref(false)
const closeMenu = (): void => {
menuOpen.value = false
document.removeEventListener('click', closeMenu)
}
const toggleMenu = (): void => {
menuOpen.value = !menuOpen.value
if (menuOpen.value) {
document.addEventListener('click', closeMenu)
} else {
document.removeEventListener('click', closeMenu)
}
}
const handleMenuClick = (option: SessionMenuOption): void => {
closeMenu()
emit('menu-click', { value: option.value })
}
onBeforeUnmount(() => {
document.removeEventListener('click', closeMenu)
})
</script> </script>
<style scoped lang="less">
.submenu_item {
position: relative;
}
.session-row-menu-wrap {
position: relative;
flex: 0 0 auto;
}
.menu-more-wrap {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
padding: 0;
border: 0;
border-radius: 6px;
color: inherit;
background: transparent;
cursor: pointer;
}
.session-row-menu {
position: absolute;
top: calc(100% + 4px);
right: 0;
z-index: 30;
min-width: 132px;
padding: 4px;
border: 1px solid var(--td-component-stroke);
border-radius: 6px;
background: var(--td-bg-color-container);
box-shadow: var(--td-shadow-2);
}
.session-row-menu__item {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
min-height: 32px;
padding: 0 10px;
border: 0;
border-radius: 4px;
color: var(--td-text-color-primary);
background: transparent;
font-size: 14px;
line-height: 20px;
text-align: left;
cursor: pointer;
&:hover {
background: var(--td-bg-color-container-hover);
}
}
.session-row-menu__item--error {
color: var(--td-error-color);
}
.session-row-menu__icon {
flex: 0 0 auto;
display: inline-flex;
}
.session-row-menu__text {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
+11 -14
View File
@@ -114,24 +114,20 @@
<!-- 其他来源(IM / 网页嵌入):置顶一行入口,默认收起 --> <!-- 其他来源(IM / 网页嵌入):置顶一行入口,默认收起 -->
<div v-if="visibleChannelBuckets.length" class="session-channels-section"> <div v-if="visibleChannelBuckets.length" class="session-channels-section">
<div class="timeline_header timeline_header--collapsible session-list-row session-list-row--flat" <div class="timeline_header timeline_header--collapsible session-list-row session-list-row--flat"
role="button" tabindex="0" role="button" tabindex="0" @click="toggleChannelsSection"
@click="toggleChannelsSection" @keydown.enter.prevent="toggleChannelsSection" @keydown.space.prevent="toggleChannelsSection">
@keydown.enter.prevent="toggleChannelsSection"
@keydown.space.prevent="toggleChannelsSection">
<span class="session-list-row__body"> <span class="session-list-row__body">
<span class="session-header-text"> <span class="session-header-text">
<span class="timeline_header-label">{{ t('menu.otherSources') }}</span> <span class="timeline_header-label">{{ t('menu.otherSources') }}</span>
<t-icon class="timeline_header-chevron" <t-icon class="timeline_header-chevron"
:name="channelsSectionCollapsed ? 'chevron-right' : 'chevron-down'" :name="channelsSectionCollapsed ? 'chevron-right' : 'chevron-down'" size="10px" />
size="10px" />
</span> </span>
</span> </span>
</div> </div>
<template v-if="!channelsSectionCollapsed"> <template v-if="!channelsSectionCollapsed">
<template v-for="bucket in visibleChannelBuckets" :key="bucket.key"> <template v-for="bucket in visibleChannelBuckets" :key="bucket.key">
<div class="session-folder-header session-list-row session-list-row--flat" <div class="session-folder-header session-list-row session-list-row--flat" role="button"
role="button" tabindex="0" tabindex="0" @click="toggleSessionGroup(bucket.key)"
@click="toggleSessionGroup(bucket.key)"
@keydown.enter.prevent="toggleSessionGroup(bucket.key)" @keydown.enter.prevent="toggleSessionGroup(bucket.key)"
@keydown.space.prevent="toggleSessionGroup(bucket.key)"> @keydown.space.prevent="toggleSessionGroup(bucket.key)">
<span class="session-list-row__body"> <span class="session-list-row__body">
@@ -151,8 +147,7 @@
</span> </span>
</div> </div>
<template v-if="!isSessionGroupCollapsed(bucket.key)"> <template v-if="!isSessionGroupCollapsed(bucket.key)">
<div v-if="bucket.loading && bucket.items.length === 0" <div v-if="bucket.loading && bucket.items.length === 0" class="session-folder-loading">
class="session-folder-loading">
<div class="session-list-row session-list-row--flat"> <div class="session-list-row session-list-row--flat">
<span class="session-list-row__body"> <span class="session-list-row__body">
<t-loading size="small" /> <t-loading size="small" />
@@ -191,13 +186,15 @@
<span class="timeline_header-label">{{ group.label }}</span> <span class="timeline_header-label">{{ group.label }}</span>
</span> </span>
</div> </div>
<div v-for="subitem in group.items" :key="subitem.id" class="submenu_item_p session-chat-row"> <div v-for="subitem in group.items" :key="subitem.id"
class="submenu_item_p session-chat-row">
<div class="session-list-row session-list-row--flat"> <div class="session-list-row session-list-row--flat">
<div class="session-list-row__body"> <div class="session-list-row__body">
<SessionSidebarRow :item="subitem" :batch-mode="batchMode" <SessionSidebarRow :item="subitem" :batch-mode="batchMode"
:active-path="currentSecondpath" :selected-ids="batchSelectedIds" :active-path="currentSecondpath" :selected-ids="batchSelectedIds"
:menu-options="buildSessionMenuOptions(subitem)" :menu-options="buildSessionMenuOptions(subitem)"
@navigate="gotopage(subitem.path)" @toggle-select="toggleBatchSelect(subitem.id)" @navigate="gotopage(subitem.path)"
@toggle-select="toggleBatchSelect(subitem.id)"
@menu-click="handleSessionMenuClick($event, subitem)" @menu-click="handleSessionMenuClick($event, subitem)"
@hover-in="mouseenteBotDownr(subitem.id)" @hover-out="mouseleaveBotDown" /> @hover-in="mouseenteBotDownr(subitem.id)" @hover-out="mouseleaveBotDown" />
</div> </div>
@@ -1726,7 +1723,7 @@ const onDragHandleMouseDown = (e: MouseEvent) => {
line-height: 20px; line-height: 20px;
height: 100%; height: 100%;
width: 100%; width: 100%;
padding: 4px 0; padding: 6px 0;
position: relative; position: relative;
min-width: 0; min-width: 0;
background: transparent; background: transparent;
@@ -112,6 +112,7 @@ export function useEmbedChatSession(options: {
const { const {
shouldRenderAssistantMessage, shouldRenderAssistantMessage,
shouldShowGlobalTypingIndicator,
handleMsgList, handleMsgList,
processStreamChunk, processStreamChunk,
} = useChatStreamHandler({ } = useChatStreamHandler({
@@ -359,6 +360,7 @@ export function useEmbedChatSession(options: {
userHasScrolledUp, userHasScrolledUp,
isFirstEnter, isFirstEnter,
shouldRenderAssistantMessage, shouldRenderAssistantMessage,
shouldShowGlobalTypingIndicator,
getUserQuery, getUserQuery,
handleScroll, handleScroll,
scrollToBottom, scrollToBottom,
+74 -34
View File
@@ -8,30 +8,31 @@
<div ref="sqContainerRef" class="suggested-questions-container"> <div ref="sqContainerRef" class="suggested-questions-container">
<!-- 骨架屏占位 --> <!-- 骨架屏占位 -->
<div v-if="sqLoading && suggestedQuestions.length === 0" class="suggested-questions-inner"> <div v-if="sqLoading && suggestedQuestions.length === 0" class="suggested-questions-inner">
<div class="suggested-questions-title"><t-skeleton animation="gradient" :row-col="[{ width: '120px', height: '18px' }]" /></div> <div class="suggested-questions-title"><t-skeleton animation="gradient"
:row-col="[{ width: '120px', height: '18px' }]" /></div>
<div class="suggested-questions-grid"> <div class="suggested-questions-grid">
<div v-for="n in 6" :key="'sq-skel-' + n" class="suggested-question-card sq-card-skeleton"> <div v-for="n in 6" :key="'sq-skel-' + n" class="suggested-question-card sq-card-skeleton">
<t-skeleton animation="gradient" :row-col="[{ width: '100%', height: '14px', type: 'rect' }]" /> <t-skeleton animation="gradient"
:row-col="[{ width: '100%', height: '14px', type: 'rect' }]" />
</div> </div>
</div> </div>
</div> </div>
<transition v-else appear name="sq-slide-fade" mode="out-in" <transition v-else appear name="sq-slide-fade" mode="out-in" @before-leave="onBeforeLeave"
@before-leave="onBeforeLeave" @after-leave="onAfterLeave" @enter="onEnter" @after-enter="onQuestionsEntered">
@after-leave="onAfterLeave"
@enter="onEnter"
@after-enter="onQuestionsEntered"
>
<div v-if="suggestedQuestions.length > 0" :key="sqRenderKey" class="suggested-questions-inner"> <div v-if="suggestedQuestions.length > 0" :key="sqRenderKey" class="suggested-questions-inner">
<div class="suggested-questions-title-row">
<div class="suggested-questions-title">{{ $t('chat.suggestedQuestions') }}</div> <div class="suggested-questions-title">{{ $t('chat.suggestedQuestions') }}</div>
<t-button variant="text" shape="square" size="small" class="suggested-questions-refresh"
:loading="sqLoading" :title="$t('chat.refreshSuggestedQuestions')"
@click="fetchSuggestedQuestions">
<template #icon><t-icon name="refresh" /></template>
</t-button>
</div>
<div class="suggested-questions-grid"> <div class="suggested-questions-grid">
<div <div v-for="(item, index) in suggestedQuestions" :key="item.question"
v-for="(item, index) in suggestedQuestions" class="suggested-question-card" :class="{ 'sq-card-visible': sqCardsRevealed }"
:key="item.question"
class="suggested-question-card"
:class="{ 'sq-card-visible': sqCardsRevealed }"
:style="{ transitionDelay: sqCardsRevealed ? `${index * 50}ms` : '0ms' }" :style="{ transitionDelay: sqCardsRevealed ? `${index * 50}ms` : '0ms' }"
@click="handleSuggestedQuestionClick(item.question)" @click="handleSuggestedQuestionClick(item.question)">
>
<span class="suggested-question-text">{{ item.question }}</span> <span class="suggested-question-text">{{ item.question }}</span>
<span v-if="item.source === 'faq'" class="suggested-question-badge faq">FAQ</span> <span v-if="item.source === 'faq'" class="suggested-question-badge faq">FAQ</span>
</div> </div>
@@ -46,14 +47,9 @@
<ContextualGuide tour="chat" :when="showChatContextualGuide" /> <ContextualGuide tour="chat" :when="showChatContextualGuide" />
<!-- 知识库编辑器(创建/编辑统一组件) --> <!-- 知识库编辑器(创建/编辑统一组件) -->
<KnowledgeBaseEditorModal <KnowledgeBaseEditorModal :visible="uiStore.showKBEditorModal" :mode="uiStore.kbEditorMode"
:visible="uiStore.showKBEditorModal" :kb-id="uiStore.currentKBId || undefined" :initial-type="uiStore.kbEditorType"
:mode="uiStore.kbEditorMode" @update:visible="(val) => val ? null : uiStore.closeKBEditor()" @success="handleKBEditorSuccess" />
:kb-id="uiStore.currentKBId || undefined"
:initial-type="uiStore.kbEditorType"
@update:visible="(val) => val ? null : uiStore.closeKBEditor()"
@success="handleKBEditorSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, onMounted, nextTick, computed } from 'vue'; import { ref, watch, onMounted, nextTick, computed } from 'vue';
@@ -136,7 +132,7 @@ const onQuestionsEntered = () => {
const fetchSuggestedQuestions = async () => { const fetchSuggestedQuestions = async () => {
const fetchId = ++suggestedQuestionsFetchId; const fetchId = ++suggestedQuestionsFetchId;
if (suggestedQuestions.value.length === 0) sqLoading.value = true; sqLoading.value = true;
try { try {
const agentId = settingsStore.selectedAgentId; const agentId = settingsStore.selectedAgentId;
if (!agentId) return; if (!agentId) return;
@@ -300,8 +296,13 @@ const handleKBEditorSuccess = (kbId: string) => {
} }
@keyframes skeletonFadeIn { @keyframes skeletonFadeIn {
from { opacity: 0; } from {
to { opacity: 1; } opacity: 0;
}
to {
opacity: 1;
}
} }
.suggested-questions-inner { .suggested-questions-inner {
@@ -317,26 +318,45 @@ const handleKBEditorSuccess = (kbId: string) => {
transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
} }
.sq-slide-fade-leave-active { .sq-slide-fade-leave-active {
transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1), transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1),
transform 0.15s cubic-bezier(0.4, 0, 1, 1); transform 0.15s cubic-bezier(0.4, 0, 1, 1);
} }
.sq-slide-fade-enter-from { .sq-slide-fade-enter-from {
opacity: 0; opacity: 0;
transform: translateY(10px); transform: translateY(10px);
} }
.sq-slide-fade-leave-to { .sq-slide-fade-leave-to {
opacity: 0; opacity: 0;
transform: translateY(-4px); transform: translateY(-4px);
} }
.suggested-questions-title-row {
display: flex;
align-items: center;
gap: 2px;
margin-bottom: 12px;
}
.suggested-questions-title { .suggested-questions-title {
font-size: 14px; font-size: 14px;
color: var(--td-text-color-secondary); color: var(--td-text-color-secondary);
margin-bottom: 12px; margin-bottom: 0;
font-weight: 500; font-weight: 500;
} }
.suggested-questions-refresh {
flex-shrink: 0;
color: var(--td-text-color-secondary);
&:hover:not(.t-is-disabled) {
color: var(--td-text-color-primary);
}
}
.suggested-questions-grid { .suggested-questions-grid {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@@ -375,19 +395,38 @@ const handleKBEditorSuccess = (kbId: string) => {
:deep(.t-skeleton) { :deep(.t-skeleton) {
width: 100%; width: 100%;
} }
:deep(.t-skeleton__row) { :deep(.t-skeleton__row) {
margin: 0; margin: 0;
} }
:deep(.t-skeleton__col) { :deep(.t-skeleton__col) {
border-radius: 4px; border-radius: 4px;
} }
&:nth-child(1) { width: 132px; } &:nth-child(1) {
&:nth-child(2) { width: 168px; } width: 132px;
&:nth-child(3) { width: 116px; } }
&:nth-child(4) { width: 152px; }
&:nth-child(5) { width: 124px; } &:nth-child(2) {
&:nth-child(6) { width: 144px; } width: 168px;
}
&:nth-child(3) {
width: 116px;
}
&:nth-child(4) {
width: 152px;
}
&:nth-child(5) {
width: 124px;
}
&:nth-child(6) {
width: 144px;
}
} }
&.sq-card-visible { &.sq-card-visible {
@@ -443,6 +482,7 @@ const handleKBEditorSuccess = (kbId: string) => {
width: 500px !important; width: 500px !important;
} }
} }
@media (max-width: 750px) { @media (max-width: 750px) {
.answers-input { .answers-input {
transform: translateX(-250px); transform: translateX(-250px);
@@ -452,6 +492,7 @@ const handleKBEditorSuccess = (kbId: string) => {
width: 340px !important; width: 340px !important;
} }
} }
@media (max-width: 600px) { @media (max-width: 600px) {
.answers-input { .answers-input {
transform: translateX(-250px); transform: translateX(-250px);
@@ -461,7 +502,6 @@ const handleKBEditorSuccess = (kbId: string) => {
width: 300px !important; width: 300px !important;
} }
} }
</style> </style>
<style lang="less"> <style lang="less">
.del-menu-popup { .del-menu-popup {
@@ -3988,6 +3988,8 @@ onUnmounted(() => {
} }
} }
// Wiki reader styles are for the knowledge-base document surface only.
// Chat answer Markdown styles are centralized in components/css/chat-markdown.less.
.wiki-reader-body { .wiki-reader-body {
line-height: 1.6; line-height: 1.6;
font-size: 14px; font-size: 14px;