浏览代码

Fix chat layout: left-align assistant messages

Use leading stack alignment and explicit LTR on assistant rows so AI
bubbles, labels, and job cards read from the left after the avatar.
Cap assistant bubble width to mirror the user message max width.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 月之前
父节点
当前提交
3a2498b179
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      App for Indeed/Views/DashboardView.swift

+ 6 - 2
App for Indeed/Views/DashboardView.swift

@@ -1597,6 +1597,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
         let nameLabel = NSTextField(labelWithString: "AI Job Finder")
         nameLabel.font = .systemFont(ofSize: 11, weight: .semibold)
         nameLabel.textColor = Theme.secondaryText
+        nameLabel.alignment = .left
         nameLabel.translatesAutoresizingMaskIntoConstraints = false
 
         let bubble = makeChatBubbleContainer(text: text, isUser: false)
@@ -1604,7 +1605,8 @@ final class DashboardView: NSView, NSTextFieldDelegate {
         let column = NSStackView(views: [nameLabel, bubble])
         column.orientation = .vertical
         column.spacing = 6
-        column.alignment = .width
+        // Leading keeps the assistant label, text bubble, and job cards hugging the left (after the avatar); `.width` was letting narrow intrinsic widths sit on the trailing side so AI read like a second “user” column.
+        column.alignment = .leading
         column.translatesAutoresizingMaskIntoConstraints = false
 
         if let jobs, !jobs.isEmpty {
@@ -1622,6 +1624,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
 
         host.addSubview(avatar)
         host.addSubview(column)
+        host.userInterfaceLayoutDirection = .leftToRight
         NSLayoutConstraint.activate([
             avatar.leadingAnchor.constraint(equalTo: host.leadingAnchor),
             avatar.topAnchor.constraint(equalTo: host.topAnchor),
@@ -1631,7 +1634,8 @@ final class DashboardView: NSView, NSTextFieldDelegate {
             column.leadingAnchor.constraint(equalTo: avatar.trailingAnchor, constant: 12),
             column.trailingAnchor.constraint(equalTo: host.trailingAnchor),
             column.topAnchor.constraint(equalTo: host.topAnchor),
-            column.bottomAnchor.constraint(equalTo: host.bottomAnchor)
+            column.bottomAnchor.constraint(equalTo: host.bottomAnchor),
+            bubble.widthAnchor.constraint(lessThanOrEqualTo: host.widthAnchor, multiplier: 0.78)
         ])
     }