fix: wire markdown variant renderer
This commit is contained in:
@@ -43,12 +43,17 @@ private struct ChatMarkdownStyle: ViewModifier {
|
||||
let textColor: Color
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.font(self.font)
|
||||
.foregroundStyle(self.textColor)
|
||||
.textual.structuredTextStyle(self.variant == .compact ? .default : .gitHub)
|
||||
.textual.inlineStyle(self.inlineStyle)
|
||||
.textual.textSelection(.enabled)
|
||||
Group {
|
||||
if self.variant == .compact {
|
||||
content.textual.structuredTextStyle(.default)
|
||||
} else {
|
||||
content.textual.structuredTextStyle(.gitHub)
|
||||
}
|
||||
}
|
||||
.font(self.font)
|
||||
.foregroundStyle(self.textColor)
|
||||
.textual.inlineStyle(self.inlineStyle)
|
||||
.textual.textSelection(.enabled)
|
||||
}
|
||||
|
||||
private var inlineStyle: InlineStyle {
|
||||
|
||||
@@ -487,10 +487,11 @@ extension ChatTypingIndicatorBubble: @MainActor Equatable {
|
||||
@MainActor
|
||||
struct ChatStreamingAssistantBubble: View {
|
||||
let text: String
|
||||
let markdownVariant: ChatMarkdownVariant
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
ChatAssistantTextBody(text: self.text)
|
||||
ChatAssistantTextBody(text: self.text, markdownVariant: self.markdownVariant)
|
||||
}
|
||||
.padding(12)
|
||||
.background(
|
||||
@@ -594,8 +595,6 @@ private struct TypingDots: View {
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@MainActor
|
||||
private struct ChatAssistantTextBody: View {
|
||||
let text: String
|
||||
let markdownVariant: ChatMarkdownVariant
|
||||
|
||||
@@ -179,7 +179,7 @@ public struct ClawdbotChatView: View {
|
||||
}
|
||||
|
||||
if let text = self.viewModel.streamingAssistantText, AssistantTextParser.hasVisibleContent(in: text) {
|
||||
ChatStreamingAssistantBubble(text: text)
|
||||
ChatStreamingAssistantBubble(text: text, markdownVariant: self.markdownVariant)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user