Chat View Refinement
Nucleic-Session: 4E56990A-96AE-4597-9140-753CB82E769D Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
@@ -63,20 +63,27 @@ struct TranscriptRow: View {
|
||||
/// Render an assistant/user message with the full Markdown renderer the Mac transcript uses
|
||||
/// (fenced code blocks, headings, lists, tables, and inline emphasis/links/`code`), preserving
|
||||
/// the line breaks of multi-paragraph replies. Falls back to plain text if parsing fails.
|
||||
/// The user's messages sit right-aligned in a soft accent bubble; the assistant's prose runs
|
||||
/// open on the background — no box — so the transcript reads as a page, not a stack of cards.
|
||||
struct MessageBubble: View {
|
||||
let role: TranscriptItem.Role
|
||||
let text: String
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
if role == .user { Spacer(minLength: 40) }
|
||||
if role == .user {
|
||||
HStack {
|
||||
Spacer(minLength: 48)
|
||||
MarkdownText(markdown: text)
|
||||
.textSelection(.enabled)
|
||||
.padding(.horizontal, 14)
|
||||
.padding(.vertical, 9)
|
||||
.background(Palette.accent.opacity(0.15),
|
||||
in: RoundedRectangle(cornerRadius: 18, style: .continuous))
|
||||
}
|
||||
} else {
|
||||
MarkdownText(markdown: text)
|
||||
.textSelection(.enabled)
|
||||
.padding(10)
|
||||
.background(role == .user ? Palette.accent.opacity(0.15) : Color(.secondarySystemBackground),
|
||||
in: RoundedRectangle(cornerRadius: 12))
|
||||
.frame(maxWidth: .infinity, alignment: role == .user ? .trailing : .leading)
|
||||
if role == .assistant { Spacer(minLength: 40) }
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user