Render messages as early as possible to show progress (#11569)

This shows "Researching..." as placeholder text as early as possible so
that the user can see the model is working on reading/researching/etc.

This also adds on an `Option<Value>` to the `render_running` function so
that tools can hopefully render based on partially completed JSON (still
to come).

Release Notes:

- N/A
This commit is contained in:
Kyle Kelley 2024-05-08 10:24:51 -07:00 committed by GitHub
parent dbebb40956
commit 689e4aef2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 15 deletions

View file

@ -16,7 +16,8 @@ use crate::{
use ::ui::{div, prelude::*, Color, Tooltip, ViewContext};
use anyhow::{Context, Result};
use assistant_tooling::{
AttachmentRegistry, ProjectContext, ToolFunctionCall, ToolRegistry, UserAttachment,
tool_running_placeholder, AttachmentRegistry, ProjectContext, ToolFunctionCall, ToolRegistry,
UserAttachment,
};
use client::{proto, Client, UserStore};
use collections::HashMap;
@ -864,6 +865,10 @@ impl AssistantChat {
}
}
if message_elements.is_empty() {
message_elements.push(tool_running_placeholder());
}
div()
.when(is_first, |this| this.pt(padding))
.child(