assistant2: Render messages as Markdown (#21496)

This PR updates Assistant 2 to render the messages in the thread as
Markdown:

<img width="1138" alt="Screenshot 2024-12-03 at 6 09 27 PM"
src="https://github.com/user-attachments/assets/c1c44fde-1efb-43cf-b9c9-768e6974c753">

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-12-03 18:32:13 -05:00 committed by GitHub
parent ecaf44511c
commit 9f459ba573
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 81 additions and 4 deletions

View file

@ -167,6 +167,10 @@ impl Thread {
if let Some(last_message) = thread.messages.last_mut() {
if last_message.role == Role::Assistant {
last_message.text.push_str(&chunk);
cx.emit(ThreadEvent::StreamedAssistantText(
last_message.id,
chunk,
));
}
}
}
@ -320,6 +324,7 @@ pub enum ThreadError {
pub enum ThreadEvent {
ShowError(ThreadError),
StreamedCompletion,
StreamedAssistantText(MessageId, String),
MessageAdded(MessageId),
UsePendingTools,
ToolFinished {