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 now = new Date().toISOString();
|
||||||
const type = mediaNodeType(params.item);
|
const type = mediaNodeType(params.item);
|
||||||
const metadata = {
|
const metadata = {
|
||||||
|
...(params.plan.metadata || {}),
|
||||||
...(params.item.metadata || {}),
|
...(params.item.metadata || {}),
|
||||||
generatedByAgent: true,
|
generatedByAgent: true,
|
||||||
canvasAgentOperationId: params.plan.operationId,
|
canvasAgentOperationId: params.plan.operationId,
|
||||||
|
|||||||
@ -361,7 +361,21 @@ test.describe("canvas agent operation mutation contract", () => {
|
|||||||
sourceNodeIds: ["image-source"],
|
sourceNodeIds: ["image-source"],
|
||||||
anchorNodeId: "image-source",
|
anchorNodeId: "image-source",
|
||||||
placement: "right",
|
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",
|
type: "image",
|
||||||
data: {
|
data: {
|
||||||
src: "https://cdn.example.com/media-revision.png",
|
src: "https://cdn.example.com/media-revision.png",
|
||||||
|
prompt: "turn the background white",
|
||||||
metadata: {
|
metadata: {
|
||||||
generatedByAgent: true,
|
generatedByAgent: true,
|
||||||
canvasAgentOperationId: "op-append-revision",
|
canvasAgentOperationId: "op-append-revision",
|
||||||
canvasAgentMediaItemId: "media-revision",
|
canvasAgentMediaItemId: "media-revision",
|
||||||
revisionOf: "image-source",
|
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