Fix the remaining call sites for the new Prompt and UserItem shapes

This commit is contained in:
muraa-p
2026-11-02 12:46:22 +08:00
committed by bflatastic
parent 52e0202a21
commit 1c63736578
4 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -160,9 +160,9 @@ fn run(cli: &Cli, a: &RebuildArgs) -> Result<bool, ToolError> {
}
}
RunEvent::Agent(_) => {}
RunEvent::Note(text) => {
RunEvent::Note { shown, .. } => {
end_line(&mut line_open);
println!(" + {text}");
println!(" + {shown}");
}
RunEvent::Ask(r) => {
end_line(&mut line_open);
+1 -1
View File
@@ -320,7 +320,7 @@ fn composer(app: &mut CraftApp, ui: &mut Ui, width: f32, dense: bool) {
let answering = app.answering();
let hint = if dense { tr("Ask the agent…") } else { tr("Ask anything, e.g. \"What does this program do?\"") };
ui.allocate_ui(Vec2::new(width, 0.0), |ui| {
let history = || app.state.chat.iter().filter_map(|i| if let ChatItem::User(text) = i { Some(text.clone()) } else { None }).collect();
let history = || app.state.chat.iter().filter_map(|i| if let ChatItem::User(text) = i { Some(crate::prompt_box::Prompt { text: text.clone(), pictures: Vec::new() }) } else { None }).collect();
let out = crate::prompt_box::show(
ui,
&mut app.state.input,
+1 -1
View File
@@ -204,7 +204,7 @@ mod tests {
// The feed stores the shown text with its "(n pictures attached)" line, and the
// pictures travel with the same UserItem.
let pics = [std::path::PathBuf::from("attachments/picture-1.png")];
let feed = [FeedItem::User(UserItem::new("Make it blue\n(1 picture attached)", pics.clone()))];
let feed = [FeedItem::User(UserItem::new("Make it blue\n(1 picture attached)".to_string(), pics.to_vec()))];
let list = [asked("where are the files", 1)];
let out = prompts(&feed, &list);
assert_eq!(out[0].text, "Make it blue");
+1 -1
View File
@@ -305,7 +305,7 @@ fn an_engine_download_shows_in_the_title_bar_on_every_screen() {
#[test]
fn a_projects_conversation_and_place_come_back_after_a_restart() {
use craft_anything_engine::workspace::{TargetRef, Workspace};
use craft_anything_ui_egui::state::FeedItem;
use craft_anything_ui_egui::state::{FeedItem, UserItem};
struct Mem(std::collections::HashMap<String, String>);
impl eframe::Storage for Mem {
fn get_string(&self, key: &str) -> Option<String> {