fix: markdown rendering for chat was broken
This commit is contained in:
@@ -55,6 +55,7 @@ impl App {
|
|||||||
.spacing(8),
|
.spacing(8),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
let markdown_style = markdown::Style::from_palette(app_theme().palette());
|
||||||
for (index, message) in self.conversation.iter().enumerate() {
|
for (index, message) in self.conversation.iter().enumerate() {
|
||||||
if message.compaction {
|
if message.compaction {
|
||||||
messages = messages.push(
|
messages = messages.push(
|
||||||
@@ -123,17 +124,29 @@ impl App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !message.content.is_empty() {
|
if !message.content.is_empty() {
|
||||||
body = body.push(
|
if message.user || message.tool || message.markdown.items().is_empty() {
|
||||||
text_editor(&message.transcript)
|
body = body.push(
|
||||||
.id(iced::widget::Id::from(format!(
|
text_editor(&message.transcript)
|
||||||
"transcript-{}-{index}",
|
.id(iced::widget::Id::from(format!(
|
||||||
message.id
|
"transcript-{}-{index}",
|
||||||
)))
|
message.id
|
||||||
.on_action(move |action| Message::TranscriptAction(index, action))
|
)))
|
||||||
.padding(0)
|
.on_action(move |action| {
|
||||||
.size(14)
|
Message::TranscriptAction(index, action)
|
||||||
.style(selectable_text_style),
|
})
|
||||||
);
|
.padding(0)
|
||||||
|
.size(14)
|
||||||
|
.style(selectable_text_style),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
body = body.push(
|
||||||
|
markdown::view(
|
||||||
|
message.markdown.items(),
|
||||||
|
markdown::Settings::with_text_size(14, markdown_style),
|
||||||
|
)
|
||||||
|
.map(Message::OpenLink),
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if active && message.reasoning.is_none() {
|
} else if active && message.reasoning.is_none() {
|
||||||
body = body.push(
|
body = body.push(
|
||||||
text(self.activity.as_deref().unwrap_or("Loading model…")).size(14),
|
text(self.activity.as_deref().unwrap_or("Loading model…")).size(14),
|
||||||
|
|||||||
Reference in New Issue
Block a user