diff --git a/apps/web/apps/web-antd/src/views/agent/chat/index.vue b/apps/web/apps/web-antd/src/views/agent/chat/index.vue index ec749eef..384f71c5 100644 --- a/apps/web/apps/web-antd/src/views/agent/chat/index.vue +++ b/apps/web/apps/web-antd/src/views/agent/chat/index.vue @@ -13,7 +13,7 @@ import { import dayjs from 'dayjs'; 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/chat/es/style/index.css'; @@ -853,21 +853,28 @@ void loadEnabledModels().then(() => refreshSessions()); v-for="item in bubbleViews" :key="item.id" 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" :name="item.name" - :content="item.content" - :text-loading="item.textLoading" + :content="item.textLoading ? undefined : item.content" + :text-loading="false" variant="base" - animation="gradient" - /> + > + + +
- - {{ toolStatusLabel }}… +
@@ -957,28 +964,61 @@ html.dark .agent-session-item--active, .agent-td-item { margin-bottom: 16px; + width: 100%; } -/* 气泡按内容收缩,避免贴边铺满 */ +/* 短消息也固定左右:气泡 fit-content + 贴边,避免被 tdesign justify-center 居中 */ .agent-td-item :deep(.t-chat__inner) { + display: flex; box-sizing: border-box; + width: 100%; padding-inline: 4px; } .agent-td-item :deep(.t-chat__content) { - width: auto; - max-width: min(680px, calc(100% - 24px)); + flex: 0 1 auto !important; + 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; } +.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) { opacity: 0.55; 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__detail) {