Fixed propper MD rendering +++++

This commit is contained in:
2026-02-12 18:44:39 +01:00
parent 7265d22438
commit abd1dfddd4
13 changed files with 175 additions and 20 deletions

View File

@@ -20,6 +20,16 @@ struct MessageRow: View {
#endif
var body: some View {
// Compact layout for system messages (tool calls)
if message.role == .system && !isErrorMessage {
compactSystemMessage
} else {
standardMessageLayout
}
}
@ViewBuilder
private var standardMessageLayout: some View {
HStack(alignment: .top, spacing: 12) {
// Role icon
roleIcon
@@ -131,6 +141,34 @@ struct MessageRow: View {
#endif
}
// Close standardMessageLayout - the above closing braces close it
// The body: some View now handles the split between compact and standard
// MARK: - Compact System Message
@ViewBuilder
private var compactSystemMessage: some View {
HStack(spacing: 8) {
Image(systemName: "wrench.and.screwdriver")
.font(.system(size: 11))
.foregroundColor(.secondary)
Text(message.content)
.font(.system(size: 11))
.foregroundColor(.secondary)
Spacer()
Text(message.timestamp, style: .time)
.font(.system(size: 10))
.foregroundColor(.secondary.opacity(0.7))
}
.padding(.horizontal, 12)
.padding(.vertical, 6)
.background(Color.secondary.opacity(0.08))
.cornerRadius(6)
}
// MARK: - Message Content
@ViewBuilder
@@ -158,7 +196,13 @@ struct MessageRow: View {
.textSelection(.enabled)
}
case .user:
MarkdownContentView(content: message.content, fontSize: settings.dialogTextSize)
// User messages: preserve line breaks as-is (plain text, not markdown)
Text(message.content)
.font(.system(size: settings.dialogTextSize))
.foregroundColor(.oaiPrimary)
.lineSpacing(4)
.frame(maxWidth: .infinity, alignment: .leading)
.textSelection(.enabled)
}
}