fix: preserve canvas agent media metadata
This commit is contained in:
parent
3c7c122b2f
commit
5e82adb7eb
@ -116,6 +116,7 @@ function buildMediaNode(params: {
|
||||
const now = new Date().toISOString();
|
||||
const type = mediaNodeType(params.item);
|
||||
const metadata = {
|
||||
...(params.plan.metadata || {}),
|
||||
...(params.item.metadata || {}),
|
||||
generatedByAgent: true,
|
||||
canvasAgentOperationId: params.plan.operationId,
|
||||
|
||||
@ -361,7 +361,21 @@ test.describe("canvas agent operation mutation contract", () => {
|
||||
sourceNodeIds: ["image-source"],
|
||||
anchorNodeId: "image-source",
|
||||
placement: "right",
|
||||
mediaItems: [buildMutationMediaItem("media-revision", ["image-source"])],
|
||||
mediaItems: [
|
||||
{
|
||||
...buildMutationMediaItem("media-revision", ["image-source"]),
|
||||
prompt: "turn the background white",
|
||||
metadata: {
|
||||
model: "test-image-model",
|
||||
provider: "test-provider",
|
||||
},
|
||||
},
|
||||
],
|
||||
metadata: {
|
||||
messageId: "assistant-message-1",
|
||||
chatId: "chat-1",
|
||||
model: "plan-level-model",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -376,11 +390,17 @@ test.describe("canvas agent operation mutation contract", () => {
|
||||
type: "image",
|
||||
data: {
|
||||
src: "https://cdn.example.com/media-revision.png",
|
||||
prompt: "turn the background white",
|
||||
metadata: {
|
||||
generatedByAgent: true,
|
||||
canvasAgentOperationId: "op-append-revision",
|
||||
canvasAgentMediaItemId: "media-revision",
|
||||
revisionOf: "image-source",
|
||||
sourceNodeIds: ["image-source"],
|
||||
messageId: "assistant-message-1",
|
||||
chatId: "chat-1",
|
||||
model: "test-image-model",
|
||||
provider: "test-provider",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user