fix: user/assistant alignment via outer row justify-content (reliable in Vela)

This commit is contained in:
2026-09-01 22:59:10 +08:00
parent 46a0523c65
commit ab41ff2943
+17 -5
View File
@@ -20,7 +20,8 @@
<!-- 消息流 --> <!-- 消息流 -->
<scroll class="chat-scroll" scroll-y="true"> <scroll class="chat-scroll" scroll-y="true">
<div class="chat-msg {{$item.role === 'user' ? 'msg-user' : 'msg-assistant'}}" for="{{messages}}"> <div class="msg-row {{$item.role === 'user' ? 'row-user' : 'row-assistant'}}" for="{{messages}}">
<div class="chat-msg {{$item.role === 'user' ? 'msg-user' : 'msg-assistant'}}">
<div class="think-chip" if="{{$item.think}}"> <div class="think-chip" if="{{$item.think}}">
<text>💭 思考…</text> <text>💭 思考…</text>
</div> </div>
@@ -34,6 +35,7 @@
<input class="approve-btn deny" type="button" value="拒绝" /> <input class="approve-btn deny" type="button" value="拒绝" />
</div> </div>
</div> </div>
</div>
</scroll> </scroll>
<!-- 底部输入栏 --> <!-- 底部输入栏 -->
@@ -667,25 +669,35 @@ export default {
margin-top: 4px; margin-top: 4px;
} }
.msg-row {
width: 100%;
flex-direction: row;
margin-bottom: 6px;
}
.row-user {
justify-content: flex-end;
}
.row-assistant {
justify-content: flex-start;
}
.chat-msg { .chat-msg {
width: auto; width: auto;
max-width: 84%; max-width: 84%;
flex-direction: column; flex-direction: column;
margin-bottom: 6px;
padding: 7px 10px; padding: 7px 10px;
border-radius: 12px; border-radius: 12px;
} }
.msg-user { .msg-user {
align-self: flex-end;
margin-left: auto;
margin-right: 12px; margin-right: 12px;
background-color: rgba(51, 180, 255, 0.20); background-color: rgba(51, 180, 255, 0.20);
border: 1px solid rgba(120, 200, 255, 0.30); border: 1px solid rgba(120, 200, 255, 0.30);
} }
.msg-assistant { .msg-assistant {
align-self: flex-start;
margin-left: 12px; margin-left: 12px;
margin-right: 12px; margin-right: 12px;
background-color: rgba(58, 62, 70, 0.55); background-color: rgba(58, 62, 70, 0.55);