mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 03:09:19 +08:00
refactor: 更换对话加载动画
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { Empty, Popover, Select, Spin, Tooltip, message } from 'ant-design-vue';
|
import { Empty, Popover, Select, Spin, Tooltip, message } from 'ant-design-vue';
|
||||||
import { ChatItem } from '@tdesign-vue-next/chat';
|
import { ChatItem, ChatLoading } from '@tdesign-vue-next/chat';
|
||||||
import 'tdesign-vue-next/es/style/index.css';
|
import 'tdesign-vue-next/es/style/index.css';
|
||||||
import '@tdesign-vue-next/chat/es/style/index.css';
|
import '@tdesign-vue-next/chat/es/style/index.css';
|
||||||
|
|
||||||
@@ -853,21 +853,28 @@ void loadEnabledModels().then(() => refreshSessions());
|
|||||||
v-for="item in bubbleViews"
|
v-for="item in bubbleViews"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
class="agent-td-item"
|
class="agent-td-item"
|
||||||
|
:class="[
|
||||||
|
item.role === 'user'
|
||||||
|
? 'agent-td-item--user'
|
||||||
|
: 'agent-td-item--assistant',
|
||||||
|
{ 'agent-td-item--loading': item.textLoading },
|
||||||
|
]"
|
||||||
:role="item.role"
|
:role="item.role"
|
||||||
:name="item.name"
|
:name="item.name"
|
||||||
:content="item.content"
|
:content="item.textLoading ? undefined : item.content"
|
||||||
:text-loading="item.textLoading"
|
:text-loading="false"
|
||||||
variant="base"
|
variant="base"
|
||||||
animation="gradient"
|
>
|
||||||
/>
|
<!-- ChatItem.animation 无 dots,等待首包时用 ChatLoading -->
|
||||||
|
<template v-if="item.textLoading" #content>
|
||||||
|
<ChatLoading animation="dots" />
|
||||||
|
</template>
|
||||||
|
</ChatItem>
|
||||||
<div
|
<div
|
||||||
v-if="toolStatusActive && toolStatusLabel"
|
v-if="toolStatusActive && toolStatusLabel"
|
||||||
class="text-muted-foreground flex items-center gap-2 px-2 py-1 text-xs"
|
class="agent-tool-status text-muted-foreground flex items-center gap-2 px-2 py-1 text-xs"
|
||||||
>
|
>
|
||||||
<span
|
<ChatLoading animation="dots" :text="`${toolStatusLabel}…`" />
|
||||||
class="border-primary/40 inline-block size-3 animate-spin rounded-full border-2 border-t-transparent"
|
|
||||||
/>
|
|
||||||
<span>{{ toolStatusLabel }}…</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -957,28 +964,61 @@ html.dark .agent-session-item--active,
|
|||||||
|
|
||||||
.agent-td-item {
|
.agent-td-item {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 气泡按内容收缩,避免贴边铺满 */
|
/* 短消息也固定左右:气泡 fit-content + 贴边,避免被 tdesign justify-center 居中 */
|
||||||
.agent-td-item :deep(.t-chat__inner) {
|
.agent-td-item :deep(.t-chat__inner) {
|
||||||
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
padding-inline: 4px;
|
padding-inline: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.agent-td-item :deep(.t-chat__content) {
|
.agent-td-item :deep(.t-chat__content) {
|
||||||
width: auto;
|
flex: 0 1 auto !important;
|
||||||
max-width: min(680px, calc(100% - 24px));
|
width: fit-content !important;
|
||||||
|
max-width: min(680px, 100%);
|
||||||
|
justify-content: flex-start !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.agent-td-item :deep(.t-chat__inner.user) {
|
.agent-td-item--assistant :deep(.t-chat__inner) {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agent-td-item--assistant :deep(.t-chat__content) {
|
||||||
|
align-self: flex-start;
|
||||||
|
align-items: flex-start !important;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agent-td-item--user :deep(.t-chat__inner) {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.agent-td-item--user :deep(.t-chat__content) {
|
||||||
|
align-self: flex-end;
|
||||||
|
align-items: flex-end !important;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agent-td-item :deep(.t-chat__detail) {
|
||||||
|
width: fit-content;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-inline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.agent-td-item :deep(.t-chat__text__name) {
|
.agent-td-item :deep(.t-chat__text__name) {
|
||||||
opacity: 0.55;
|
opacity: 0.55;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.agent-tool-status {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
/* 浅色:给气泡补边框与底色,避免与主背景糊在一起 */
|
/* 浅色:给气泡补边框与底色,避免与主背景糊在一起 */
|
||||||
.agent-td-item :deep(.t-chat__text--variant--base .t-chat__detail),
|
.agent-td-item :deep(.t-chat__text--variant--base .t-chat__detail),
|
||||||
.agent-td-item :deep(.t-chat__detail) {
|
.agent-td-item :deep(.t-chat__detail) {
|
||||||
|
|||||||
Reference in New Issue
Block a user