fix: 修复首条短消息左右气泡挤在中间的布局

This commit is contained in:
2026-10-28 20:50:29 +08:00
parent fb05b47d46
commit 2f60efb8ef
@@ -964,7 +964,8 @@ void loadEnabledModels().then(() => refreshSessions());
class="mt-24"
description="开始提问吧(需先在「模型管理」配置 API)"
/>
<div class="mx-auto max-w-[760px]">
<!-- w-full:避免仅 max-w 时在 flex 列里被内容撑成窄条,短气泡左右贴中间 -->
<div class="mx-auto w-full max-w-[760px]">
<ChatItem
v-for="item in bubbleViews"
:key="item.id"
@@ -1086,18 +1087,21 @@ html.dark .agent-session-item--active,
}
.agent-td-item {
/* ChatItem 根节点即 .t-chat__inner,样式打在本类上 */
/* ChatItem 根节点即 .t-chat__inner;行必须拉满,短文案才能各贴左右 */
display: flex;
box-sizing: border-box;
width: 100%;
min-width: 0;
margin-bottom: 16px;
padding-inline: 20px;
}
/* 内容区占满行宽,气泡用 align-items 贴边;勿对 content 用 fit-content(会把左右挤到中间) */
.agent-td-item :deep(.t-chat__content) {
flex: 0 1 auto !important;
width: fit-content !important;
max-width: min(680px, 100%);
flex: 1 1 auto !important;
width: 100% !important;
max-width: 100%;
min-width: 0;
justify-content: flex-start !important;
}
@@ -1106,30 +1110,31 @@ html.dark .agent-session-item--active,
}
.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 {
/* 无头像时关掉 TDesign row-reverse,避免与左右对齐打架 */
flex-direction: row !important;
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--user :deep(.t-chat__base) {
justify-content: flex-end;
}
/* 只有气泡随文字收缩;行宽始终 100% */
.agent-td-item :deep(.t-chat__detail) {
width: fit-content;
max-width: 100%;
max-width: min(680px, 100%);
margin-inline: 0;
}
.agent-td-item :deep(.t-chat__text__name) {
.agent-td-item :deep(.t-chat__name) {
opacity: 0.55;
font-size: 12px;
}