@@ -80,7 +80,7 @@ struct ChatPanelMessages: View {
8080 VStack ( spacing: 0 ) {
8181 vstack {
8282 Spacer ( )
83-
83+
8484 if chat. isReceivingMessage {
8585 StopRespondingButton ( chat: chat)
8686 }
@@ -103,7 +103,7 @@ struct ChatPanelMessages: View {
103103 BotMessage ( text: text)
104104 }
105105 }
106-
106+
107107 Spacer ( )
108108 }
109109 }
@@ -145,9 +145,7 @@ private struct UserMessage: View {
145145 var body : some View {
146146 Markdown ( text)
147147 . textSelection ( . enabled)
148- . markdownTheme ( . gitHub. text {
149- BackgroundColor ( Color . clear)
150- } )
148+ . markdownTheme ( . custom)
151149 . markdownCodeSyntaxHighlighter (
152150 ChatCodeSyntaxHighlighter ( brightMode: colorScheme != . dark)
153151 )
@@ -186,12 +184,10 @@ private struct BotMessage: View {
186184 NSPasteboard . general. setString ( text, forType: . string)
187185 }
188186 . scaleEffect ( x: - 1 , y: - 1 , anchor: . center)
189-
187+
190188 Markdown ( text)
191189 . textSelection ( . enabled)
192- . markdownTheme ( . gitHub. text {
193- BackgroundColor ( Color . clear)
194- } )
190+ . markdownTheme ( . custom)
195191 . markdownCodeSyntaxHighlighter (
196192 ChatCodeSyntaxHighlighter ( brightMode: colorScheme != . dark)
197193 )
@@ -392,38 +388,6 @@ struct GlobalChatSwitchToggleStyle: ToggleStyle {
392388 }
393389}
394390
395- struct CopyButton : View {
396- var copy : ( ) -> Void
397- @State var isCopied = false
398- var body : some View {
399- Button ( action: {
400- withAnimation ( . linear( duration: 0.1 ) ) {
401- isCopied = true
402- }
403- copy ( )
404- Task {
405- try await Task . sleep ( nanoseconds: 1_000_000_000 )
406- withAnimation ( . linear( duration: 0.1 ) ) {
407- isCopied = false
408- }
409- }
410- } ) {
411- Image ( systemName: isCopied ? " checkmark.circle " : " doc.on.doc " )
412- . resizable ( )
413- . aspectRatio ( contentMode: . fit)
414- . frame ( width: 14 , height: 14 )
415- . frame ( width: 20 , height: 20 , alignment: . center)
416- . foregroundColor ( . secondary)
417- . background (
418- . regularMaterial,
419- in: RoundedRectangle ( cornerRadius: 4 , style: . circular)
420- )
421- . padding ( 4 )
422- }
423- . buttonStyle ( . borderless)
424- }
425- }
426-
427391// MARK: - Previews
428392
429393struct ChatPanel_Preview : PreviewProvider {
@@ -436,7 +400,12 @@ struct ChatPanel_Preview: PreviewProvider {
436400 . init(
437401 id: " 2 " ,
438402 isUser: false ,
439- text: " **Hey**! What can I do for you?**Hey**! What can I do for you?**Hey**! What can I do for you?**Hey**! What can I do for you? "
403+ text: """
404+ ```swift
405+ func foo() {}
406+ ```
407+ **Hey**! What can I do for you?**Hey**! What can I do for you?**Hey**! What can I do for you?**Hey**! What can I do for you?
408+ """
440409 ) ,
441410 . init( id: " 5 " , isUser: false , text: " Yooo " ) ,
442411 . init( id: " 4 " , isUser: true , text: " Yeeeehh " ) ,
0 commit comments