合入变换来源可指定为图位当前采用的图(R5-Z57)
This commit is contained in:
commit
1fb5fcfa2b
@ -42,11 +42,12 @@ const productImageArgs={
|
||||
referenceIndex:optional(page),referenceCrop:optional(Type.Tuple(Array.from({length:4},()=>Type.Integer({minimum:0,maximum:1000})))),
|
||||
};
|
||||
const reuseTarget=obj({outputId:optional(text),slotId:slotRef});
|
||||
const transformDescription='在本机裁切、镜像、旋转、缩放或位移本款实拍及任一成品的同花色候选。sourceCandidateId 接收候选编号,referenceIndex 接收从 0 开始的实拍序号。来源编号无效时返回匹配图位或目标图位的已完成候选。返回新候选、cropSourcePixels、targetFrame、resolutionRatio 和 resolutionSufficient。';
|
||||
const transformDescription='在本机裁切、镜像、旋转、缩放或位移本款实拍及任一成品的同花色候选。sourceSlotId 精确匹配本项目的完整 slotId、fieldId 或图位标签,使用该图位当前采用的同花色候选,可跨成品。sourceCandidateId 接收候选编号,referenceIndex 接收从 0 开始的实拍序号,三种来源互斥。来源编号无效时返回匹配图位或目标图位的已完成候选。返回新候选、实际来源 sourceCandidateId、cropSourcePixels、targetFrame、resolutionRatio 和 resolutionSufficient。';
|
||||
const transformImageArgs={
|
||||
reference:optional(productReference),
|
||||
sourceSlotId:optional(Type.String({description:'来源图位的完整 slotId、fieldId 或标签,使用当前采用的同花色候选。'})),
|
||||
sourceCandidateId:optional(Type.String({description:'本项目当前花色的已完成候选号,可来自其他图位。'})),
|
||||
referenceIndex:optional(Type.Integer({minimum:0,maximum:7,description:'本款实拍的零起始编号,与候选号二选一。'})),
|
||||
referenceIndex:optional(Type.Integer({minimum:0,maximum:7,description:'本款实拍的零起始编号。'})),
|
||||
...canvasTransformArgs,
|
||||
};
|
||||
const settledImagePhases=['complete','failed','retired','expired'];
|
||||
@ -831,8 +832,8 @@ export async function openProductionOperations(host,{target=host.productionGoal,
|
||||
if(action==='transform')notice('画布调整已有候选');
|
||||
return result;
|
||||
};
|
||||
const transformImage=(slot,{sourceCandidateId,referenceIndex,reference,...transform},signal)=>
|
||||
serialize(()=>localCandidate(slot,'transform',{sourceCandidateId,referenceIndex:reference?referenceIndexOf(reference):referenceIndex,transform},signal,'transform'));
|
||||
const transformImage=(slot,{sourceSlotId,sourceCandidateId,referenceIndex,reference,...transform},signal)=>
|
||||
serialize(()=>localCandidate(slot,'transform',{sourceSlotId,sourceCandidateId,referenceIndex:reference?referenceIndexOf(reference):referenceIndex,transform},signal,'transform'));
|
||||
const prepareImageRequest=async(slot,{prompt,retryOf,prefer2k,
|
||||
references,referenceIndexes,reworkCandidateId,reworkChange,useTemplateBase},signal)=>{
|
||||
signal?.throwIfAborted();
|
||||
|
||||
@ -13,7 +13,7 @@ maxGenerationAttempts: 4
|
||||
- `read_slot_images` 读取图位实拍、模板参考和候选。 `use_product_image` 用 `reference` 或零起始的 `referenceIndex` 指定实拍,`referenceCrop` 指定裁切区域。
|
||||
- `prepare_image_request` 保存生图请求并返回正式提示词、参考顺序、模型参数及候选请求号。`useTemplateBase: true` 将该图位的固定模板原图作为第一张输入,`false` 不发送该底图。`referenceIndexes` 按数组顺序选取本款实拍,编号从 0 开始。`prefer2k: true` 请求 2K。`reworkCandidateId` 标识原候选,`reworkChange` 记录改动。
|
||||
- `dispatch_image_request` 接收准备回执的首个 `requestId` 并派发同批请求。宿主通过该编号读取绑定的版本和哈希。`candidatesPerSlot` 是一批请求的目标候选数,`maxCandidatesPerSlot` 是图位累计派发上限。已派发后失败或结果未知均计入额度。
|
||||
- `transform_slot_image` 可裁切、镜像、旋转、缩放或平移实拍及任一成品的同花色候选。`sourceCandidateId` 指定来源候选。`cropSourcePixels` 是裁切使用的源像素尺寸,`targetFrame` 是目标图框,`resolutionRatio` 是裁切像素相对图框的分辨率比,`resolutionSufficient` 表示源像素是否达到该图框所需分辨率。
|
||||
- `transform_slot_image` 可裁切、镜像、旋转、缩放或平移实拍及任一成品的同花色候选。`sourceSlotId` 精确匹配本项目的完整 slotId、fieldId 或图位标签,使用该图位当前采用的同花色候选,支持跨成品。`sourceCandidateId` 指定候选编号,`referenceIndex` 指定从 0 开始的实拍序号,三种来源互斥。回执的 `sourceCandidateId` 是实际使用的候选编号。`cropSourcePixels` 是裁切使用的源像素尺寸,`targetFrame` 是目标图框,`resolutionRatio` 是裁切像素相对图框的分辨率比,`resolutionSufficient` 表示源像素是否达到该图框所需分辨率。
|
||||
- `write_copy_fields` 原位写入文案。需要刻意留空时,将该字段的 `text` 设为空字符串,并在 `reason` 说明依据。
|
||||
- `check_output_screens` 按 `pages` 复核并保存整屏意见。`read_screen_review` 按 `page` 查询最近一次整屏意见。屏号从 1 开始。
|
||||
- `review_image_slots` 返回候选、`comparison`、实际像素、画幅、请求和验图回执。`check_image_slots` 委托验图。`adopt_production_image` 用候选号回填,`reason` 记录采用理由。`reconcile_image_slots` 按原编号查询或取回请求结果。
|
||||
|
||||
@ -406,10 +406,13 @@ for (const referenceMode of ['composition-only','none']) test('canvas advice lea
|
||||
const read=await tools.find(tool=>tool.name==='read_slot_images').execute();
|
||||
assert.deepEqual(read.content.slice(1),referenceMode==='composition-only'?[image,layout]:[image]);
|
||||
const transform=tools.find(tool=>tool.name==='transform_slot_image');
|
||||
const receipt=await transform.execute('crop',{sourceCandidateId:'original',...options});
|
||||
const receipt=await transform.execute('crop',{sourceSlotId:'M03',...options});
|
||||
assert.equal(receipt.terminate,undefined);
|
||||
assert.deepEqual(Object.fromEntries(Object.keys(metrics).map(key=>[key,receipt.details[key]])),metrics);
|
||||
assert.equal(receipt.details.sourceRequestId,'source-request');
|
||||
assert.equal(receipt.details.sourceCandidateId,'original');
|
||||
assert.equal(transforms.at(-1).sourceSlotId,'M03');
|
||||
assert.deepEqual(transforms.at(-1).transform,options);
|
||||
return;
|
||||
}
|
||||
reviewed.push(candidateId);
|
||||
@ -432,7 +435,7 @@ for (const referenceMode of ['composition-only','none']) test('canvas advice lea
|
||||
assert.equal(withoutAdvice.recommendedAction,undefined);
|
||||
|
||||
const fixed=await actions.transform_slot_image({slotId:'P05',sourceCandidateId:'original',...options});
|
||||
assert.deepEqual(transforms,[{slotId:'slot',sourceCandidateId:'original',referenceIndex:undefined,transform:options}]);
|
||||
assert.deepEqual(transforms,[{slotId:'slot',sourceSlotId:undefined,sourceCandidateId:'original',referenceIndex:undefined,transform:options}]);
|
||||
assert.deepEqual(fixed,{phase:'complete',status:'complete',id:'fixed',candidateId:'fixed',sourceCandidateId:'original',
|
||||
materialTaskId:'original-task',sourceRequestId:'source-request',...metrics});
|
||||
|
||||
|
||||
@ -4049,7 +4049,8 @@ impl Backend {
|
||||
)
|
||||
}
|
||||
pub(super) fn production_image_request(&mut self, doc: u64, binding: &Value, events: &mpsc::Sender<Event>,
|
||||
ctx: &egui::Context, cancellation: Option<&std::sync::atomic::AtomicBool>) -> Result<Value, BridgeFailure> {
|
||||
ctx: &egui::Context, snapshot: Option<&photocraft_ui_egui::jiansun::PiCanvasSnapshot>) -> Result<Value, BridgeFailure> {
|
||||
let cancellation = snapshot.map(|snapshot| snapshot.cancellation.as_ref());
|
||||
self.check_dispatch().map_err(|message| BridgeFailure::new("auth_revoked", false, false, message))?;
|
||||
self.ensure_owner(doc)?;
|
||||
let dir = self.project_dir(doc)?;
|
||||
@ -4107,6 +4108,13 @@ impl Backend {
|
||||
input["detailBatch"] = json!(true);
|
||||
input["detailWorkspace"] = binding["scope"].clone();
|
||||
input["projectScopedImage"] = binding["projectScope"].clone();
|
||||
if phase == "transform" && !input["sourceSlotId"].is_null() {
|
||||
let state = load_detail_workspace(&dir)?;
|
||||
let variant = uuid(&input["variantId"], "花色")?;
|
||||
input["sourceCandidateId"] = json!(jiansun_image_transform::adopted_source(
|
||||
&dir, &state, &input, &variant, snapshot.map(|snapshot| snapshot.document.as_ref()),
|
||||
)?);
|
||||
}
|
||||
let action = match phase {
|
||||
"transform" => "slot-transform-image",
|
||||
"product_reference" => {
|
||||
@ -5949,7 +5957,12 @@ mod tests {
|
||||
approval["request"][field] = if field == "slotId" { json!(slot) } else { prior };
|
||||
}
|
||||
let cancelled = std::sync::atomic::AtomicBool::new(true);
|
||||
let stopped = backend.production_image_request(doc, &approval, &events, &ctx, Some(&cancelled)).unwrap_err();
|
||||
let snapshot = photocraft_ui_egui::jiansun::PiCanvasSnapshot {
|
||||
document: Arc::new(Document::new("取消测试", photocraft_doc::Size::new(1, 1), photocraft_doc::ColorMode::Rgb, photocraft_doc::SampleType::U8)),
|
||||
cancellation: Arc::new(cancelled),
|
||||
slot_source: None,
|
||||
};
|
||||
let stopped = backend.production_image_request(doc, &approval, &events, &ctx, Some(&snapshot)).unwrap_err();
|
||||
assert_eq!(stopped.category, "cancelled");
|
||||
assert!(!stopped.dispatched);
|
||||
assert!(read_json(&file).unwrap()["frozenAt"].is_null());
|
||||
@ -6590,8 +6603,10 @@ mod tests {
|
||||
}
|
||||
let mut state = load(dir).unwrap();
|
||||
let slots = state["template"]["outputs"][0]["slots"].as_array_mut().unwrap();
|
||||
slots[0]["name"] = json!("详情来源图");
|
||||
let mut target = slots[0].clone();
|
||||
target["fieldId"] = json!("S01-I02");
|
||||
target["name"] = json!("目标图位");
|
||||
slots.push(target);
|
||||
state["template"]["contentHash"] = json!(template_slots::pack_hash(&state["template"]).unwrap());
|
||||
state["structureHash"] = json!(hash(&json!([state["template"]["contentHash"],state["width"]]).to_string()));
|
||||
@ -6686,6 +6701,7 @@ mod tests {
|
||||
main["outputs"][0]["component"] = json!("main_images");
|
||||
main["outputs"][0]["id"] = json!("M01");
|
||||
main["outputs"][0]["slots"][0]["fieldId"] = json!("M01-I01");
|
||||
main["outputs"][0]["slots"][0]["name"] = json!("主图图位");
|
||||
main["contentHash"] = json!(template_slots::pack_hash(&main).unwrap());
|
||||
let detail = state["template"].clone();
|
||||
state["productTemplates"] = json!({"detail":detail,"main_images":main});
|
||||
@ -6746,6 +6762,49 @@ mod tests {
|
||||
assert_eq!(cross_output["resolutionRatio"], json!(1.2));
|
||||
assert_eq!(cross_output["resolutionSufficient"], true);
|
||||
assert_eq!(load(dir).unwrap()["activeOutput"], "detail");
|
||||
let mut cross_output = json!({"action":"transform","projectScope":true,
|
||||
"scope":{"id":state["id"],"templateHash":pack["contentHash"],"outputId":"main_images","variantId":variant},
|
||||
"request":{"slotId":main_slot,"sourceSlotId":source["binding"]["fieldId"],"transform":{"flipX":true}}});
|
||||
let error = backend.production_image_request(doc, &cross_output, &events, &ctx, None).unwrap_err().to_string();
|
||||
assert!(error.contains("没有已采用") && error.contains(&source_id), "{error}");
|
||||
for (key, value) in [("sourceCandidateId", json!(source_id)), ("referenceIndex", json!(0))] {
|
||||
cross_output["request"][key] = value;
|
||||
let error = backend.production_image_request(doc, &cross_output, &events, &ctx, None).unwrap_err().to_string();
|
||||
assert!(error.contains("只能填写其中一项"), "{error}");
|
||||
cross_output["request"].as_object_mut().unwrap().remove(key);
|
||||
}
|
||||
|
||||
let mut canvas = slot_canvas::skeleton(&detail, "detail", None, &variant).unwrap();
|
||||
let mut meta = mapping(&canvas).unwrap();
|
||||
meta["workspaceId"] = state["id"].clone();
|
||||
canvas.metadata.text.retain(|(key, _)| key != MAPPING);
|
||||
canvas.metadata.text.push((MAPPING.into(), meta.to_string()));
|
||||
let source_slot = source["binding"]["slotId"].as_str().unwrap();
|
||||
canvas.metadata.text.push((format!("jiansun.adopted.{variant}.{source_slot}"), source_id.clone()));
|
||||
let bytes = photocraft_format::save_to_bytes(&canvas, &Default::default()).unwrap();
|
||||
assert!(save_edited_output(dir, &canvas, &bytes).unwrap());
|
||||
let field = &detail["outputs"][0]["slots"][0];
|
||||
for source_ref in [field.get("name").or(field.get("label")).unwrap(), &field["fieldId"], &source["binding"]["slotId"]] {
|
||||
cross_output["request"]["sourceSlotId"] = source_ref.clone();
|
||||
let receipt = backend.production_image_request(doc, &cross_output, &events, &ctx, None).unwrap();
|
||||
assert_eq!(receipt["sourceCandidateId"], source_id);
|
||||
assert_eq!(receipt["sourceOutputId"], "detail");
|
||||
assert_eq!(receipt["slotId"], main_slot);
|
||||
}
|
||||
let mut snapshot = photocraft_ui_egui::jiansun::PiCanvasSnapshot {
|
||||
document: Arc::new(canvas),
|
||||
cancellation: Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
||||
slot_source: None,
|
||||
};
|
||||
let receipt = backend.production_image_request(doc, &cross_output, &events, &ctx, Some(&snapshot)).unwrap();
|
||||
assert_eq!(receipt["sourceCandidateId"], source_id);
|
||||
Arc::make_mut(&mut snapshot.document).metadata.text.retain(|(key, _)| !key.starts_with("jiansun.adopted."));
|
||||
let error = backend.production_image_request(doc, &cross_output, &events, &ctx, Some(&snapshot)).unwrap_err().to_string();
|
||||
assert!(error.contains("没有已采用") && error.contains(&source_id), "{error}");
|
||||
cross_output["request"]["sourceSlotId"] = json!("不存在的图位");
|
||||
let error = backend.production_image_request(doc, &cross_output, &events, &ctx, None).unwrap_err().to_string();
|
||||
assert!(error.contains("没有精确匹配") && error.contains("已完成候选:[]"), "{error}");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -9,45 +9,97 @@ use image::{Rgba, Rgba32FImage, imageops};
|
||||
use photocraft_codecs::{ChannelLayout, Image, SampleType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
fn invalid_source(dir: &Path, state: &Value, candidate: &str, target: &str, variant: &str) -> String {
|
||||
let mut source_slots = std::collections::HashSet::new();
|
||||
fn matching_slots<'a>(state: &'a Value, source: &str, variant: Option<&str>) -> std::collections::HashMap<String, (&'a str, &'a Value)> {
|
||||
let mut slots = std::collections::HashMap::new();
|
||||
let packs = state["productTemplates"].as_object().into_iter().flat_map(|packs| packs.values())
|
||||
.chain(std::iter::once(&state["template"]));
|
||||
for pack in packs {
|
||||
for field in pack["outputs"].as_array().into_iter().flatten()
|
||||
.flat_map(|output| output["slots"].as_array().into_iter().flatten())
|
||||
.filter(|field| field["kind"] == "image")
|
||||
for (output, field) in pack["outputs"].as_array().into_iter().flatten()
|
||||
.flat_map(|output| output["slots"].as_array().into_iter().flatten().map(move |field| (output, field)))
|
||||
.filter(|(_, field)| field["kind"] == "image")
|
||||
{
|
||||
let Some(field_id) = field["fieldId"].as_str() else { continue; };
|
||||
let label = field.get("name").or(field.get("label")).and_then(Value::as_str);
|
||||
for color in state["variants"].as_array().into_iter().flatten().filter_map(|row| row["id"].as_str()) {
|
||||
if variant.is_some_and(|variant| variant != color) { continue; }
|
||||
let id = slot_id(&pack["contentHash"], color, field_id);
|
||||
if candidate == id || candidate == field_id || label == Some(candidate) {
|
||||
source_slots.insert(id);
|
||||
if source == id || source == field_id || label == Some(source) {
|
||||
slots.insert(id, (output["component"].as_str().unwrap_or("detail"), &pack["contentHash"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let matched_slot = !source_slots.is_empty();
|
||||
let sources = state["candidates"].as_array().into_iter().flatten().rev().filter_map(Value::as_str)
|
||||
slots
|
||||
}
|
||||
|
||||
fn completed_sources(dir: &Path, state: &Value, matches: impl Fn(&Value) -> bool) -> Vec<Value> {
|
||||
state["candidates"].as_array().into_iter().flatten().rev().filter_map(Value::as_str)
|
||||
.filter_map(|id| read_candidate(dir, id).ok())
|
||||
.filter(|row| {
|
||||
let binding = &row["binding"];
|
||||
candidate_available(row) && if matched_slot {
|
||||
binding["slotId"].as_str().is_some_and(|id| source_slots.contains(id))
|
||||
} else {
|
||||
binding["slotId"] == target && binding["variantId"] == variant
|
||||
}
|
||||
})
|
||||
.filter(|row| candidate_available(row) && matches(&row["binding"]))
|
||||
.take(8)
|
||||
.map(|row| json!({"candidateId":row["id"],"slotId":row["binding"]["slotId"],
|
||||
"fieldId":row["binding"]["fieldId"],"variantId":row["binding"]["variantId"],"phase":row["phase"]}))
|
||||
.collect::<Vec<_>>();
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn invalid_source(dir: &Path, state: &Value, candidate: &str, target: &str, variant: &str) -> String {
|
||||
let slots = matching_slots(state, candidate, None);
|
||||
let matched_slot = !slots.is_empty();
|
||||
let sources = completed_sources(dir, state, |binding| {
|
||||
if matched_slot {
|
||||
binding["slotId"].as_str().is_some_and(|id| slots.contains_key(id))
|
||||
} else {
|
||||
binding["slotId"] == target && binding["variantId"] == variant
|
||||
}
|
||||
});
|
||||
let scope = if matched_slot { "匹配图位的已完成候选" } else { "目标图位同花色的已完成候选" };
|
||||
let received = candidate.chars().take(200).collect::<String>();
|
||||
format!("来源候选编号无效:收到「{received}」;sourceCandidateId 应填候选编号。{scope}:{}。跨图位候选可用 list_project_images 查询。", json!(sources))
|
||||
}
|
||||
|
||||
pub(super) fn adopted_source(dir: &Path, state: &Value, input: &Value, variant: &str, active: Option<&super::Document>) -> R<String> {
|
||||
if !input["sourceCandidateId"].is_null() || !input["referenceIndex"].is_null() {
|
||||
return Err("sourceSlotId、sourceCandidateId 和 referenceIndex 只能填写其中一项".into());
|
||||
}
|
||||
let source = input["sourceSlotId"].as_str().ok_or("sourceSlotId 应为图位编号或标签")?;
|
||||
let slots = matching_slots(state, source, Some(variant));
|
||||
let sources = || completed_sources(dir, state, |binding| {
|
||||
binding["slotId"].as_str().is_some_and(|id| slots.contains_key(id))
|
||||
});
|
||||
let reason = match slots.len() {
|
||||
0 => "当前花色没有精确匹配的图位",
|
||||
1 => {
|
||||
let (slot, (component, template)) = slots.iter().next().unwrap();
|
||||
let matches = |canvas: &super::Document| {
|
||||
super::mapping(canvas).is_some_and(|meta| meta["workspaceId"] == state["id"]
|
||||
&& &meta["templateHash"] == *template && meta["component"] == *component
|
||||
&& meta["variantId"] == variant)
|
||||
};
|
||||
let saved;
|
||||
let canvas = if let Some(active) = active.filter(|canvas| matches(canvas)) {
|
||||
Some(active)
|
||||
} else {
|
||||
let key = super::mapping_key(variant, component, None);
|
||||
let file = dir.join("template-outputs").join(format!("canvas-{key}-edited.pcraft"));
|
||||
saved = if file.is_file() {
|
||||
Some(super::super::load_draft(dir, &file).map_err(|_| "来源成品的工作画布无法读取")?)
|
||||
} else { None };
|
||||
saved.as_ref().filter(|canvas| matches(canvas))
|
||||
};
|
||||
let marker = format!("jiansun.adopted.{variant}.{slot}");
|
||||
if let Some((_, id)) = canvas.and_then(|canvas| canvas.metadata.text.iter().find(|(key, _)| key == &marker)) {
|
||||
if read_candidate(dir, id).is_ok_and(|record| candidate_available(&record)
|
||||
&& record["binding"]["slotId"] == *slot && record["binding"]["variantId"] == variant) {
|
||||
return Ok(id.clone());
|
||||
}
|
||||
}
|
||||
"该图位当前没有已采用的可用候选"
|
||||
}
|
||||
_ => "匹配到多个图位,请填写完整 slotId",
|
||||
};
|
||||
Err(format!("来源图位「{source}」{reason}。匹配图位的已完成候选:{}。", json!(sources())).into())
|
||||
}
|
||||
|
||||
pub(super) fn stage_candidate(dir: &Path, state: Value, input: &Value) -> R<Value> {
|
||||
let slot = input["slotId"].as_str().ok_or("缺少目标图位")?;
|
||||
let variant = uuid(&input["variantId"], "花色")?;
|
||||
|
||||
@ -795,8 +795,7 @@ fn run_inner(b: &mut Backend, input: &Value, events: &mpsc::Sender<Event>, ctx:
|
||||
let task_ctx = ctx.clone();
|
||||
let dispatch = v["action"] == "dispatch";
|
||||
let worker = std::thread::spawn(move || {
|
||||
let cancellation = snapshot.as_ref().map(|snapshot| snapshot.cancellation.as_ref());
|
||||
let result = worker.production_image_request(doc, &v, &task_events, &task_ctx, cancellation);
|
||||
let result = worker.production_image_request(doc, &v, &task_events, &task_ctx, snapshot.as_ref());
|
||||
let reply = match result {
|
||||
Ok(value) => json!({"value":value}),
|
||||
Err(error) => json!({"error":error.wire()}),
|
||||
|
||||
@ -672,7 +672,7 @@ fn action_impl(w: &mut Workspace, app: &mut PhotocraftApp, ctx: Option<&egui::Co
|
||||
let allowed: &[&str] = match action {
|
||||
"prepare" => &["slotId","instructions","geometryReferenceIndex","prefer2k","retryOf","reworkOf","reworkChange",
|
||||
"referenceIndexes","useTemplateBase"],
|
||||
"transform" => &["slotId","sourceCandidateId","referenceIndex","transform"],
|
||||
"transform" => &["slotId","sourceSlotId","sourceCandidateId","referenceIndex","transform"],
|
||||
"product_reference" => &["slotId","referenceIndex","referenceCrop"],
|
||||
"read" => &["requestId"],
|
||||
_ => &["requestId","expectedRevision","expectedHash","slotId","workerNumber"],
|
||||
@ -1120,11 +1120,12 @@ mod tests {
|
||||
input["request"] = match action {
|
||||
"prepare" => json!({"slotId":"detail-slot","instructions":"准备首屏"}),
|
||||
"dispatch" => json!({"slotId":"detail-slot","requestId":"saved-request"}),
|
||||
"transform" => json!({"slotId":"detail-slot","referenceIndex":0,"transform":{}}),
|
||||
"transform" => json!({"slotId":"detail-slot","sourceSlotId":"M03","transform":{}}),
|
||||
"product_reference" => json!({"slotId":"detail-slot","referenceIndex":0}),
|
||||
_ => json!({"requestId":"saved-request"}),
|
||||
};
|
||||
let reply = private_action_in_ui(&mut w, &mut app, &ctx, "pi-image-request", &input).unwrap();
|
||||
assert_eq!(reply["request"], input["request"]);
|
||||
assert_eq!(reply["projectScope"], true);
|
||||
assert_eq!(reply["scope"], json!({"id":"workspace","outputId":"detail","variantId":"oak","templateHash":"detail-pack"}));
|
||||
assert!(reply["writeEpoch"].is_null());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user