feat: more native menus with expected reactions
This commit is contained in:
@@ -61,6 +61,7 @@ pub(crate) struct ChatMessage {
|
||||
pub(super) reasoning_open: bool,
|
||||
pub(super) content: String,
|
||||
pub(super) markdown: markdown::Content,
|
||||
pub(super) transcript: text_editor::Content,
|
||||
pub(super) a2ui_lines_processed: usize,
|
||||
pub(super) a2ui_errors: Vec<String>,
|
||||
pub(super) a2ui_replies: Vec<serde_json::Value>,
|
||||
@@ -89,14 +90,17 @@ impl ChatMessage {
|
||||
}
|
||||
|
||||
pub(super) fn refresh_markdown(&mut self) {
|
||||
let visible = crate::agent::visible_content(&self.content);
|
||||
let visible = crate::a2ui::transcript_fallback(visible);
|
||||
let content = if self.reasoning.is_some() {
|
||||
visible.trim_start()
|
||||
} else {
|
||||
&visible
|
||||
};
|
||||
if self.transcript.text() != content {
|
||||
self.transcript = text_editor::Content::with_text(content);
|
||||
}
|
||||
if !self.user && !self.tool {
|
||||
let visible = crate::agent::visible_content(&self.content);
|
||||
let visible = crate::a2ui::transcript_fallback(visible);
|
||||
let content = if self.reasoning.is_some() {
|
||||
visible.trim_start()
|
||||
} else {
|
||||
&visible
|
||||
};
|
||||
self.markdown = markdown::Content::parse(content);
|
||||
}
|
||||
}
|
||||
@@ -165,6 +169,7 @@ impl From<StoredMessage> for ChatMessage {
|
||||
reasoning_open: false,
|
||||
content: message.content,
|
||||
markdown: iced::widget::markdown::Content::new(),
|
||||
transcript: iced::widget::text_editor::Content::new(),
|
||||
a2ui_lines_processed: 0,
|
||||
a2ui_errors: Vec::new(),
|
||||
a2ui_replies: Vec::new(),
|
||||
@@ -341,6 +346,7 @@ impl App {
|
||||
return;
|
||||
}
|
||||
self.a2ui_auto_switch_pending = true;
|
||||
self.context_notice = None;
|
||||
#[cfg(target_os = "macos")]
|
||||
self.tool_cards.clear();
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -633,6 +639,9 @@ impl App {
|
||||
match active.events.try_recv() {
|
||||
Ok(GenerationEvent::Loading) => {}
|
||||
Ok(GenerationEvent::Activity(activity)) => {
|
||||
if activity.starts_with("Rebuilding context:") {
|
||||
self.context_notice = Some(activity.to_owned());
|
||||
}
|
||||
self.activity = Some(activity.into());
|
||||
}
|
||||
Ok(GenerationEvent::Compacted(_)) => {
|
||||
@@ -1666,6 +1675,7 @@ mod tests {
|
||||
reasoning_open: false,
|
||||
content: content.to_owned(),
|
||||
markdown: iced::widget::markdown::Content::new(),
|
||||
transcript: iced::widget::text_editor::Content::new(),
|
||||
a2ui_lines_processed: 0,
|
||||
a2ui_errors: Vec::new(),
|
||||
a2ui_replies: Vec::new(),
|
||||
@@ -1727,6 +1737,7 @@ mod tests {
|
||||
content: "### Core / Setup\n\n| File | Lines |\n|---|---:|\n| `src/app.rs` | **1,750** |\n| `src/engine.rs` | 2,400 |\n\n### Summary\n\nDone."
|
||||
.to_owned(),
|
||||
markdown: iced::widget::markdown::Content::new(),
|
||||
transcript: iced::widget::text_editor::Content::new(),
|
||||
a2ui_lines_processed: 0,
|
||||
a2ui_errors: Vec::new(),
|
||||
a2ui_replies: Vec::new(),
|
||||
@@ -1792,6 +1803,7 @@ mod tests {
|
||||
reasoning_open: false,
|
||||
content: format!("message {id}"),
|
||||
markdown: iced::widget::markdown::Content::new(),
|
||||
transcript: iced::widget::text_editor::Content::new(),
|
||||
a2ui_lines_processed: 0,
|
||||
a2ui_errors: Vec::new(),
|
||||
a2ui_replies: Vec::new(),
|
||||
@@ -1829,6 +1841,7 @@ mod tests {
|
||||
reasoning_open: false,
|
||||
content: format!("message {id}"),
|
||||
markdown: iced::widget::markdown::Content::new(),
|
||||
transcript: iced::widget::text_editor::Content::new(),
|
||||
a2ui_lines_processed: 0,
|
||||
a2ui_errors: Vec::new(),
|
||||
a2ui_replies: Vec::new(),
|
||||
|
||||
Reference in New Issue
Block a user