完善小壹时间流文案回执与子代理状态
This commit is contained in:
parent
e6c501996c
commit
55f12e971c
@ -666,14 +666,6 @@ pub(super) fn image_preview_button(ui: &mut Ui, rect: Rect, key: &str) -> egui::
|
||||
response
|
||||
}
|
||||
|
||||
fn paint_worker_badge(ui: &Ui, id: Id, rect: Rect, image: &Value, reduced: bool) {
|
||||
let Some(number) = image["workerNumber"].as_u64() else { return; };
|
||||
let worker = super::stitch_state::worker_name(number);
|
||||
let badge = Rect::from_min_size(rect.left_top() + vec2(8.0, 8.0), vec2(74.0, 24.0));
|
||||
super::stitch_ui::paint_badge(ui, id.with("worker"), badge, super::stitch_ui::BadgeKind::Neutral,
|
||||
&format!("子代理 {worker}"), reduced);
|
||||
}
|
||||
|
||||
fn preview_icon_at(ui: &mut Ui, rect: Rect, key: &str, icon: &str, label: &str) -> egui::Response {
|
||||
let mut controls = ui.new_child(egui::UiBuilder::new().id_salt(("preview-control", key)).max_rect(rect)
|
||||
.layout(Layout::top_down(egui::Align::Min)));
|
||||
@ -1855,13 +1847,15 @@ impl Workspace {
|
||||
let status = ToolStatus::parse(event["status"].as_str().unwrap_or(""));
|
||||
timeline::ToolRow { tool, name: super::stitch_state::tool_label(tool),
|
||||
status: if status == ToolStatus::Started && !turn_running { ToolStatus::Unknown } else { status },
|
||||
elapsed: elapsed.as_deref() }
|
||||
elapsed: elapsed.as_deref(),
|
||||
copy_updates: super::pi_bridge::copy_updates(event) }
|
||||
}).collect();
|
||||
let row = timeline::tool_group(ui, id, timeline::ToolGroupHead {
|
||||
total: rows.len(),
|
||||
completed: rows.iter().filter(|row| row.status == ToolStatus::Completed).count(),
|
||||
failed: rows.iter().filter(|row| row.status == ToolStatus::Failed).count(),
|
||||
active: turn_running && rows.iter().any(|row| row.status.running()),
|
||||
turn_running,
|
||||
}, &rows, self.reduce_motion);
|
||||
flow.connect(ui, row.rect);
|
||||
ui.add_space(8.0);
|
||||
@ -2012,12 +2006,6 @@ impl Workspace {
|
||||
let background = ui.painter().add(egui::Shape::Noop);
|
||||
super::glow_pill::background(ui, id, rect, t.radius_sm, 0.56, background);
|
||||
painter.text(rect.center(), Align2::CENTER_CENTER, step, FontId::proportional(super::agent_stream::TEXT_TITLE), t.text);
|
||||
if value["workerNumber"].is_number() {
|
||||
paint_worker_badge(ui, id, rect, value, self.reduce_motion);
|
||||
} else if let Some(worker) = self.production_workers().into_iter().find(|worker|
|
||||
worker.row["slotId"].is_string() && worker.row["slotId"] == value["target"]["slotId"]) {
|
||||
paint_worker_badge(ui, id, rect, &json!({"workerNumber":worker.number}), self.reduce_motion);
|
||||
}
|
||||
paint_image_caption(&painter, rect, &text);
|
||||
}
|
||||
return None;
|
||||
@ -2064,8 +2052,6 @@ impl Workspace {
|
||||
painter.rect_filled(tag, 6.0, Color32::from_black_alpha(188));
|
||||
painter.circle_filled(egui::pos2(tag.left() + 8.0, tag.center().y), 3.0, color);
|
||||
painter.galley(egui::pos2(tag.left() + 15.0, tag.center().y - text.size().y * 0.5), text, Color32::WHITE);
|
||||
} else {
|
||||
paint_worker_badge(ui, response.id, rect, value, self.reduce_motion);
|
||||
}
|
||||
let expand = (rect.width() >= 42.0 && rect.height() >= 42.0).then(|| image_preview_button(ui, rect, id));
|
||||
let response = response.on_hover_text(format!("{label} · 右键引用到小壹或查看大图"));
|
||||
@ -2086,7 +2072,6 @@ impl Workspace {
|
||||
response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, placeholder));
|
||||
if ui.is_rect_visible(rect) {
|
||||
ui.painter().rect_filled(rect, t.radius_sm, if response.hovered() { t.hover } else { t.field });
|
||||
paint_worker_badge(ui, response.id, rect, value, self.reduce_motion);
|
||||
let icon_size = rect.width().min(rect.height()).min(16.0);
|
||||
crate::icons::paint(ui, Rect::from_center_size(rect.center(), vec2(icon_size, icon_size)), "image", icon_size, t.text_dim);
|
||||
if response.has_focus() {
|
||||
@ -4514,11 +4499,10 @@ mod tests {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
// A running badge owns three dots; a waiting one owns none.
|
||||
fn dots(shape: &egui::Shape, out: &mut Vec<egui::Pos2>) {
|
||||
fn running_dots(shape: &egui::Shape, color: Color32, out: &mut Vec<egui::Pos2>) {
|
||||
match shape {
|
||||
egui::Shape::Vec(shapes) => shapes.iter().for_each(|shape| dots(shape, out)),
|
||||
egui::Shape::Circle(circle) if (circle.radius - 1.35).abs() < 0.01 => out.push(circle.center),
|
||||
egui::Shape::Vec(shapes) => shapes.iter().for_each(|shape| running_dots(shape, color, out)),
|
||||
egui::Shape::Circle(circle) if circle.radius == 2.25 && circle.fill == color => out.push(circle.center),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@ -4527,7 +4511,7 @@ mod tests {
|
||||
for step in ["正在等待原请求", "正在等待原任务结果…", "正在核查原请求…", "正在核查原结果…", "正在核查原模型请求", "正在定位原请求…"] {
|
||||
assert_eq!(worker_stage(step, false, false), STAGE_WAITING, "{step} 仍在等上一条请求的结果");
|
||||
}
|
||||
for (step, stage) in [("正在生图", "生图"), ("正在准备提示词", "准备"), ("正在验图", "验图")] {
|
||||
for (step, stage) in [("正在生图", "生图"), ("正在准备提示词", "准备"), ("正在验图", "验图"), ("已排队", "排队")] {
|
||||
assert_eq!(worker_stage(step, false, false), stage, "{step}");
|
||||
}
|
||||
for dock in [250.0, 520.0] {
|
||||
@ -4554,13 +4538,17 @@ mod tests {
|
||||
{"number":3,"slotId":"detail","label":"同款细节图","step":"正在等待原请求","active":true}]}));
|
||||
let mut seen = Vec::new();
|
||||
let mut dot_centers = Vec::new();
|
||||
let running_color = Tokens::get(&ctx).agent().accent_text;
|
||||
let frame = |app: &mut PhotocraftApp, events: Vec<egui::Event>, seen: &mut Vec<String>, dots_out: &mut Vec<egui::Pos2>| {
|
||||
let output = ctx.settle_ui(egui::RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(1280.0, 800.0))), events, ..Default::default()
|
||||
}, |ui| crate::panels::right_dock(app, ui));
|
||||
seen.clear();
|
||||
dots_out.clear();
|
||||
for shape in &output.shapes { texts(&shape.shape, seen); dots(&shape.shape, dots_out); }
|
||||
for shape in &output.shapes {
|
||||
texts(&shape.shape, seen);
|
||||
running_dots(&shape.shape, running_color, dots_out);
|
||||
}
|
||||
output.drop_without_applying_deltas();
|
||||
};
|
||||
let center = |rect: &Value| {
|
||||
@ -4583,22 +4571,18 @@ mod tests {
|
||||
frame(&mut app, button(toggle, false), &mut seen, &mut dot_centers);
|
||||
for _ in 0..3 { frame(&mut app, vec![], &mut seen, &mut dot_centers); }
|
||||
let shown = seen.join(" / ");
|
||||
// The count line sorts each sub-agent the way the summary row above
|
||||
// it does: A is generating although no image of its own is in yet.
|
||||
let count_line = format!("生图 1 · {STAGE_WAITING} 2");
|
||||
assert!(seen.iter().any(|text| text == &count_line), "展开后的统计行,面板宽 {dock}:{shown}");
|
||||
let list = app.jiansun.as_ref().unwrap().panel_geometry["productionWorkers"].as_array().cloned().unwrap_or_default();
|
||||
assert_eq!(list.len(), 3, "展开后的列表,面板宽 {dock}:{shown}");
|
||||
// The open list gives both waiting sub-agents the badge the summary
|
||||
// row gives them: a still one. The running one keeps its dots.
|
||||
for (number, expected) in [(1_usize, 3_usize), (2, 0), (3, 0)] {
|
||||
for (number, expected) in [(1_usize, 1_usize), (2, 0), (3, 0)] {
|
||||
let row = &list[number - 1];
|
||||
assert_eq!(row["worker"].as_u64(), Some(number as u64));
|
||||
let rect = &row["badge"];
|
||||
let badge = Rect::from_min_size(egui::pos2(rect[0].as_f64().unwrap() as f32, rect[1].as_f64().unwrap() as f32),
|
||||
let rect = &row["indicator"];
|
||||
let indicator = Rect::from_min_size(egui::pos2(rect[0].as_f64().unwrap() as f32, rect[1].as_f64().unwrap() as f32),
|
||||
egui::vec2(rect[2].as_f64().unwrap() as f32, rect[3].as_f64().unwrap() as f32));
|
||||
let painted = dot_centers.iter().filter(|dot| badge.contains(**dot)).count();
|
||||
assert_eq!(painted, expected, "子代理 {number} 徽标里的点,面板宽 {dock}:徽标 {badge:?},画面上的点 {dot_centers:?}");
|
||||
let painted = dot_centers.iter().filter(|dot| indicator.contains(**dot)).count();
|
||||
assert_eq!(painted, expected, "子代理 {number} 的运行状态点,面板宽 {dock}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5332,11 +5316,10 @@ mod tests {
|
||||
w.messages[1]["event"]["status"] = json!("completed");
|
||||
frame(&ctx,w,0.1,vec![]);
|
||||
let gap = frame(&ctx,w,6.2,vec![]);
|
||||
assert!(!gap.iter().any(|(text,_)|text=="组合画布操作"), "completed tools fold during a provider wait");
|
||||
assert!(gap.iter().any(|(text,_)|text=="组合画布操作"), "completed tools stay expanded during a provider wait");
|
||||
assert!(gap.iter().find(|(text,_)|text == "已完成 · 组合画布操作").unwrap().1.top() < gap.iter().find(|(text,_)|text==&w.stream_reply).unwrap().1.top());
|
||||
let header = gap.iter().find(|(text,_)|text == "已完成 · 组合画布操作").unwrap().1.center();
|
||||
click(&ctx,w,6.3,header);
|
||||
click(&ctx,w,6.6,header);
|
||||
w.messages.push(json!({"role":"assistant","kind":"activity","text":"开始:执行原生操作","event":{
|
||||
"version":1,"type":"tool","run":"trace-run","toolCallId":"two","toolName":"native_call","status":"started"}}));
|
||||
let closed = frame(&ctx,w,12.5,vec![]);
|
||||
@ -5356,12 +5339,12 @@ mod tests {
|
||||
frame(&automatic,w,31.0,vec![]);
|
||||
assert!(frame(&automatic,w,31.4,vec![]).iter().any(|(text,_)|text=="组合画布操作"));
|
||||
assert!(frame(&automatic,w,31.7,vec![]).iter().any(|(text,_)|text=="组合画布操作"), "the group stays visible during the completion hold");
|
||||
assert!(!frame(&automatic,w,32.3,vec![]).iter().any(|(text,_)|text=="组合画布操作"));
|
||||
assert!(!frame(&automatic,w,32.9,vec![]).iter().any(|(text,_)|text=="组合画布操作"));
|
||||
w.busy = Some("pi-agent".into());
|
||||
w.messages[2]["event"]["status"] = json!("completed");
|
||||
w.messages.push(json!({"role":"assistant","kind":"activity","text":"开始:读取画布","event":{
|
||||
"version":1,"type":"tool","run":"trace-run","toolCallId":"three","toolName":"canvas_read","status":"started"}}));
|
||||
let next = frame(&automatic,w,32.4,vec![]);
|
||||
let next = frame(&automatic,w,33.0,vec![]);
|
||||
assert!(next.iter().any(|(text,_)|text=="执行原生操作"));
|
||||
assert!(next.iter().any(|(text,_)|text=="读取画布"), "new tool start and previous completion keep the disclosure open");
|
||||
assert!(requests.try_recv().is_err(), "the synthetic timing trace cannot issue a provider or native mutation");
|
||||
@ -7276,14 +7259,12 @@ mod tests {
|
||||
let w = harness.state().0.jiansun.as_ref().unwrap();
|
||||
assert!(w.panel_geometry["productionWorkers"].is_array());
|
||||
assert!(geometry(w, "productionShelf").bottom() <= geometry(w, "conversationClip").top() + 1.0);
|
||||
// Each sub-agent keeps the letter of the summary row, and every badge
|
||||
// shares one width: the waiting one owns no dots but still lines up.
|
||||
assert_eq!(harness.query_all_by_label("D").count(), 1, "复核保留字母:面板宽 {width}");
|
||||
assert_eq!(harness.query_all_by_label("D").count(), 0, "复核使用图位名称:面板宽 {width}");
|
||||
let rows = w.panel_geometry["productionWorkers"].as_array().unwrap();
|
||||
assert_eq!(rows.len(), 4, "面板宽 {width}");
|
||||
assert_eq!(rows[rows.len() - 1]["review"], true);
|
||||
let footprint = |row: &Value| {
|
||||
let a = row["badge"].as_array().unwrap();
|
||||
let a = row["indicator"].as_array().unwrap();
|
||||
Rect::from_min_size(pos2(a[0].as_f64().unwrap() as f32, a[1].as_f64().unwrap() as f32),
|
||||
vec2(a[2].as_f64().unwrap() as f32, a[3].as_f64().unwrap() as f32))
|
||||
};
|
||||
@ -7291,7 +7272,7 @@ mod tests {
|
||||
for (index, row) in rows.iter().enumerate() {
|
||||
let (mine, lead) = (footprint(row), footprint(&rows[index % columns]));
|
||||
assert!((mine.width() - lead.width()).abs() < 0.01 && (mine.left() - lead.left()).abs() < 0.01,
|
||||
"子代理胶囊同宽同位:面板宽 {width}, {mine:?} 对 {lead:?}");
|
||||
"子代理状态点对齐:面板宽 {width}, {mine:?} 对 {lead:?}");
|
||||
}
|
||||
harness.render().unwrap().save(directory.join(format!("dock-{width}-workers.png"))).unwrap();
|
||||
click(&mut harness, "productionProgressTag");
|
||||
@ -7498,7 +7479,6 @@ mod tests {
|
||||
let (mut app, requests) = dock_fixture();
|
||||
let w = app.jiansun.as_mut().unwrap();
|
||||
w.reduce_motion = true;
|
||||
w.busy = Some("pi-agent".into());
|
||||
w.messages = vec![
|
||||
json!({"role":"user","text":"制作详情、主图和 SKU"}),
|
||||
json!({"role":"assistant","kind":"activity","text":"已接收制作任务。正在保存当前资料,接下来会按模板准备画布。"}),
|
||||
@ -7584,9 +7564,10 @@ mod tests {
|
||||
w.messages.push(json!({"role":"assistant","kind":"reply","text":"首屏原片与文案一致,接下来核对主图的构图和规格。"}));
|
||||
h.run_steps(19);
|
||||
save(&mut h, "inline-reveal");
|
||||
h.run_steps(89);
|
||||
h.state_mut().jiansun.as_mut().unwrap().busy = None;
|
||||
h.run_steps(204);
|
||||
save(&mut h, "tool-completion-hold");
|
||||
h.run_steps(44);
|
||||
h.run_steps(20);
|
||||
save(&mut h, "tool-collapsing");
|
||||
h.run_steps(160);
|
||||
save(&mut h, "tool-folded");
|
||||
|
||||
@ -28,7 +28,6 @@ pub(super) fn cell_verified(t: &Tokens) -> Color32 { t.agent_semantic().verified
|
||||
/// One footprint for every sub-agent badge in the open head. A running badge
|
||||
/// is about 49pt wide (three dots, a letter, the padding); a waiting one owns
|
||||
/// no dots. The list gives both the same width so their labels share a column.
|
||||
pub(super) const WORKER_BADGE_WIDTH: f32 = 50.0;
|
||||
const EVENT_ICON_X: f32 = 12.0;
|
||||
const EVENT_ICON_CLEARANCE: f32 = 9.0;
|
||||
const EVENT_LABEL_X: f32 = 26.0;
|
||||
|
||||
@ -31,19 +31,51 @@ fn status(w: &Workspace, app: &PhotocraftApp) -> Value {
|
||||
}
|
||||
|
||||
fn stream_output(value: &Value) -> Option<Value> {
|
||||
let tokens = value["tokens"].as_u64().filter(|n| (1..=9_007_199_254_740_991).contains(n))?;
|
||||
let tokens = value["tokens"].as_u64().filter(|n| (1..=MAX_SAFE_INTEGER).contains(n))?;
|
||||
let estimated = value["estimated"].as_bool()?;
|
||||
let rate = value["tokensPerSecond"].as_f64().filter(|rate| rate.is_finite() && *rate > 0.0);
|
||||
Some(json!({"tokens":tokens,"estimated":estimated,"tokensPerSecond":rate}))
|
||||
}
|
||||
|
||||
const MAX_SAFE_INTEGER: u64 = 9_007_199_254_740_991;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, serde::Serialize)]
|
||||
pub(super) struct CopyUpdate<'a> {
|
||||
pub field: &'a str,
|
||||
pub text: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, serde::Serialize)]
|
||||
pub(super) struct CopyUpdates<'a> {
|
||||
pub total: u64,
|
||||
pub truncated: bool,
|
||||
pub items: Vec<CopyUpdate<'a>>,
|
||||
}
|
||||
|
||||
pub(super) fn copy_updates(event: &Value) -> Option<CopyUpdates<'_>> {
|
||||
if event["toolName"] != "write_copy_fields" || event["status"] != "completed" {
|
||||
return None;
|
||||
}
|
||||
let details = event["copyUpdates"].as_object()?;
|
||||
let total = details.get("total")?.as_u64().filter(|total| *total <= MAX_SAFE_INTEGER)?;
|
||||
let truncated = details.get("truncated")?.as_bool()?;
|
||||
let items = details.get("items")?.as_array().filter(|items| items.len() <= 48)?;
|
||||
let items = items.iter().map(|item| {
|
||||
let field = item["field"].as_str().filter(|field| {
|
||||
field.chars().take(81).count() <= 80 && !field.trim().is_empty()
|
||||
})?;
|
||||
let text = item["text"].as_str().filter(|text| text.chars().take(241).count() <= 240)?;
|
||||
Some(CopyUpdate { field, text })
|
||||
}).collect::<Option<Vec<_>>>()?;
|
||||
Some(CopyUpdates { total, truncated, items })
|
||||
}
|
||||
|
||||
// Tool activity is a deliberately narrow projection of SDK events. Never keep
|
||||
// tool arguments, provider errors, arbitrary summaries or unknown fields.
|
||||
fn tool_activity(w: &Workspace, event: &Value) -> Result<Value, String> {
|
||||
fn id(value: &Value) -> Option<&str> {
|
||||
value.as_str().filter(|s| !s.is_empty() && s.len() <= 200 && s.bytes().all(|b| b.is_ascii_alphanumeric() || b"_.:-".contains(&b)))
|
||||
}
|
||||
const MAX_SAFE_INTEGER: u64 = 9_007_199_254_740_991;
|
||||
if event["version"] != 1 || event["type"] != "tool" {
|
||||
return Err("工具状态版本无效".into());
|
||||
}
|
||||
@ -92,6 +124,9 @@ fn tool_activity(w: &Workspace, event: &Value) -> Result<Value, String> {
|
||||
let duration = event["durationMs"].as_u64().filter(|n| *n <= MAX_SAFE_INTEGER).ok_or("工具状态时长无效")?;
|
||||
clean["durationMs"] = json!(duration);
|
||||
}
|
||||
if let Some(updates) = copy_updates(event) {
|
||||
clean["copyUpdates"] = json!(updates);
|
||||
}
|
||||
Ok(clean)
|
||||
}
|
||||
|
||||
@ -1032,6 +1067,55 @@ mod tests {
|
||||
assert!(tool_activity(&w, &input["event"]).is_err(), "unregistered tool names remain rejected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_completed_copy_writes_persist_bounded_public_details() {
|
||||
let (mut w, mut app, mut input) = activity_fixture();
|
||||
input["event"]["toolName"] = json!("write_copy_fields");
|
||||
let details = json!({
|
||||
"total":2, "truncated":false, "secret":"discard",
|
||||
"items":[{"field":"S01 · 主标题","text":"胡桃木\n落座有承托","raw":"discard"},
|
||||
{"field":"S01 · 副标题","text":""}]
|
||||
});
|
||||
input["event"]["copyUpdates"] = details.clone();
|
||||
action(&mut w, &mut app, "pi-activity", &input).unwrap();
|
||||
assert!(w.messages.last().unwrap()["event"]["copyUpdates"].is_null());
|
||||
input["event"]["status"] = json!("completed");
|
||||
action(&mut w, &mut app, "pi-activity", &input).unwrap();
|
||||
let saved = &w.messages.last().unwrap()["event"]["copyUpdates"];
|
||||
assert_eq!(*saved, json!({"total":2,"truncated":false,"items":[
|
||||
{"field":"S01 · 主标题","text":"胡桃木\n落座有承托"},{"field":"S01 · 副标题","text":""}
|
||||
]}));
|
||||
let mut event = input["event"].clone();
|
||||
event["toolName"] = json!("canvas_read");
|
||||
assert!(tool_activity(&w, &event).unwrap()["copyUpdates"].is_null());
|
||||
event["toolName"] = json!("write_copy_fields");
|
||||
for status in ["started", "failed", "pending", "stopped"] {
|
||||
event["status"] = json!(status);
|
||||
assert!(tool_activity(&w, &event).unwrap()["copyUpdates"].is_null(), "{status}");
|
||||
}
|
||||
event["status"] = json!("completed");
|
||||
let at_limit = json!({"field":"字".repeat(80), "text":"文".repeat(240)});
|
||||
event["copyUpdates"] = json!({"total":MAX_SAFE_INTEGER,"truncated":true,"items":vec![at_limit.clone();48]});
|
||||
assert_eq!(tool_activity(&w, &event).unwrap()["copyUpdates"], event["copyUpdates"]);
|
||||
for malformed in [
|
||||
json!([]), json!({}),
|
||||
json!({"total":-1,"truncated":false,"items":[]}),
|
||||
json!({"total":1.5,"truncated":false,"items":[]}),
|
||||
json!({"total":MAX_SAFE_INTEGER + 1,"truncated":false,"items":[]}),
|
||||
json!({"total":1,"truncated":"false","items":[]}),
|
||||
json!({"total":1,"truncated":false,"items":{}}),
|
||||
json!({"total":49,"truncated":false,"items":vec![at_limit;49]}),
|
||||
json!({"total":1,"truncated":false,"items":[{"field":"", "text":""}]}),
|
||||
json!({"total":1,"truncated":false,"items":[{"field":" ","text":""}]}),
|
||||
json!({"total":1,"truncated":false,"items":[{"field":"字".repeat(81),"text":""}]}),
|
||||
json!({"total":1,"truncated":false,"items":[{"field":"主标题","text":"文".repeat(241)}]}),
|
||||
json!({"total":1,"truncated":false,"items":[{"field":"主标题","text":3}]}),
|
||||
] {
|
||||
event["copyUpdates"] = malformed;
|
||||
assert!(tool_activity(&w, &event).unwrap()["copyUpdates"].is_null(), "{}", event["copyUpdates"]);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malformed_or_foreign_tool_events_do_not_write_history_and_legacy_events_still_work() {
|
||||
let (mut w, mut app, input) = activity_fixture();
|
||||
|
||||
@ -86,13 +86,14 @@ impl ToolStatus {
|
||||
}
|
||||
}
|
||||
|
||||
/// 子代理所处的阶段。摘要行、计数行与展开列表的徽标都读它,三处不会各说各话。
|
||||
/// 子代理所处的阶段,供状态文字和计数使用。
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub(super) enum WorkerStage { Preparing, Generating, Reviewing, WaitingResult }
|
||||
pub(super) enum WorkerStage { Queued, Preparing, Generating, Reviewing, WaitingResult }
|
||||
|
||||
impl WorkerStage {
|
||||
pub(super) fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::Queued => "排队",
|
||||
Self::Preparing => "准备",
|
||||
Self::Generating => "生图",
|
||||
Self::Reviewing => "验图",
|
||||
@ -103,19 +104,21 @@ impl WorkerStage {
|
||||
pub(super) fn tone(self) -> Tone {
|
||||
match self {
|
||||
Self::Generating | Self::Reviewing => Tone::Active,
|
||||
Self::Preparing | Self::WaitingResult => Tone::Quiet,
|
||||
Self::Queued | Self::Preparing | Self::WaitingResult => Tone::Quiet,
|
||||
}
|
||||
}
|
||||
|
||||
/// 这一步是仍在等上游回执:徽标保持静止,不转圈。
|
||||
/// 排队或等待上游回执时使用安静的状态标识。
|
||||
pub(super) fn waiting(self) -> bool {
|
||||
self == Self::WaitingResult
|
||||
matches!(self, Self::Queued | Self::WaitingResult)
|
||||
}
|
||||
|
||||
/// 桥接兜底:回执还没有结构化的阶段字段,按步骤文案的前缀推断一次。
|
||||
/// 旧回执只提供步骤文案,由此归约为统一显示状态。
|
||||
pub(super) fn infer(step: &str, review: bool, from_image: bool) -> Self {
|
||||
if review {
|
||||
if step.contains("排队") {
|
||||
Self::Queued
|
||||
} else if review {
|
||||
Self::Reviewing
|
||||
} else if ["等待", "正在等待", "正在核查原", "正在定位原"].iter().any(|prefix| step.starts_with(prefix)) {
|
||||
Self::WaitingResult
|
||||
@ -129,12 +132,6 @@ impl WorkerStage {
|
||||
}
|
||||
}
|
||||
|
||||
/// 子代理编号按 A–Z 显示,更多编号保留原值。
|
||||
pub(super) fn worker_name(number: u64) -> String {
|
||||
if (1..=26).contains(&number) { char::from(b'A' + number as u8 - 1).to_string() }
|
||||
else { format!("#{number}") }
|
||||
}
|
||||
|
||||
/// 时间流里的通知类别。失败、待核查、未执行不再共用一个图标只靠颜色区分。
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub(super) enum NoticeKind { Saved, Produced, Waiting, NeedsCheck, Failed, Info }
|
||||
@ -575,8 +572,9 @@ mod tests {
|
||||
assert_eq!(WorkerStage::infer("准备素材", false, false), WorkerStage::Preparing);
|
||||
assert_eq!(WorkerStage::WaitingResult.label(), "等结果");
|
||||
assert!(WorkerStage::WaitingResult.waiting() && !WorkerStage::Generating.waiting());
|
||||
assert_eq!((1..=4).map(worker_name).collect::<String>(), "ABCD");
|
||||
assert_eq!([worker_name(5), worker_name(26), worker_name(99)], ["E", "Z", "#99"]);
|
||||
assert_eq!(WorkerStage::infer("候选等待验图 · 排队中", true, false), WorkerStage::Queued);
|
||||
assert_eq!(WorkerStage::Queued.label(), "排队");
|
||||
assert!(WorkerStage::Queued.waiting());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
//!
|
||||
//! 每一块只接收类型化的展示模型,输出 `Response` 与几何;不读 JSON、不嗅探文案、不决定任务是否在跑。
|
||||
|
||||
use super::agent_stream::{self, Cell, EventRow, EventTone, RowAction, WORKER_BADGE_WIDTH};
|
||||
use super::agent_stream::{self, Cell, EventRow, EventTone, RowAction};
|
||||
use super::pi_bridge::CopyUpdates;
|
||||
use super::stitch_kit::{adaptive_grid, caption, inline_notice, label, stop_button, GridColumns, StopSize};
|
||||
use super::stitch_state::{tool_glyph, worker_name, ErrorCategory, NoticeKind, RunState, Tone, ToolStatus, WorkerStage};
|
||||
use super::stitch_state::{tool_glyph, ErrorCategory, NoticeKind, RunState, Tone, ToolStatus, WorkerStage};
|
||||
use super::stitch_ui::{self as kit};
|
||||
use crate::theme::agent_scale::{control, icon, space, Type};
|
||||
use crate::theme::{Tokens, AGENT_SEMANTIC};
|
||||
@ -50,8 +51,14 @@ pub(super) fn thinking_row(ui: &mut Ui, id: egui::Id, status: ThinkingStatus, us
|
||||
/// 4. 工具调用组:计数与成败由数字给出,标题文案由库里拼,调用方不必先拼文案再让库拆回去。
|
||||
pub(super) use kit::ToolGroupHead;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(super) struct ToolRow<'a> { pub tool: &'a str, pub name: &'a str, pub status: ToolStatus, pub elapsed: Option<&'a str> }
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub(super) struct ToolRow<'a> {
|
||||
pub tool: &'a str,
|
||||
pub name: &'a str,
|
||||
pub status: ToolStatus,
|
||||
pub elapsed: Option<&'a str>,
|
||||
pub copy_updates: Option<CopyUpdates<'a>>,
|
||||
}
|
||||
|
||||
fn tool_group_summary(ui: &Ui, head: ToolGroupHead, rows: &[ToolRow<'_>]) -> (String, Option<String>) {
|
||||
if head.failed > 0 {
|
||||
@ -89,7 +96,13 @@ pub(super) fn tool_group(ui: &mut Ui, id: egui::Id, head: ToolGroupHead, rows: &
|
||||
let (label, meta) = tool_group_summary(ui, head, rows);
|
||||
kit::tool_group_head(ui, id, &label, meta.as_deref(), head, reduced, |ui| {
|
||||
for (index, row) in rows.iter().enumerate() {
|
||||
kit::task_status_row(ui, id.with(("tool", index)), tool_glyph(row.tool), row.name, row.status, row.elapsed, reduced);
|
||||
let row_id = id.with(("tool", index));
|
||||
if rows.len() != 1 || row.copy_updates.is_none() {
|
||||
kit::task_status_row(ui, row_id, tool_glyph(row.tool), row.name, row.status, row.elapsed, reduced);
|
||||
}
|
||||
if let Some(updates) = &row.copy_updates {
|
||||
kit::copy_update_details(ui, row_id.with("copy"), updates);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -426,7 +439,6 @@ pub(super) struct GoalProgressResponse {
|
||||
/// 路线图里阶段名那一列的宽度。
|
||||
const STAGE_NAME_WIDTH: f32 = 60.0;
|
||||
/// 展开列表里一行子代理的高度。
|
||||
const WORKER_ROW: f32 = 36.0;
|
||||
/// 整个目标的完成度:进度格、流水线各算一份;什么都没给时未知。
|
||||
fn progress_of(panel: &GoalProgressPanel<'_>) -> (f32, Option<f32>) {
|
||||
let (mut done, mut total) = (0.0_f32, 0.0_f32);
|
||||
@ -478,51 +490,55 @@ fn paint_ring(ui: &mut Ui, fraction: Option<f32>, fill: Color32) {
|
||||
}
|
||||
}
|
||||
|
||||
/// 子代理与当前步骤成组换行。
|
||||
fn worker_summary(ui: &mut Ui, id: egui::Id, workers: &[WorkerState<'_>], reduced: bool) {
|
||||
let t = Tokens::get(ui.ctx()).agent();
|
||||
adaptive_grid(ui, id.with("worker-summary"), GridColumns { min_cell: 90.0, max_cell: 140.0, most: 4 }, 8.0, workers.len(), |ui, index| {
|
||||
let worker = &workers[index];
|
||||
let letter = worker_name(worker.number);
|
||||
let kind = if !worker.active || worker.stage.waiting() { kit::BadgeKind::Neutral } else { kit::BadgeKind::Running };
|
||||
ui.allocate_ui_with_layout(vec2(ui.available_width(), control::ROW), Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.spacing_mut().item_spacing.x = space::XS;
|
||||
kit::badge_sized(ui, id.with(("stage", worker.number)), kind, &letter, reduced, WORKER_BADGE_WIDTH);
|
||||
ui.add(egui::Label::new(RichText::new(worker.stage.label()).font(Type::Meta.font_id()).color(t.text_dim)).extend());
|
||||
});
|
||||
});
|
||||
worker_grid(ui, id, "worker-summary", workers, reduced);
|
||||
}
|
||||
|
||||
/// 展开的子代理列表:窄栏一列,宽栏两列;字母角标定宽,所以等待与运行中的行对得齐。
|
||||
fn worker_list(ui: &mut Ui, workers: &[WorkerState<'_>], reduced: bool) -> Vec<Value> {
|
||||
let t = Tokens::get(ui.ctx()).agent();
|
||||
let mut geometry = Vec::new();
|
||||
let counts = [WorkerStage::Generating, WorkerStage::Reviewing, WorkerStage::WaitingResult, WorkerStage::Preparing]
|
||||
fn worker_list(ui: &mut Ui, id: egui::Id, workers: &[WorkerState<'_>], reduced: bool) -> Vec<Value> {
|
||||
let counts = [WorkerStage::Generating, WorkerStage::Reviewing, WorkerStage::WaitingResult, WorkerStage::Preparing, WorkerStage::Queued]
|
||||
.into_iter().filter_map(|stage| {
|
||||
let count = workers.iter().filter(|worker| worker.active && worker.stage == stage).count();
|
||||
(count > 0).then(|| format!("{} {count}", stage.label()))
|
||||
}).collect::<Vec<_>>().join(" · ");
|
||||
if !counts.is_empty() { caption(ui, counts); }
|
||||
adaptive_grid(ui, ui.scope_id().with("production-workers"), GridColumns { min_cell: 140.0, max_cell: 600.0, most: 2 }, space::SM, workers.len(), |ui, index| {
|
||||
let Some(worker) = workers.get(index) else { return };
|
||||
let letter = worker_name(worker.number);
|
||||
worker_grid(ui, id, "production-workers", workers, reduced).into_iter()
|
||||
.zip(workers).map(|(row, worker)| {
|
||||
json!({"worker": worker.number, "slot": worker.slot, "step": worker.stage.label(), "active": worker.active,
|
||||
"review": false, "rect": super::agent_panel::rect_value(row.0), "indicator": super::agent_panel::rect_value(row.1)})
|
||||
}).collect()
|
||||
}
|
||||
|
||||
fn worker_grid(ui: &mut Ui, id: egui::Id, section: &str, workers: &[WorkerState<'_>], reduced: bool) -> Vec<(Rect, Rect)> {
|
||||
let t = Tokens::get(ui.ctx()).agent();
|
||||
let columns = GridColumns { min_cell: 162.0, max_cell: 600.0, most: 2 };
|
||||
let (_, width) = columns.measure(ui.available_width(), space::XS, workers.len());
|
||||
let font = Type::Meta.font_id();
|
||||
let stage_width = ui.painter().layout_no_wrap("等结果".into(), font.clone(), t.text_dim).size().x.ceil();
|
||||
adaptive_grid(ui, id.with(section), columns, space::XS, workers.len(), |ui, index| {
|
||||
let worker = &workers[index];
|
||||
let running = worker.active && !worker.stage.waiting();
|
||||
let kind = if running { kit::BadgeKind::Running } else { kit::BadgeKind::Neutral };
|
||||
let cell = ui.allocate_ui_with_layout(vec2(ui.available_width().max(1.0), WORKER_ROW), Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
let badge = kit::badge_sized(ui, ui.scope_id().with("badge"), kind, &letter, reduced, WORKER_BADGE_WIDTH);
|
||||
ui.vertical(|ui| {
|
||||
ui.spacing_mut().item_spacing.y = 0.0;
|
||||
let needs_hint = ui.painter().layout_no_wrap(worker.slot.to_owned(), Type::Meta.font_id(), t.text).size().x > ui.available_width();
|
||||
let slot = ui.add(egui::Label::new(RichText::new(worker.slot).font(Type::Meta.font_id()).color(t.text)).truncate());
|
||||
if needs_hint { slot.on_hover_text(worker.slot); }
|
||||
caption(ui, worker.stage.label());
|
||||
});
|
||||
badge
|
||||
let cell = ui.allocate_ui_with_layout(vec2(width, control::COMPACT), Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.spacing_mut().item_spacing.x = space::XS;
|
||||
let (indicator, _) = ui.allocate_exact_size(vec2(icon::SM, control::COMPACT), egui::Sense::hover());
|
||||
if running {
|
||||
ui.painter().circle_stroke(indicator.center(), 4.5, Stroke::new(1.0, t.accent_text.gamma_multiply(0.42)));
|
||||
}
|
||||
ui.painter().circle_filled(indicator.center(), 2.25, if running { t.accent_text } else { t.text_faint });
|
||||
if !worker.slot.is_empty() {
|
||||
let slot_width = (width - icon::SM - 2.0 * space::XS - stage_width).max(1.0);
|
||||
let galley = ui.painter().layout_no_wrap(worker.slot.to_owned(), font.clone(), t.text);
|
||||
let label = egui::Label::new(RichText::new(worker.slot).font(font.clone()).color(t.text)).truncate();
|
||||
ui.allocate_ui_with_layout(vec2(slot_width, control::COMPACT), Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
ui.set_min_width(slot_width);
|
||||
let slot = ui.add(label);
|
||||
if galley.size().x > slot_width { slot.on_hover_text(worker.slot); }
|
||||
});
|
||||
}
|
||||
kit::flip_status_text(ui, id.with(("worker-stage", worker.number, worker.slot)), worker.stage.label(), stage_width, reduced);
|
||||
indicator
|
||||
});
|
||||
geometry.push(json!({"worker": worker.number, "slot": worker.slot, "step": worker.stage.label(), "active": worker.active,
|
||||
"review": false, "rect": super::agent_panel::rect_value(cell.response.rect), "badge": super::agent_panel::rect_value(cell.inner.rect)}));
|
||||
});
|
||||
geometry
|
||||
(cell.response.rect, cell.inner)
|
||||
}).inner
|
||||
}
|
||||
|
||||
/// 路线图抽屉:各阶段的进度条、时段或 Token 明细与图位。
|
||||
@ -654,7 +670,7 @@ where
|
||||
.max_height((ui.available_height() - 100.0).max(72.0)).show(ui, |ui| {
|
||||
ui.add_space(space::XS);
|
||||
if !panel.workers.is_empty() {
|
||||
workers = worker_list(ui, panel.workers, reduced);
|
||||
workers = worker_list(ui, id, panel.workers, reduced);
|
||||
}
|
||||
if let Some(stages) = panel.roadmap {
|
||||
slot_clicked = roadmap(ui, id, stages, &panel);
|
||||
@ -744,6 +760,170 @@ mod tests {
|
||||
output.shapes.iter().map(|clipped| count(&clipped.shape)).sum()
|
||||
}
|
||||
|
||||
fn copy_receipt() -> Value {
|
||||
json!({"toolName":"write_copy_fields","status":"completed","copyUpdates":{
|
||||
"total":8,"truncated":false,"items":[
|
||||
{"field":"S01 · 主标题","text":"坐下就有承托,沿着木纹看见自然的细节"},
|
||||
{"field":"S01 · 副标题","text":"北美黑胡桃木框架\n宽座面,落座更舒展"},
|
||||
{"field":"S02 · 材质","text":"木纹连续,触感温润"},
|
||||
{"field":"S02 · 角标","text":""},
|
||||
{"field":"S03 · 主标题","text":"柔和的边角,适合日常使用"},
|
||||
{"field":"S03 · 场景","text":"餐厅、书房都好搭"},
|
||||
{"field":"S04 · 主标题","text":"承重结构清晰可见"},
|
||||
{"field":"S04 · 脚注","text":"尺寸以实物为准"}
|
||||
]
|
||||
}})
|
||||
}
|
||||
|
||||
fn copy_row(receipt: &Value) -> ToolRow<'_> {
|
||||
ToolRow {
|
||||
tool: "write_copy_fields", name: "填写画布文案", status: ToolStatus::Completed,
|
||||
elapsed: Some("1.4s"), copy_updates: super::super::pi_bridge::copy_updates(receipt),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn copy_receipt_wraps_and_toggles_all_rows_without_repeating_a_single_tool() {
|
||||
let receipt = copy_receipt();
|
||||
let rows = [copy_row(&receipt)];
|
||||
for width in [270.0, 520.0] {
|
||||
let ctx = egui::Context::default();
|
||||
fonts(&ctx);
|
||||
let paint = |ui: &mut Ui| {
|
||||
ui.set_width(width);
|
||||
tool_group(ui, egui::Id::unique("copy-receipt"), ToolGroupHead {
|
||||
total: 1, completed: 1, turn_running: true, ..Default::default()
|
||||
}, &rows, true);
|
||||
};
|
||||
let output = render(&ctx, 0.0, paint);
|
||||
let drawn = texts(&output);
|
||||
for expected in ["共填写 8 处文案", "S01 · 主标题", "(留空)", "查看全部 8 处文案"] {
|
||||
assert!(drawn.iter().any(|text| text == expected), "{drawn:?}");
|
||||
}
|
||||
assert!(!drawn.iter().any(|text| text == "填写画布文案" || text == "S04 · 脚注"));
|
||||
let body = output.shapes.iter().find_map(|shape| match &shape.shape {
|
||||
egui::Shape::Text(text) if text.galley.text().contains("宽座面") => Some(&text.galley),
|
||||
_ => None,
|
||||
}).unwrap();
|
||||
assert_eq!(body.text(), "北美黑胡桃木框架\n宽座面,落座更舒展");
|
||||
assert_eq!(body.rows.len(), 2);
|
||||
assert!(body.size().x <= width - 31.0);
|
||||
let button = |output: &egui::FullOutput, label| output.shapes.iter().find_map(|shape| match &shape.shape {
|
||||
egui::Shape::Text(text) if text.galley.text() == label => Some(text.pos + text.galley.size() * 0.5),
|
||||
_ => None,
|
||||
}).unwrap_or_else(|| panic!("missing {label}"));
|
||||
click(&ctx, button(&output, "查看全部 8 处文案"), 0.5, paint);
|
||||
let expanded = render(&ctx, 0.6, paint);
|
||||
assert!(texts(&expanded).iter().any(|text| text == "尺寸以实物为准"));
|
||||
click(&ctx, button(&expanded, "收起"), 1.0, paint);
|
||||
assert!(!texts(&render(&ctx, 1.1, paint)).iter().any(|text| text == "尺寸以实物为准"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn worker_rows_fit_one_or_two_columns_and_use_slot_names() {
|
||||
let workers = [
|
||||
WorkerState { number: 1, stage: WorkerStage::Queued, slot: "详情首屏", active: true },
|
||||
WorkerState { number: 2, stage: WorkerStage::Preparing, slot: "", active: true },
|
||||
WorkerState { number: 3, stage: WorkerStage::WaitingResult, slot: "材质细节", active: true },
|
||||
];
|
||||
for width in [270.0, 520.0] {
|
||||
let ctx = egui::Context::default();
|
||||
fonts(&ctx);
|
||||
let mut geometry = Vec::new();
|
||||
let output = render(&ctx, 0.0, |ui| {
|
||||
ui.set_width(width);
|
||||
geometry = worker_grid(ui, egui::Id::unique("workers"), "summary", &workers, false);
|
||||
});
|
||||
let drawn = texts(&output);
|
||||
for expected in ["详情首屏", "排队", "准备", "材质细节", "等结果"] {
|
||||
assert!(drawn.iter().any(|text| text == expected), "{drawn:?}");
|
||||
}
|
||||
assert!(!drawn.iter().any(|text| matches!(text.as_str(), "A" | "B" | "C")));
|
||||
let first = geometry[0].0;
|
||||
let second = geometry[1].0;
|
||||
assert_eq!(first.top() == second.top(), width == 520.0);
|
||||
assert!(!first.intersects(second));
|
||||
assert!(geometry.iter().all(|(row, _)| row.right() <= first.left() + width + 0.5), "{geometry:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "GPU offscreen timeline evidence; writes only to PHOTOCRAFT_AGENT_QA_OUT"]
|
||||
fn timeline_worker_motion_gpu_evidence() {
|
||||
let _gpu = photocraft_testkit::gpu_lock();
|
||||
let out = std::path::PathBuf::from(std::env::var_os("PHOTOCRAFT_AGENT_QA_OUT").unwrap());
|
||||
struct State {
|
||||
receipt: Value,
|
||||
turn_running: bool,
|
||||
stage: WorkerStage,
|
||||
list: bool,
|
||||
reduced: bool,
|
||||
}
|
||||
for width in [270.0, 520.0] {
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(width, 660.0))
|
||||
.with_step_dt(1.0 / 120.0).wgpu().build_ui_state(|ui, state: &mut State| {
|
||||
if !kit::ui_fonts_ready(ui) { return; }
|
||||
let id = egui::Id::unique("timeline-worker-evidence");
|
||||
let t = Tokens::get(ui.ctx()).agent();
|
||||
egui::Frame::NONE.fill(t.dock).inner_margin(12).show(ui, |ui| {
|
||||
ui.set_min_height(636.0);
|
||||
kit::scope(ui, |ui| {
|
||||
let workers = [
|
||||
WorkerState { number: 1, stage: state.stage, slot: "S01 · 首屏产品场景", active: true },
|
||||
WorkerState { number: 2, stage: WorkerStage::Reviewing, slot: "S02 · 胡桃木纹理细节", active: true },
|
||||
WorkerState { number: 3, stage: WorkerStage::WaitingResult, slot: "S03 · 双人餐厅搭配场景与空间尺寸", active: true },
|
||||
];
|
||||
if state.list {
|
||||
worker_list(ui, id, &workers, state.reduced);
|
||||
} else {
|
||||
worker_summary(ui, id, &workers, state.reduced);
|
||||
}
|
||||
ui.add_space(space::MD);
|
||||
tool_group(ui, id.with("writes"), ToolGroupHead {
|
||||
total: 1, completed: 1, turn_running: state.turn_running, ..Default::default()
|
||||
}, &[copy_row(&state.receipt)], state.reduced);
|
||||
ui.add_space(space::SM);
|
||||
let read = ToolRow {
|
||||
tool: "canvas_read", name: "读取画布", status: ToolStatus::Completed,
|
||||
elapsed: Some("320ms"), copy_updates: None,
|
||||
};
|
||||
let check = ToolRow {
|
||||
tool: "workflow_read", name: "读取制作规则", status: ToolStatus::Completed,
|
||||
elapsed: Some("120ms"), copy_updates: None,
|
||||
};
|
||||
tool_group(ui, id.with("checks"), ToolGroupHead {
|
||||
total: 2, completed: 2, turn_running: state.turn_running, ..Default::default()
|
||||
}, &[read, check], state.reduced);
|
||||
});
|
||||
});
|
||||
}, State { receipt: copy_receipt(), turn_running: true, stage: WorkerStage::Queued, list: false, reduced: false });
|
||||
fonts(&h.ctx);
|
||||
let save = |h: &mut egui_kittest::Harness<State>, name| {
|
||||
h.render().unwrap().save(out.join(format!("timeline-{width}-{name}.png"))).unwrap();
|
||||
};
|
||||
h.run_steps(48);
|
||||
save(&mut h, "active-copy-and-tools");
|
||||
h.state_mut().turn_running = false;
|
||||
h.run_steps(204);
|
||||
save(&mut h, "turn-hold");
|
||||
h.run_steps(24);
|
||||
save(&mut h, "tool-exit-middle");
|
||||
h.run_steps(32);
|
||||
save(&mut h, "tool-exit-settled");
|
||||
h.state_mut().stage = WorkerStage::Generating;
|
||||
h.run_steps(8);
|
||||
save(&mut h, "status-flip-middle");
|
||||
h.run_steps(35);
|
||||
save(&mut h, "status-flip-settled");
|
||||
h.state_mut().list = true;
|
||||
h.state_mut().stage = WorkerStage::Reviewing;
|
||||
h.state_mut().reduced = true;
|
||||
h.run_steps(8);
|
||||
save(&mut h, "worker-list-reduced-motion");
|
||||
}
|
||||
}
|
||||
|
||||
fn fonts(ctx: &egui::Context) {
|
||||
crate::PhotocraftApp::setup_context(ctx, crate::theme::ThemeKind::ProMedium);
|
||||
}
|
||||
@ -765,12 +945,10 @@ mod tests {
|
||||
user_message(ui, "给这款边几做一整套详情页", None, true);
|
||||
target = target_row(ui, id.with("target"), "边几 · 胡桃木", true).rect;
|
||||
thinking_row(ui, id.with("thinking"), ThinkingStatus::Done, Some("1200 tokens"), true);
|
||||
// 这一组含失败项,默认折叠;测试里先展开,好核对各行。
|
||||
ui.data_mut(|data| data.insert_temp(id.with("tools").with("open"), true));
|
||||
tool_group(ui, id.with("tools"), ToolGroupHead { total: 3, completed: 2, failed: 1, active: false }, &[
|
||||
ToolRow { tool: "canvas_read", name: "读取画布", status: ToolStatus::Completed, elapsed: Some("400ms") },
|
||||
ToolRow { tool: "generate_slot_image", name: "生成候选图片", status: ToolStatus::Failed, elapsed: None },
|
||||
ToolRow { tool: "check_image_slots", name: "发起验图", status: ToolStatus::Started, elapsed: None },
|
||||
tool_group(ui, id.with("tools"), ToolGroupHead { total: 3, completed: 2, failed: 1, active: false, turn_running: true }, &[
|
||||
ToolRow { tool: "canvas_read", name: "读取画布", status: ToolStatus::Completed, elapsed: Some("400ms"), copy_updates: None },
|
||||
ToolRow { tool: "generate_slot_image", name: "生成候选图片", status: ToolStatus::Failed, elapsed: None, copy_updates: None },
|
||||
ToolRow { tool: "check_image_slots", name: "发起验图", status: ToolStatus::Started, elapsed: None, copy_updates: None },
|
||||
], true);
|
||||
notice_row(ui, id.with("notice"), Notice { kind: NoticeKind::Failed, text: "主图 4 · 细节特写没生成出来", hint: None }, true);
|
||||
notice_row(ui, id.with("check"), Notice { kind: NoticeKind::NeedsCheck, text: "有一条对话未确认结果", hint: None }, true);
|
||||
@ -945,7 +1123,7 @@ mod tests {
|
||||
assert!(opened.rect.height() > first.rect.height(), "{name}: the drawer takes real height");
|
||||
assert_eq!(opened.workers.len(), 3);
|
||||
for worker in &opened.workers {
|
||||
assert!(worker["rect"].is_array() && worker["badge"].is_array() && worker["step"].is_string(), "{worker}");
|
||||
assert!(worker["rect"].is_array() && worker["indicator"].is_array() && worker["step"].is_string(), "{worker}");
|
||||
}
|
||||
let drawn = texts(&output);
|
||||
for expected in ["详情页", "6/6 屏", "3/5 张", "4m", "1.2k tokens", "主图 4 · 细节特写", "等结果"] {
|
||||
|
||||
@ -309,29 +309,35 @@ pub(super) fn ai_loader(ui: &mut Ui, id: egui::Id, running: bool, reduced: bool)
|
||||
/// Each group keeps its own disclosure choice as tool states change. The
|
||||
/// heading is the same quiet row as every other timeline event.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub(super) struct ToolGroupHead { pub total: usize, pub completed: usize, pub failed: usize, pub active: bool }
|
||||
pub(super) struct ToolGroupHead {
|
||||
pub total: usize,
|
||||
pub completed: usize,
|
||||
pub failed: usize,
|
||||
pub active: bool,
|
||||
pub turn_running: bool,
|
||||
}
|
||||
|
||||
/// 工具调用组的展开选择与完成后的停留时钟。
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct ToolDisclosure {
|
||||
open: bool,
|
||||
user_pinned: Option<bool>,
|
||||
was_active: bool,
|
||||
was_turn_running: bool,
|
||||
finished_at: Option<f64>,
|
||||
}
|
||||
|
||||
impl ToolDisclosure {
|
||||
const HOLD_SECONDS: f64 = 1.2;
|
||||
const HOLD_SECONDS: f64 = 1.8;
|
||||
|
||||
fn update(&mut self, now: f64, active: bool, failed: bool) {
|
||||
if active {
|
||||
fn update(&mut self, now: f64, turn_running: bool, failed: bool) {
|
||||
if turn_running {
|
||||
self.finished_at = None;
|
||||
} else if self.was_active && !failed {
|
||||
} else if self.was_turn_running {
|
||||
self.finished_at = Some(now);
|
||||
}
|
||||
self.was_active = active;
|
||||
self.open = self.user_pinned.unwrap_or_else(|| active || failed
|
||||
|| self.finished_at.is_some_and(|finished| now < finished + Self::HOLD_SECONDS));
|
||||
self.was_turn_running = turn_running;
|
||||
self.open = self.user_pinned.unwrap_or_else(|| turn_running
|
||||
|| self.finished_at.is_some_and(|finished| failed || now < finished + Self::HOLD_SECONDS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,8 +345,9 @@ pub(super) fn tool_group_head<R>(ui: &mut Ui, id: egui::Id, heading: &str, meta:
|
||||
use super::agent_stream::{EventRow, EventTone, RowAction};
|
||||
let key = id.with("disclosure");
|
||||
let now = ui.input(|input| input.time);
|
||||
let mut state = ui.data(|data| data.get_temp::<ToolDisclosure>(key)).unwrap_or_default();
|
||||
state.update(now, head.active, head.failed > 0);
|
||||
let previous = ui.data(|data| data.get_temp::<ToolDisclosure>(key));
|
||||
let mut state = previous.unwrap_or_default();
|
||||
state.update(now, head.turn_running, head.failed > 0);
|
||||
let (glyph, tone) = if head.failed > 0 { ("triangle-alert", EventTone::Failure) }
|
||||
else if head.active { ("circle-dashed", EventTone::Working) }
|
||||
else if head.completed == head.total { ("check", EventTone::Success) }
|
||||
@ -353,12 +360,23 @@ pub(super) fn tool_group_head<R>(ui: &mut Ui, id: egui::Id, heading: &str, meta:
|
||||
state.open = !state.open;
|
||||
state.user_pinned = Some(state.open);
|
||||
}
|
||||
if state.open && state.user_pinned.is_none() && head.failed == 0 && ui.is_rect_visible(header.rect)
|
||||
let body_id = id.with("tool-body");
|
||||
let mut bounds = header.rect;
|
||||
bounds.max.y += ui.data(|data| data.get_temp::<f32>(body_id)).unwrap_or(0.0);
|
||||
let shown = !super::agent_motion::hidden(ui, bounds);
|
||||
if state.open && state.user_pinned.is_none() && head.failed == 0 && shown
|
||||
&& let Some(finished) = state.finished_at
|
||||
{
|
||||
ui.ctx().request_repaint_after(std::time::Duration::from_secs_f64((finished + ToolDisclosure::HOLD_SECONDS - now).max(0.0)));
|
||||
}
|
||||
morph_surface(ui, id.with("tool-body"), state.open, reduced, |ui| {
|
||||
let duration = if reduced || !shown { 0.0 } else { 0.20 };
|
||||
let motion_id = id.with("tool-body-motion");
|
||||
if previous.is_none() && state.open && duration > 0.0 {
|
||||
ui.ctx().animate_value_with_time(motion_id, 0.0, 0.0);
|
||||
}
|
||||
let linear = ui.ctx().animate_value_with_time(motion_id, f32::from(state.open), duration);
|
||||
let progress = egui::emath::easing::cubic_in_out(linear);
|
||||
tool_group_body(ui, body_id, state.open, progress, |ui| {
|
||||
egui::Frame::NONE.inner_margin(egui::Margin { left: 26, top: 2, right: 5, bottom: 4 }).show(ui, |ui| {
|
||||
ui.spacing_mut().item_spacing.y = 0.0;
|
||||
body(ui)
|
||||
@ -368,12 +386,113 @@ pub(super) fn tool_group_head<R>(ui: &mut Ui, id: egui::Id, heading: &str, meta:
|
||||
header
|
||||
}
|
||||
|
||||
fn tool_group_body(ui: &mut Ui, id: egui::Id, open: bool, progress: f32, body: impl FnOnce(&mut Ui)) {
|
||||
if progress <= 0.0 {
|
||||
return;
|
||||
}
|
||||
let area = ui.available_rect_before_wrap();
|
||||
let offset = vec2(0.0, -4.0 * (1.0 - progress));
|
||||
let mut child = ui.new_child(egui::UiBuilder::new().id_salt(id).max_rect(area.translate(offset)));
|
||||
if progress < 1.0 {
|
||||
let height = ui.data(|data| data.get_temp::<f32>(id)).unwrap_or(0.0);
|
||||
let clip = egui::Rect::from_min_size(area.min, vec2(area.width(), height * progress));
|
||||
child.set_clip_rect(ui.clip_rect().intersect(clip));
|
||||
}
|
||||
if !open {
|
||||
child.disable();
|
||||
}
|
||||
child.set_opacity(ui.opacity() * progress);
|
||||
body(&mut child);
|
||||
let height = child.min_size().y;
|
||||
ui.data_mut(|data| data.insert_temp(id, height));
|
||||
ui.advance_cursor_after_rect(egui::Rect::from_min_size(area.min, vec2(child.min_size().x, height * progress)));
|
||||
}
|
||||
|
||||
pub(super) fn copy_update_details(ui: &mut Ui, id: egui::Id, updates: &super::pi_bridge::CopyUpdates<'_>) {
|
||||
const PREVIEW_COUNT: usize = 6;
|
||||
let t = Tokens::get(ui.ctx()).agent();
|
||||
let show_all = ui.data(|data| data.get_temp::<bool>(id)).unwrap_or(false);
|
||||
let count = updates.items.len();
|
||||
let visible = if show_all { count } else { count.min(PREVIEW_COUNT) };
|
||||
let summary = if updates.truncated {
|
||||
format!("共填写 {} 处文案 · 已记录 {count} 处", updates.total)
|
||||
} else {
|
||||
format!("共填写 {} 处文案", updates.total)
|
||||
};
|
||||
super::stitch_kit::caption(ui, summary);
|
||||
for item in &updates.items[..visible] {
|
||||
ui.add_space(space::SM);
|
||||
let text = if item.text.is_empty() { "(留空)" } else { item.text };
|
||||
super::stitch_kit::caption(ui, item.field);
|
||||
ui.add_space(space::XS * 0.5);
|
||||
ui.add(egui::Label::new(RichText::new(text).font(Type::Body.font_id()).color(t.text)).wrap());
|
||||
}
|
||||
if count > PREVIEW_COUNT {
|
||||
ui.add_space(space::XS);
|
||||
let label = if show_all { "收起".to_owned() } else { format!("查看全部 {count} 处文案") };
|
||||
if ui.push_id(id, |ui| action_button_height(ui, &label, ButtonRole::Quiet, true, control::ROW)).inner.clicked() {
|
||||
ui.data_mut(|data| data.insert_temp(id, !show_all));
|
||||
}
|
||||
}
|
||||
ui.add_space(space::XS);
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct StatusFlip {
|
||||
current: String,
|
||||
previous: Option<String>,
|
||||
started: f64,
|
||||
}
|
||||
|
||||
pub(super) fn flip_status_text(ui: &mut Ui, id: egui::Id, text: &str, width: f32, reduced: bool) -> Response {
|
||||
const SECONDS: f64 = 0.26;
|
||||
let now = ui.input(|input| input.time);
|
||||
let (previous, fraction) = ui.data_mut(|data| {
|
||||
let state = data.get_temp_mut_or_insert_with(id, || StatusFlip {
|
||||
current: text.to_owned(),
|
||||
previous: None,
|
||||
started: now,
|
||||
});
|
||||
if state.current != text {
|
||||
state.previous = Some(std::mem::replace(&mut state.current, text.to_owned()));
|
||||
state.started = now;
|
||||
}
|
||||
let fraction = ((now - state.started) / SECONDS).clamp(0.0, 1.0) as f32;
|
||||
if reduced || fraction >= 1.0 {
|
||||
state.previous = None;
|
||||
}
|
||||
(state.previous.clone(), fraction)
|
||||
});
|
||||
let t = Tokens::get(ui.ctx()).agent();
|
||||
let font = Type::Meta.font_id();
|
||||
let height = ui.fonts_mut(|fonts| fonts.row_height(&font));
|
||||
let (rect, response) = ui.allocate_exact_size(vec2(width, height), egui::Sense::hover());
|
||||
response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Label, true, text));
|
||||
if !ui.is_rect_visible(rect) {
|
||||
return response;
|
||||
}
|
||||
let painter = ui.painter_at(rect);
|
||||
let draw = |text: &str, offset: f32, color| {
|
||||
painter.text(rect.left_center() + vec2(0.0, offset), egui::Align2::LEFT_CENTER, text, font.clone(), color);
|
||||
};
|
||||
if let Some(previous) = previous {
|
||||
let progress = egui::emath::easing::cubic_out(fraction);
|
||||
let highlight = (1.0 - (fraction - 0.18).abs() * 2.5).max(0.0) * 0.7;
|
||||
draw(&previous, -height * progress, t.text_dim.gamma_multiply(1.0 - progress));
|
||||
draw(text, height * (1.0 - progress), t.text_dim.lerp_to_gamma(t.text, highlight).gamma_multiply(progress));
|
||||
schedule(ui, rect, Pace::Full);
|
||||
} else {
|
||||
draw(text, 0.0, t.text_dim);
|
||||
}
|
||||
response
|
||||
}
|
||||
|
||||
/// 旧签名垫片:标题形如"工具调用 · 3/5 已完成 · 1 项失败",成败仍从文案里读。
|
||||
/// 这是本文件里唯一一处读中文文案定色调的地方;第 2 批把调用方迁到 `typed_tool_group` 后删除。
|
||||
#[cfg(test)]
|
||||
pub(super) fn tool_group<R>(ui: &mut Ui, id: egui::Id, title: &str, active: bool, reduced: bool, body: impl FnOnce(&mut Ui) -> R) {
|
||||
let (heading, count) = title.split_once(" · ").map_or((title, None), |(heading, count)| (heading, Some(count)));
|
||||
let head = ToolGroupHead { active, failed: usize::from(title.contains("失败")), total: 0, completed: 0 };
|
||||
let head = ToolGroupHead { active, turn_running: active, failed: usize::from(title.contains("失败")), total: 0, completed: 0 };
|
||||
tool_group_head(ui, id, heading, count, head, reduced, body);
|
||||
}
|
||||
|
||||
@ -2673,14 +2792,16 @@ mod tests {
|
||||
#[test]
|
||||
fn tool_disclosure_holds_success_then_respects_manual_pins_and_failures() {
|
||||
let mut state = ToolDisclosure::default();
|
||||
state.update(0.0, false, true);
|
||||
assert!(!state.open, "a historical failure starts closed");
|
||||
state.update(0.0, false, false);
|
||||
assert!(!state.open);
|
||||
state.update(0.5, true, false);
|
||||
assert!(state.open);
|
||||
state.update(1.0, false, false);
|
||||
state.update(2.19, false, false);
|
||||
state.update(2.79, false, false);
|
||||
assert!(state.open);
|
||||
state.update(2.2, false, false);
|
||||
state.update(2.8, false, false);
|
||||
assert!(!state.open);
|
||||
state.update(3.0, false, true);
|
||||
assert!(state.open);
|
||||
@ -2700,25 +2821,76 @@ mod tests {
|
||||
crate::PhotocraftApp::setup_context(&ctx, crate::theme::ThemeKind::ProMedium);
|
||||
settle_test_cjk_font(&ctx);
|
||||
let id = egui::Id::unique("tool-completion");
|
||||
let frame = |time, active| {
|
||||
let frame = |time, turn_running, failed| {
|
||||
let mut height = 0.0;
|
||||
let mut output = ctx.settle_ui(egui::RawInput { time: Some(time), ..Default::default() }, |ui| {
|
||||
tool_group(ui, id, "工具调用 · 1/1 已完成", active, false, |ui| { ui.label("读取画布"); });
|
||||
let heading = tool_group_head(ui, id, "已完成 · 读取画布", None, ToolGroupHead {
|
||||
total: 1, completed: 1, failed, active: false, turn_running,
|
||||
}, false, |ui| { ui.label("读取画布"); });
|
||||
height = ui.min_rect().bottom() - heading.rect.bottom();
|
||||
});
|
||||
let delay = super::super::agent_motion::requested_delay(&output);
|
||||
output.textures_delta.clear();
|
||||
delay
|
||||
(height, delay)
|
||||
};
|
||||
frame(0.0, true);
|
||||
frame(0.5, true);
|
||||
frame(1.0, false);
|
||||
let hold = frame(1.2, false).expect("sleep until the completion deadline");
|
||||
assert!(!hold.is_zero() && hold <= std::time::Duration::from_millis(1001), "{hold:?}");
|
||||
frame(2.3, false);
|
||||
frame(2.7, false);
|
||||
assert_eq!(frame(3.0, false), None);
|
||||
frame(0.0, false, 1);
|
||||
let (closed, history_repaint) = frame(0.5, false, 1);
|
||||
assert_eq!(history_repaint, None);
|
||||
frame(0.6, true, 0);
|
||||
frame(1.0, true, 0);
|
||||
let (expanded, active_repaint) = frame(1.1, true, 0);
|
||||
assert!(expanded > closed + 10.0);
|
||||
assert_eq!(active_repaint, None, "a completed tool in a running turn can stay open without polling");
|
||||
frame(1.5, false, 0);
|
||||
let (holding, delay) = frame(1.7, false, 0);
|
||||
assert_eq!(holding, expanded);
|
||||
let hold = delay.expect("sleep until the completion deadline");
|
||||
assert!(!hold.is_zero() && hold <= std::time::Duration::from_millis(1601), "{hold:?}");
|
||||
assert_eq!(frame(3.29, false, 0).0, expanded);
|
||||
frame(3.3, false, 0);
|
||||
let (mid, repaint) = frame(3.37, false, 0);
|
||||
assert!(closed < mid && mid < expanded, "{closed} < {mid} < {expanded}");
|
||||
assert!(repaint.is_some());
|
||||
frame(3.6, false, 0);
|
||||
assert_eq!(frame(4.0, false, 0), (closed, None));
|
||||
assert!(!ctx.data(|data| data.get_temp::<ToolDisclosure>(id.with("disclosure"))).unwrap().open);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn status_flip_moves_and_fades_in_one_line_then_stops_repainting() {
|
||||
let ctx = Context::default();
|
||||
crate::PhotocraftApp::setup_context(&ctx, crate::theme::ThemeKind::ProMedium);
|
||||
settle_test_cjk_font(&ctx);
|
||||
let id = egui::Id::unique("worker-status-flip");
|
||||
let frame = |time, status, reduced| {
|
||||
let mut rect = egui::Rect::NOTHING;
|
||||
let mut output = ctx.settle_ui(egui::RawInput { time: Some(time), ..Default::default() }, |ui| {
|
||||
rect = flip_status_text(ui, id, status, 48.0, reduced).rect;
|
||||
});
|
||||
let delay = super::super::agent_motion::requested_delay(&output);
|
||||
output.textures_delta.clear();
|
||||
let texts = output.shapes.into_iter().filter_map(|shape| {
|
||||
let egui::Shape::Text(text) = shape.shape else { return None };
|
||||
assert_eq!(shape.clip_rect, rect);
|
||||
Some((text.galley.text().to_owned(), text.pos.y, text.fallback_color))
|
||||
}).collect::<Vec<_>>();
|
||||
(texts, delay)
|
||||
};
|
||||
let (before, _) = frame(0.0, "排队", false);
|
||||
frame(1.0, "生图", false);
|
||||
let (middle, repaint) = frame(1.055, "生图", false);
|
||||
assert_eq!(middle.len(), 2);
|
||||
assert_eq!((&middle[0].0[..], &middle[1].0[..]), ("排队", "生图"));
|
||||
assert!(middle[0].1 < before[0].1 && middle[1].1 > before[0].1);
|
||||
assert!(middle.iter().all(|line| line.2.a() < before[0].2.a()));
|
||||
assert!(repaint.is_some());
|
||||
let (after, _) = frame(1.3, "生图", false);
|
||||
assert_eq!(after, vec![("生图".into(), before[0].1, before[0].2)]);
|
||||
assert_eq!(frame(1.4, "生图", false).1, None);
|
||||
assert_eq!(frame(1.5, "验图", true), (vec![("验图".into(), before[0].1, before[0].2)], None));
|
||||
assert_eq!(frame(1.6, "验图", false).1, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_live_final_reply_has_glow_then_settles_while_history_is_immediately_still() {
|
||||
let ctx = Context::default();
|
||||
@ -2875,7 +3047,7 @@ mod tests {
|
||||
let t = Tokens::get(&ctx).agent();
|
||||
let output = ctx.settle_ui(egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, vec2(400.0, 200.0))), ..Default::default() }, |ui| {
|
||||
scope_with_motion(ui, true, |ui| {
|
||||
let head = ToolGroupHead { total: 2, completed: 1, failed: 0, active: true };
|
||||
let head = ToolGroupHead { total: 2, completed: 1, failed: 0, active: true, turn_running: true };
|
||||
tool_group_head(ui, egui::Id::unique("plain-body"), "正在更新图层…", None, head, true, |ui| {
|
||||
let top = ui.next_widget_position().y;
|
||||
task_row(ui, egui::Id::unique("plain-row"), "check", "读取画布", "completed", Some("1.3s"), true);
|
||||
|
||||
@ -1419,7 +1419,7 @@ mod tests {
|
||||
w.workflow.operations.push(json!({"run":w.pi_run,"intent":"generate_candidate","phase":"submitted",
|
||||
"operationId":slot,"slotId":slot,"candidateId":slot,"workerNumber":worker,"slotLabel":label,
|
||||
"accountId":w.account["id"],"origin":w.origin,"documentId":w.owner_doc,"productVariantId":"walnut"}));
|
||||
w.track_worker_image(&json!({"taskId":slot,"slotId":slot,"variantId":"walnut",
|
||||
w.track_worker_image(&json!({"taskId":slot,"slotId":slot,"variantId":"walnut","text":"正在生图",
|
||||
"accountId":w.account["id"],"origin":w.origin,"doc":w.owner_doc,"imageFrame":frame}));
|
||||
}
|
||||
app.jiansun = Some(w);
|
||||
@ -1464,12 +1464,16 @@ mod tests {
|
||||
}
|
||||
assert_eq!(placeholders[0]["taskId"], "portrait");
|
||||
assert_eq!(placeholders[1]["taskId"], "wide");
|
||||
let mut badges = Vec::new();
|
||||
let mut generating = Vec::new();
|
||||
let mut legacy_badges = Vec::new();
|
||||
for shape in &output.shapes {
|
||||
text_rects(&shape.shape, "子代理 B", &mut badges);
|
||||
text_rects(&shape.shape, "正在生图", &mut generating);
|
||||
text_rects(&shape.shape, "子代理 A", &mut legacy_badges);
|
||||
text_rects(&shape.shape, "子代理 B", &mut legacy_badges);
|
||||
}
|
||||
assert!(!badges.is_empty(), "width {width}, clip {}, shelf bottom {shelf_bottom}", state.panel_geometry["conversationClip"]);
|
||||
assert!(badges.iter().all(|rect| rect.top() as f64 >= shelf_bottom - 1.0));
|
||||
assert!(generating.iter().any(|rect| rect.top() as f64 >= shelf_bottom - 1.0),
|
||||
"width {width}, clip {}, shelf bottom {shelf_bottom}", state.panel_geometry["conversationClip"]);
|
||||
assert!(legacy_badges.is_empty());
|
||||
assert!(state.panel_geometry["imageResourcesClip"].is_null(), "pending jobs cannot populate the resource gallery");
|
||||
output.textures_delta.clear();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user