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
|
/// 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
|
/// (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 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 {
|
struct MessageBubble: View {
|
||||||
let role: TranscriptItem.Role
|
let role: TranscriptItem.Role
|
||||||
let text: String
|
let text: String
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
if role == .user {
|
||||||
HStack {
|
HStack {
|
||||||
if role == .user { Spacer(minLength: 40) }
|
Spacer(minLength: 48)
|
||||||
MarkdownText(markdown: text)
|
MarkdownText(markdown: text)
|
||||||
.textSelection(.enabled)
|
.textSelection(.enabled)
|
||||||
.padding(10)
|
.padding(.horizontal, 14)
|
||||||
.background(role == .user ? Palette.accent.opacity(0.15) : Color(.secondarySystemBackground),
|
.padding(.vertical, 9)
|
||||||
in: RoundedRectangle(cornerRadius: 12))
|
.background(Palette.accent.opacity(0.15),
|
||||||
.frame(maxWidth: .infinity, alignment: role == .user ? .trailing : .leading)
|
in: RoundedRectangle(cornerRadius: 18, style: .continuous))
|
||||||
if role == .assistant { Spacer(minLength: 40) }
|
}
|
||||||
|
} else {
|
||||||
|
MarkdownText(markdown: text)
|
||||||
|
.textSelection(.enabled)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user